Core/Movement: followup

Port From (https://github.com/TrinityCore/TrinityCore/commit/9fd26c5f09c6c99635a8cd8ac961abe9d0c79e5d)
This commit is contained in:
hondacrx
2022-02-22 14:05:35 -05:00
parent 338a861cd9
commit 7b0eb70fe7
@@ -77,8 +77,8 @@ namespace Game.Movement
if (target == null || !target.IsInWorld)
return false;
// the owner might be unable to move (rooted or casting), pause movement
if (owner.HasUnitState(UnitState.NotMove) || owner.IsMovementPreventedByCasting())
// the owner might be unable to move (rooted or casting), or we have lost the target, pause movement
if (owner.HasUnitState(UnitState.NotMove) || owner.IsMovementPreventedByCasting() || HasLostTarget(owner, target))
{
owner.StopMoving();
_lastTargetPosition = null;
@@ -246,6 +246,11 @@ namespace Game.Movement
public override void UnitSpeedChanged() { _lastTargetPosition = null; }
static bool HasLostTarget(Unit owner, Unit target)
{
return owner.GetVictim() != target;
}
static bool IsMutualChase(Unit owner, Unit target)
{
if (target.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Chase)