mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user