fix(Scripts/ShadowfangKeep): Fix Apothecary Trio events not reseting … (#14898)

This commit is contained in:
Skjalf
2023-02-08 05:44:12 -03:00
committed by GitHub
parent 6e8e70aa1a
commit f3f2364bef

View File

@@ -87,7 +87,7 @@ public:
{ {
boss_apothecary_hummelAI(Creature* creature) : BossAI(creature, DATA_APOTHECARY_HUMMEL), _deadCount(0), _isDead(false) boss_apothecary_hummelAI(Creature* creature) : BossAI(creature, DATA_APOTHECARY_HUMMEL), _deadCount(0), _isDead(false)
{ {
_scheduler.SetValidator([this] scheduler.SetValidator([this]
{ {
return !me->HasUnitState(UNIT_STATE_CASTING); return !me->HasUnitState(UNIT_STATE_CASTING);
}); });
@@ -109,23 +109,17 @@ public:
_deadCount = 0; _deadCount = 0;
_isDead = false; _isDead = false;
_phase = PHASE_ALL; _phase = PHASE_ALL;
summons.DespawnAll();
me->SetFaction(FACTION_FRIENDLY); me->SetFaction(FACTION_FRIENDLY);
me->SummonCreatureGroup(1); me->SummonCreatureGroup(1);
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP); me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
} }
void JustSummoned(Creature* summon) override
{
summons.Summon(summon);
}
void DoAction(int32 action) override void DoAction(int32 action) override
{ {
if (action == ACTION_START_EVENT && _phase == PHASE_ALL) if (action == ACTION_START_EVENT && _phase == PHASE_ALL)
{ {
_phase = PHASE_INTRO; _phase = PHASE_INTRO;
_scheduler.Schedule(1ms, [this](TaskContext /*context*/) scheduler.Schedule(1ms, [this](TaskContext /*context*/)
{ {
Talk(SAY_INTRO_0); Talk(SAY_INTRO_0);
}) })
@@ -230,9 +224,8 @@ public:
Talk(SAY_HUMMEL_DEATH); Talk(SAY_HUMMEL_DEATH);
} }
_scheduler.CancelAll(); _JustDied();
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
instance->SetBossState(DATA_APOTHECARY_HUMMEL, DONE);
Map::PlayerList const& players = me->GetMap()->GetPlayers(); Map::PlayerList const& players = me->GetMap()->GetPlayers();
if (!players.IsEmpty()) if (!players.IsEmpty())
@@ -254,7 +247,7 @@ public:
return; return;
} }
_scheduler.Update(diff, [this] scheduler.Update(diff, [this]
{ {
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
}); });
@@ -263,7 +256,6 @@ public:
private: private:
uint8 _deadCount; uint8 _deadCount;
bool _isDead; bool _isDead;
TaskScheduler _scheduler;
uint8 _phase; uint8 _phase;
}; };