fix(Scripts/Pet): Fixes behavior of Army of the Dead Ghouls to attack… (#22665)

This commit is contained in:
EricksOliveira
2025-08-12 13:10:20 -03:00
committed by GitHub
parent 9efdd9798f
commit 743b6e7cd9

View File

@@ -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