Core/Movement: followup
Port From (https://github.com/TrinityCore/TrinityCore/commit/9fd26c5f09c6c99635a8cd8ac961abe9d0c79e5d)
This commit is contained in:
@@ -77,8 +77,8 @@ namespace Game.Movement
|
|||||||
if (target == null || !target.IsInWorld)
|
if (target == null || !target.IsInWorld)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// the owner might be unable to move (rooted or casting), pause movement
|
// 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())
|
if (owner.HasUnitState(UnitState.NotMove) || owner.IsMovementPreventedByCasting() || HasLostTarget(owner, target))
|
||||||
{
|
{
|
||||||
owner.StopMoving();
|
owner.StopMoving();
|
||||||
_lastTargetPosition = null;
|
_lastTargetPosition = null;
|
||||||
@@ -246,6 +246,11 @@ namespace Game.Movement
|
|||||||
|
|
||||||
public override void UnitSpeedChanged() { _lastTargetPosition = null; }
|
public override void UnitSpeedChanged() { _lastTargetPosition = null; }
|
||||||
|
|
||||||
|
static bool HasLostTarget(Unit owner, Unit target)
|
||||||
|
{
|
||||||
|
return owner.GetVictim() != target;
|
||||||
|
}
|
||||||
|
|
||||||
static bool IsMutualChase(Unit owner, Unit target)
|
static bool IsMutualChase(Unit owner, Unit target)
|
||||||
{
|
{
|
||||||
if (target.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Chase)
|
if (target.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Chase)
|
||||||
|
|||||||
Reference in New Issue
Block a user