refactor(Core): Clean-up after FD (#8586)

This commit is contained in:
patou01
2021-11-28 07:04:14 +01:00
committed by GitHub
parent 1a27f606f1
commit 801a20fce2
10 changed files with 20 additions and 25 deletions

View File

@@ -57,9 +57,6 @@ bool PetAI::_needToStop()
if (owner->GetExactDist(me) >= (owner->GetVisibilityRange() - 10.0f))
return true;
if (!me->_CanDetectFeignDeathOf(me->GetVictim()))
return true;
return !me->CanCreatureAttack(me->GetVictim());
}
@@ -472,7 +469,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
// Check pet attackers first so we don't drag a bunch of targets to the owner
if (Unit* myAttacker = me->getAttackerForHelper())
if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(myAttacker) && me->CanCreatureAttack(myAttacker))
if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->CanCreatureAttack(myAttacker))
return myAttacker;
// Check pet's attackers first to prevent dragging mobs back to owner
@@ -482,7 +479,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
if (!tauntAuras.empty())
for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr)
if (Unit* caster = (*itr)->GetCaster())
if (me->_CanDetectFeignDeathOf(caster) && me->CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, me->GetGUID()))
if (me->CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, me->GetGUID()))
return caster;
}
@@ -493,13 +490,13 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
// Check owner attackers
if (Unit* ownerAttacker = owner->getAttackerForHelper())
if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(ownerAttacker) && me->CanCreatureAttack(ownerAttacker))
if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->CanCreatureAttack(ownerAttacker))
return ownerAttacker;
// Check owner victim
// 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does
if (Unit* ownerVictim = owner->GetVictim())
if (me->_CanDetectFeignDeathOf(ownerVictim) && me->CanCreatureAttack(ownerVictim))
if (me->CanCreatureAttack(ownerVictim))
return ownerVictim;
// Neither pet or owner had a target and aggressive pets can pick any target