mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
fix(Core/AI): Improve creature leashing behavior. (#19751)
* Init. https: //github.com/vmangos/core/commit/7d2f1e2923734ea1b983eeaa0208cfd158d4af02 Co-Authored-By: ratkosrb <35845488+ratkosrb@users.noreply.github.com> * Hackfix for pets. * Whoops. * Correct evade uses. * Conflict. * Actually fix grace timer. * Add visibility distance check. Creatures should always fail combat checks in the open world if they're outside of visibility distance, might not be the case for worldbosses. --------- Co-authored-by: ratkosrb <35845488+ratkosrb@users.noreply.github.com>
This commit is contained in:
@@ -1041,10 +1041,6 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
|
||||
|
||||
if (!victim->IsPlayer())
|
||||
{
|
||||
// Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this
|
||||
if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
|
||||
victim->ToCreature()->SetLastDamagedTime(GameTime::GetGameTime().count() + MAX_AGGRO_RESET_TIME);
|
||||
|
||||
if (attacker)
|
||||
{
|
||||
if (spellProto && victim->CanHaveThreatList() && !victim->HasUnitState(UNIT_STATE_EVADE) && !victim->IsInCombatWith(attacker))
|
||||
@@ -10387,6 +10383,8 @@ void Unit::CombatStop(bool includingCast)
|
||||
RemoveAllAttackers();
|
||||
if (IsPlayer())
|
||||
ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
|
||||
if (Creature* pCreature = ToCreature())
|
||||
pCreature->ClearLastLeashExtensionTimePtr();
|
||||
ClearInCombat();
|
||||
|
||||
// xinef: just in case
|
||||
@@ -13539,6 +13537,9 @@ void Unit::SetInCombatWith(Unit* enemy, uint32 duration)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Creature* pCreature = ToCreature())
|
||||
pCreature->UpdateLeashExtensionTime();
|
||||
|
||||
SetInCombatState(false, enemy, duration);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user