summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Pet/pet_dk.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp
index d1df1ef836..1a8a815408 100644
--- a/src/server/scripts/Pet/pet_dk.cpp
+++ b/src/server/scripts/Pet/pet_dk.cpp
@@ -292,6 +292,28 @@ struct npc_pet_dk_army_of_the_dead : public CombatAI
CombatAI::InitializeAI();
((Minion*)me)->SetFollowAngle(rand_norm() * 2 * M_PI);
}
+
+ void IsSummonedBy(WorldObject* summoner) override
+ {
+ if (Unit* owner = summoner->ToUnit())
+ {
+ Unit* victim = owner->GetVictim();
+
+ if (victim && me->IsValidAttackTarget(victim))
+ {
+ AttackStart(victim);
+ }
+ else
+ {
+ // If there is no valid target, attack the nearest enemy within 30m
+ if (Unit* nearest = me->SelectNearbyTarget(nullptr, 30.0f))
+ {
+ if (me->IsValidAttackTarget(nearest))
+ AttackStart(nearest);
+ }
+ }
+ }
+ }
};
struct npc_pet_dk_dancing_rune_weapon : public NullCreatureAI