diff options
author | EricksOliveira <ericksoliveira258@gmail.com> | 2025-08-12 13:10:20 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-12 13:10:20 -0300 |
commit | 743b6e7cd971808bf57efd94ba61f9db98b15e34 (patch) | |
tree | bb1e04a596716c044e5984c32a90d2422e2e8d1a /src | |
parent | 9efdd9798f9789590f7533afac0e4ac857d01d42 (diff) |
fix(Scripts/Pet): Fixes behavior of Army of the Dead Ghouls to attack… (#22665)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Pet/pet_dk.cpp | 22 |
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 |