Skip to content

Commit 7ebf804

Browse files
committed
Scripts/VioletHold: fix Erekem adds AI
1 parent eccb885 commit 7ebf804

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

‎src/server/scripts/Northrend/VioletHold/boss_erekem.cpp‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ enum ErekemSpells
4444
SPELL_WINDFURY = 54493
4545
};
4646

47+
enum ErekemActions
48+
{
49+
ACTION_EREKEM_GUARD_DIED = 1
50+
};
51+
4752
// 29315 - Erekem
4853
// 32226 - Arakkoa Windwalker
4954
struct boss_erekem : public BossAI
@@ -56,6 +61,7 @@ struct boss_erekem : public BossAI
5661
void Initialize()
5762
{
5863
_phase = 0;
64+
_addsKilled = 0;
5965
}
6066

6167
void Reset() override
@@ -84,6 +90,24 @@ struct boss_erekem : public BossAI
8490
instance->SetData(DATA_HANDLE_CELLS, DATA_EREKEM);
8591
}
8692

93+
void DoAction(int32 actionId) override
94+
{
95+
switch (actionId)
96+
{
97+
case ACTION_EREKEM_GUARD_DIED:
98+
if (!me->IsAlive())
99+
break;
100+
101+
if (_addsKilled++ == 0)
102+
Talk(SAY_ADD_KILLED);
103+
else
104+
Talk(SAY_BOTH_ADDS_KILLED);
105+
break;
106+
default:
107+
break;
108+
}
109+
}
110+
87111
void KilledUnit(Unit* victim) override
88112
{
89113
if (victim->GetTypeId() == TYPEID_PLAYER)
@@ -239,6 +263,7 @@ struct boss_erekem : public BossAI
239263

240264
private:
241265
uint8 _phase;
266+
uint8 _addsKilled;
242267
};
243268

244269
enum GuardSpells
@@ -252,7 +277,13 @@ enum GuardSpells
252277
// 32228 - Arakkoa Talon Guard
253278
struct npc_erekem_guard : public ScriptedAI
254279
{
255-
npc_erekem_guard(Creature* creature) : ScriptedAI(creature) { }
280+
npc_erekem_guard(Creature* creature) : ScriptedAI(creature)
281+
{
282+
scheduler.SetValidator([this]
283+
{
284+
return !me->HasUnitState(UNIT_STATE_CASTING);
285+
});
286+
}
256287

257288
void Reset() override
258289
{
@@ -261,9 +292,17 @@ struct npc_erekem_guard : public ScriptedAI
261292

262293
void JustEngagedWith(Unit* /*who*/) override
263294
{
295+
ScheduledTasks();
264296
DoZoneInCombat();
265297
}
266298

299+
void JustDied(Unit* /*killer*/) override
300+
{
301+
if (InstanceScript* instance = me->GetInstanceScript())
302+
if (Creature* erekem = instance->GetCreature(DATA_EREKEM))
303+
erekem->AI()->DoAction(ACTION_EREKEM_GUARD_DIED);
304+
}
305+
267306
void UpdateAI(uint32 diff) override
268307
{
269308
if (!UpdateVictim())

0 commit comments

Comments
 (0)