Skip to content

Commit

Permalink
fix(Scripts/Karazhan): allow Moroes and adds to reset when an add is …
Browse files Browse the repository at this point in the history
…pulled out of the room (azerothcore#17072)

* initial

* doforallsummons

* error fix
  • Loading branch information
elthehablo authored Aug 27, 2023
1 parent 3eb2463 commit 3ce2627
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,36 @@ struct boss_moroes : public BossAI
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
{
scheduler.Update(diff);

if (!CheckGuestsInRoom())
{
EnterEvadeMode();
summons.DoForAllSummons([](WorldObject* summon)
{
summon->ToCreature()->AI()->EnterEvadeMode();
});
return;
}

if (!UpdateVictim())
return;

Expand Down

0 comments on commit 3ce2627

Please sign in to comment.