mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
fix(Core/Unit): Avoid resetting leash timer when not necessary. (#27390)
This commit is contained in:
@@ -1264,7 +1264,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
|
|||||||
|
|
||||||
if (!victim->IsPlayer())
|
if (!victim->IsPlayer())
|
||||||
{
|
{
|
||||||
/// @fix: Hack to avoid premature leashing
|
// DoT ticks and passive damage (e.g. Thorns) do not reset leash timer
|
||||||
if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
|
if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
|
||||||
victim->ToCreature()->UpdateLeashExtensionTime();
|
victim->ToCreature()->UpdateLeashExtensionTime();
|
||||||
|
|
||||||
@@ -11199,6 +11199,12 @@ void Unit::AtTargetAttacked(Unit* target, bool canInitialAggro)
|
|||||||
if (!target->IsEngaged() && !canInitialAggro)
|
if (!target->IsEngaged() && !canInitialAggro)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (Creature* cTarget = target->ToCreature())
|
||||||
|
{
|
||||||
|
if (!cTarget->GetOwnerGUID().IsPlayer())
|
||||||
|
cTarget->UpdateLeashExtensionTime();
|
||||||
|
}
|
||||||
|
|
||||||
target->EngageWithTarget(this);
|
target->EngageWithTarget(this);
|
||||||
if (Unit* targetOwner = target->GetCharmerOrOwner())
|
if (Unit* targetOwner = target->GetCharmerOrOwner())
|
||||||
targetOwner->EngageWithTarget(this);
|
targetOwner->EngageWithTarget(this);
|
||||||
|
|||||||
@@ -234,12 +234,8 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
_lastTargetPosition.reset();
|
_lastTargetPosition.reset();
|
||||||
|
|
||||||
if (cOwner)
|
if (cOwner)
|
||||||
{
|
|
||||||
if (!isStoppedBecauseOfCasting)
|
|
||||||
cOwner->UpdateLeashExtensionTime();
|
|
||||||
|
|
||||||
cOwner->SetCannotReachTarget();
|
cOwner->SetCannotReachTarget();
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,16 +313,7 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
|
|
||||||
if (cOwner)
|
if (cOwner)
|
||||||
{
|
{
|
||||||
if (owner->movespline->Finalized() && cOwner->IsWithinMeleeRange(target))
|
if (i_recalculateTravel)
|
||||||
{ // Mobs should chase you infinitely if you stop and wait every few seconds.
|
|
||||||
i_leashExtensionTimer.Update(time_diff);
|
|
||||||
if (i_leashExtensionTimer.Passed())
|
|
||||||
{
|
|
||||||
i_leashExtensionTimer.Reset(cOwner->GetAttackTime(BASE_ATTACK));
|
|
||||||
cOwner->UpdateLeashExtensionTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (i_recalculateTravel)
|
|
||||||
i_leashExtensionTimer.Reset(cOwner->GetAttackTime(BASE_ATTACK));
|
i_leashExtensionTimer.Reset(cOwner->GetAttackTime(BASE_ATTACK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user