This commit is contained in:
aozhiwei 2023-03-01 12:23:44 +08:00
parent c22ae8e67c
commit 4ad43ff7da
3 changed files with 16 additions and 1 deletions

View File

@ -105,8 +105,22 @@ void SprintBuff::CoCollisionCheck()
void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_objects)
{
if (pre_pos.ManhattanDistance2D(owner->GetPos()) < 2) {
++stop_times_;
if (stop_times_ > 3) {
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;
}
stop_times_ = 0;
glm::vec3 dir = owner->GetPos().ToGlmVec3() - pre_pos.ToGlmVec3();
dir.y = 0.0f;

View File

@ -16,4 +16,5 @@ class SprintBuff : public Buff
void OnEnemyHit(Creature* enemy);
void ProcSkill();
int stop_times_ = 0;
};

View File

@ -110,7 +110,7 @@ void Movement::CalcTargetPos(float distance)
point.tar_pos.GetZ() < 0) {
abort();
}
#ifdef DEBUG
#ifdef DEBUG1
if (owner_->IsPlayer()) {
a8::XPrintf("CalcTargetPos src_pos:%f,%f,%f tar_pos:%f,%f,%f is_hit:%d start:%f,%f,%f end:%f,%f,%f distance:%f src_distance:%f\n",
{