1
This commit is contained in:
parent
eb677aba5f
commit
710ea892d0
@ -7,9 +7,11 @@
|
||||
#include "skill.h"
|
||||
#include "room.h"
|
||||
#include "human.h"
|
||||
#include "ability.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/Skill.h"
|
||||
#include "mt/SkillNumber.h"
|
||||
|
||||
void SprintBuff::Activate()
|
||||
{
|
||||
@ -100,22 +102,23 @@ void SprintBuff::CoCollisionCheck()
|
||||
std::map<int, long long> hited_objects = std::map<int, long long>();
|
||||
Position pre_pos;
|
||||
pre_pos = owner->GetPos();
|
||||
Position src_pos = owner->GetPos();
|
||||
owner->room->xtimer.SetIntervalEx
|
||||
(
|
||||
1,
|
||||
[this, hited_objects, pre_pos]
|
||||
[this, hited_objects, pre_pos, src_pos]
|
||||
(int event, const a8::Args* args) mutable
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (!meta->_buff_param3_int_list.empty() || skill_meta) {
|
||||
Check(pre_pos, hited_objects);
|
||||
Check(pre_pos, src_pos, hited_objects);
|
||||
}
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
}
|
||||
|
||||
void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_objects)
|
||||
void SprintBuff::Check(Position& pre_pos, Position& src_pos, std::map<int, long long>& hited_objects)
|
||||
{
|
||||
if (pre_pos.ManhattanDistance2D(owner->GetPos()) < 2) {
|
||||
++stop_times_;
|
||||
@ -134,6 +137,32 @@ void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_object
|
||||
return;
|
||||
}
|
||||
stop_times_ = 0;
|
||||
if (skill_meta) {
|
||||
switch (skill_meta->GetMagicId()) {
|
||||
case MAGIC_20901_XIONG:
|
||||
{
|
||||
float moved_distance = owner->GetPos().Distance2D2(src_pos);
|
||||
if (moved_distance >= skill_meta->_number_meta->_float_range) {
|
||||
owner->room->xtimer.SetTimeoutEx
|
||||
(
|
||||
1,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
owner->RemoveBuffByUniId(buff_uniid);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 dir = owner->GetPos().ToGlmVec3() - pre_pos.ToGlmVec3();
|
||||
dir.y = 0.0f;
|
||||
@ -204,6 +233,7 @@ void SprintBuff::ProcSkill()
|
||||
owner->room->xtimer.ModifyTime
|
||||
(remover_timer,
|
||||
SkillHelper::GetYmczBuffTime(skill_meta) / FRAME_RATE_MS);
|
||||
owner->GetAbility()->AddSpeedAddition(skill_meta->_number_meta->_float_speed);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -218,9 +248,5 @@ void SprintBuff::ProcSkill()
|
||||
void SprintBuff::ProcXiongHun()
|
||||
{
|
||||
owner->TryAddBuff(owner, 209016);
|
||||
}
|
||||
|
||||
float SprintBuff::GetSpeed()
|
||||
{
|
||||
return meta->_buff_param2;
|
||||
owner->GetAbility()->DelSpeedAddition(skill_meta->_number_meta->_float_speed);
|
||||
}
|
||||
|
@ -8,12 +8,11 @@ class SprintBuff : public Buff
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
float GetSpeed();
|
||||
|
||||
private:
|
||||
void SprintMove();
|
||||
void CoCollisionCheck();
|
||||
void Check(Position& pre_pos, std::map<int, long long>& hited_objects);
|
||||
void Check(Position& pre_pos, Position& src_pos, std::map<int, long long>& hited_objects);
|
||||
void OnEnemyHit(Creature* enemy);
|
||||
void ProcSkill();
|
||||
void ProcXiongHun();
|
||||
|
@ -492,12 +492,6 @@ float Human::GetSpeed()
|
||||
return buff->meta->_buff_param2;
|
||||
}
|
||||
}
|
||||
{
|
||||
Buff* buff = GetBuffByEffectId(kBET_Sprint);
|
||||
if (buff) {
|
||||
return ((SprintBuff*)buff)->GetSpeed();
|
||||
}
|
||||
}
|
||||
float speed = 1.0;
|
||||
if (downed) {
|
||||
speed = meta->move_speed3();
|
||||
|
Loading…
x
Reference in New Issue
Block a user