aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJinnaix <37972361+Jinnaix@users.noreply.github.com>2020-08-06 20:03:09 +0200
committerGitHub <noreply@github.com>2020-08-06 20:03:09 +0200
commitdb9072a183cd93014d708d67ae3a762fdbf5d095 (patch)
treeec93fca5552e427ab43567c304d9e77dbdececa5 /src
parent629908172fb5ac2f515f9474cdf6aba1b331958b (diff)
Core/Unit: Creatures' minions now engage in combat if their controller is attacked (PR #25219)
Closes #24340
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 9b5f9ed0238..06c88eec2bb 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -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)