fix(Scripts/Karazhan): allow Moroes and adds to reset when an add is pulled out of the room (#17072)
* initial * doforallsummons * error fix
This commit is contained in:
@@ -209,10 +209,36 @@ struct boss_moroes : public BossAI
|
|||||||
return Acore::Containers::SelectRandomContainerElement(guestList);
|
return Acore::Containers::SelectRandomContainerElement(guestList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CheckGuestsInRoom()
|
||||||
|
{
|
||||||
|
bool guestsInRoom = true;
|
||||||
|
summons.DoForAllSummons([&guestsInRoom](WorldObject* summon)
|
||||||
|
{
|
||||||
|
if ((summon->ToCreature()->GetPositionX()) < -11028.f || (summon->ToCreature()->GetPositionY()) < -1955.f) //boundaries of the two doors
|
||||||
|
{
|
||||||
|
guestsInRoom = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
return guestsInRoom;
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
scheduler.Update(diff);
|
scheduler.Update(diff);
|
||||||
|
|
||||||
|
if (!CheckGuestsInRoom())
|
||||||
|
{
|
||||||
|
EnterEvadeMode();
|
||||||
|
summons.DoForAllSummons([](WorldObject* summon)
|
||||||
|
{
|
||||||
|
summon->ToCreature()->AI()->EnterEvadeMode();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user