Core/Unit: Creatures' minions now engage in combat if their controller is attacked (PR #25219)

Closes #24340
This commit is contained in:
Jinnaix
2020-08-06 20:03:09 +02:00
committed by GitHub
parent 629908172f
commit db9072a183

View File

@@ -687,21 +687,18 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
// Hook for OnDamage Event
sScriptMgr->OnDamage(attacker, victim, damage);
if (victim->GetTypeId() == TYPEID_PLAYER)
// Signal to pets that their owner was attacked - except when DOT.
if (attacker != victim && damagetype != DOT)
{
// Signal to pets that their owner was attacked - except when DOT.
if (attacker != victim && damagetype != DOT)
{
for (Unit* controlled : victim->m_Controlled)
if (Creature* cControlled = controlled->ToCreature())
if (CreatureAI* controlledAI = cControlled->AI())
controlledAI->OwnerAttackedBy(attacker);
}
if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
return 0;
for (Unit* controlled : victim->m_Controlled)
if (Creature* cControlled = controlled->ToCreature())
if (CreatureAI* controlledAI = cControlled->AI())
controlledAI->OwnerAttackedBy(attacker);
}
if (Player* player = victim->ToPlayer(); player && player->GetCommandStatus(CHEAT_GOD))
return 0;
if (damagetype != NODAMAGE)
{
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)