This commit is contained in:
aozhiwei 2022-12-29 15:00:41 +08:00
parent 9eaf1c84b0
commit 09f0a373ee
2 changed files with 42 additions and 38 deletions

View File

@ -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<int, long long> hited_objects = std::map<int, long long>();

View File

@ -10,6 +10,7 @@ class SprintBuff : public Buff
virtual void Deactivate() override;
private:
void SprintMove();
void CollisionCheck();
void ProcSkill();