mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-04 22:07:52 +00:00
fix(Core/Movement): Fix caster NPC infinite chase (#26120)
This commit is contained in:
@@ -196,20 +196,13 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
// the owner might be unable to move (rooted or casting), or we have lost the target, pause movement
|
// 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) || HasLostTarget(owner) || isStoppedBecauseOfCasting)
|
if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || HasLostTarget(owner) || isStoppedBecauseOfCasting)
|
||||||
{
|
{
|
||||||
|
// Every time a caster mob stops to cast a spell, the leash timer ticks down. Once the timer expires, the mob evades and walks home.
|
||||||
owner->StopMoving();
|
owner->StopMoving();
|
||||||
_lastTargetPosition.reset();
|
_lastTargetPosition.reset();
|
||||||
|
|
||||||
if (cOwner)
|
if (cOwner)
|
||||||
{
|
{
|
||||||
if (isStoppedBecauseOfCasting)
|
if (!isStoppedBecauseOfCasting)
|
||||||
{
|
|
||||||
// Don't reset leash timer if it's a spell like Shoot with a short cast time.
|
|
||||||
/// @todo: Research how it should actually work.
|
|
||||||
Spell *spell = cOwner->GetFirstCurrentCastingSpell();
|
|
||||||
bool spellHasLongCast = spell && spell->GetCastTime() > 1 * SECOND * IN_MILLISECONDS;
|
|
||||||
if (spellHasLongCast)
|
|
||||||
cOwner->UpdateLeashExtensionTime();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
cOwner->UpdateLeashExtensionTime();
|
cOwner->UpdateLeashExtensionTime();
|
||||||
|
|
||||||
cOwner->SetCannotReachTarget();
|
cOwner->SetCannotReachTarget();
|
||||||
|
|||||||
Reference in New Issue
Block a user