diff options
author | ccrs <ccrs@users.noreply.github.com> | 2020-05-11 19:38:36 +0200 |
---|---|---|
committer | ccrs <ccrs@users.noreply.github.com> | 2020-05-11 19:38:36 +0200 |
commit | 472e1fd8aeea80c6b32253007a204e645f89dc2e (patch) | |
tree | b5cba5b11194294e359956559505673a6053f20b /src | |
parent | 16d4a39c7d32e6d269f7926228b0df539722f44e (diff) |
Core/Movement: 9080e78 followup
actually port back the previous implementation, now correctly
this implies that a unit that has a different victim than the one its chasing will stand still till either:
- a new movement replaces the current, for w/e reason
- the chase target is again the current victim
probably a pause implementation on the generator is a more elegant solution...
updates #24600
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp index 056da0f5a5a..b3e9e56c81e 100644 --- a/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp @@ -26,6 +26,11 @@ #include "Unit.h" #include "Util.h" +static bool HasLostTarget(Unit* owner, Unit* target) +{ + return owner->GetVictim() != target; +} + static bool IsMutualChase(Unit* owner, Unit* target) { if (target->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) @@ -97,8 +102,8 @@ bool ChaseMovementGenerator::Update(Unit* owner, uint32 diff) if (!target || !target->IsInWorld()) return false; - // the owner might be unable to move (rooted or casting), pause movement - if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting()) + // the owner might be unable to move (rooted or casting), or we have lost the target, pause movement + if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting() || HasLostTarget(owner, target)) { owner->StopMoving(); _lastTargetPosition.reset(); |