Skip to content

Commit

Permalink
fix(Scripts/ZulAman): reset Nalorakk's intro on wipe (azerothcore#21063)
Browse files Browse the repository at this point in the history
Co-authored-by: Rocco Silipo <[email protected]>
  • Loading branch information
sogladev and Rorschach91 authored Jan 1, 2025
1 parent fa9718b commit 0594a8f
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ enum Phases
enum NalorakkGroups
{
GROUP_CHECK_DEAD = 1,
GROUP_MOVE = 2,
GROUP_BERSERK = 3,
GROUP_HUMAN = 4,
GROUP_BEAR = 5
GROUP_CHECK_EVADE = 2,
GROUP_MOVE = 3,
GROUP_BERSERK = 4,
GROUP_HUMAN = 5,
GROUP_BEAR = 6
};

struct boss_nalorakk : public BossAI
Expand Down Expand Up @@ -109,7 +110,7 @@ struct boss_nalorakk : public BossAI

void MoveInLineOfSight(Unit* who) override
{
if (who->IsPlayer() && _phase < PHASE_START_COMBAT && _active)
if (who->IsPlayer() && !who->ToPlayer()->IsGameMaster() && _phase < PHASE_START_COMBAT && _active)
{
_active = false;
switch (_phase)
Expand Down Expand Up @@ -199,6 +200,25 @@ struct boss_nalorakk : public BossAI
me->SetHomePosition(me->GetPosition());
break;
}
_introScheduler.Schedule(10s, GROUP_CHECK_EVADE, [this](TaskContext context)
{
if (CheckAnyEvadeGroup(_waveList))
{
_introScheduler.CancelGroup(GROUP_CHECK_DEAD);
_introScheduler.Schedule(5s, GROUP_CHECK_EVADE, [this](TaskContext context)
{
for (Creature* member : _waveList)
if (member->isMoving())
{
context.Repeat(1s);
return;
}
_active = true;
});
}
else
context.Repeat(10s);
});
}
BossAI::MoveInLineOfSight(who);
}
Expand Down Expand Up @@ -310,7 +330,7 @@ struct boss_nalorakk : public BossAI
BossAI::UpdateAI(diff);
}

bool CheckFullyDeadGroup(std::list<Creature* > groupToCheck)
bool CheckFullyDeadGroup(std::list<Creature*> groupToCheck)
{
for (Creature* member : groupToCheck)
{
Expand All @@ -322,6 +342,14 @@ struct boss_nalorakk : public BossAI
return true;
}

bool CheckAnyEvadeGroup(std::list<Creature*> groupToCheck)
{
for (Creature* member : groupToCheck)
if (member->IsAlive() && !member->IsInCombat())
return true;
return false;
}

void JustDied(Unit* killer) override
{
BossAI::JustDied(killer);
Expand Down

0 comments on commit 0594a8f

Please sign in to comment.