diff --git a/server/gameserver/buff/sprint.cc b/server/gameserver/buff/sprint.cc index 1de06479..22821bc3 100644 --- a/server/gameserver/buff/sprint.cc +++ b/server/gameserver/buff/sprint.cc @@ -18,44 +18,7 @@ void SprintBuff::Activate() } if (caster_.Get()->IsPlayer()) { - { - int old_times = owner->GetDisableMoveDirTimes(); - owner->SetDisableMoveDirTimes(0); - owner->SetMoveDir(owner->context_dir); - owner->SetAttackDir(owner->context_dir); - owner->SetDisableMoveDirTimes(old_times); -#ifdef DEBUG - { - owner->SendDebugMsg(a8::Format("xxxxxxxx move_dir:%d,%d attack_dir:%d,%d speed:%d", - { - owner->GetMoveDir().x, - owner->GetMoveDir().y, - owner->GetAttackDir().x, - owner->GetAttackDir().y, - owner->GetSpeed() - })); - owner->room->xtimer.SetIntervalEx - ( - 2, - [this] (int event, const a8::Args* args) - { - if (a8::TIMER_EXEC_EVENT == event) { - Human* hum = owner->AsHuman(); - hum->SendDebugMsg(a8::Format("xxxxxxxx move_dir:%d,%d attack_dir:%d,%d speed:%d", - { - hum->GetMoveDir().x, - hum->GetMoveDir().y, - hum->GetAttackDir().x, - hum->GetAttackDir().y, - hum->GetSpeed() - })); - } - }, - &xtimer_attacher - ); - } -#endif - } + SprintMove(); CollisionCheck(); } ProcSkill(); @@ -71,6 +34,46 @@ void SprintBuff::Deactivate() } } +void SprintBuff::SprintMove() +{ + int old_times = owner->GetDisableMoveDirTimes(); + owner->SetDisableMoveDirTimes(0); + owner->SetMoveDir(owner->context_dir); + owner->SetAttackDir(owner->context_dir); + owner->SetDisableMoveDirTimes(old_times); +#ifdef DEBUG + { + owner->SendDebugMsg(a8::Format("xxxxxxxx move_dir:%d,%d attack_dir:%d,%d speed:%d", + { + owner->GetMoveDir().x, + owner->GetMoveDir().y, + owner->GetAttackDir().x, + owner->GetAttackDir().y, + owner->GetSpeed() + })); + owner->room->xtimer.SetIntervalEx + ( + 2, + [this] (int event, const a8::Args* args) + { + if (a8::TIMER_EXEC_EVENT == event) { + Human* hum = owner->AsHuman(); + hum->SendDebugMsg(a8::Format("xxxxxxxx move_dir:%d,%d attack_dir:%d,%d speed:%d", + { + hum->GetMoveDir().x, + hum->GetMoveDir().y, + hum->GetAttackDir().x, + hum->GetAttackDir().y, + hum->GetSpeed() + })); + } + }, + &xtimer_attacher + ); + } +#endif +} + void SprintBuff::CollisionCheck() { std::map hited_objects = std::map(); diff --git a/server/gameserver/buff/sprint.h b/server/gameserver/buff/sprint.h index f315b60f..2d37dedc 100644 --- a/server/gameserver/buff/sprint.h +++ b/server/gameserver/buff/sprint.h @@ -10,6 +10,7 @@ class SprintBuff : public Buff virtual void Deactivate() override; private: + void SprintMove(); void CollisionCheck(); void ProcSkill();