chore(Scripts/ShadowLabyrinth): Modernize Ambassador Hellmaw (#15944)

* chore(Scripts/ShadowLabyrinth): Modernize Ambassador Hellmaw

* Update boss_ambassador_hellmaw.cpp
This commit is contained in:
Skjalf
2023-04-14 18:09:21 -03:00
committed by GitHub
parent 539801377f
commit c1cafe040b
2 changed files with 156 additions and 177 deletions
@@ -42,32 +42,17 @@ enum eEnums
SOUND_INTRO = 9349
};
class boss_ambassador_hellmaw : public CreatureScript
struct boss_ambassador_hellmaw : public BossAI
{
public:
boss_ambassador_hellmaw() : CreatureScript("boss_ambassador_hellmaw") { }
boss_ambassador_hellmaw(Creature* creature) : BossAI(creature, TYPE_HELLMAW) { }
CreatureAI* GetAI(Creature* creature) const override
{
return GetShadowLabyrinthAI<boss_ambassador_hellmawAI>(creature);
}
struct boss_ambassador_hellmawAI : public ScriptedAI
{
boss_ambassador_hellmawAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
}
InstanceScript* instance;
EventMap events;
bool isBanished;
void InitializeAI() override
{
Reset();
if (instance && instance->GetData(TYPE_RITUALISTS) != DONE)
if (instance->GetData(TYPE_RITUALISTS) != DONE)
{
isBanished = true;
me->SetImmuneToAll(true);
@@ -85,13 +70,9 @@ public:
void Reset() override
{
events.Reset();
_Reset();
isBanished = false;
me->SetImmuneToAll(false);
if (instance)
{
instance->SetData(TYPE_HELLMAW, NOT_STARTED);
}
}
void DoAction(int32 param) override
@@ -118,16 +99,26 @@ public:
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_SPELL_CORROSIVE, urand(5000, 10000));
events.ScheduleEvent(EVENT_SPELL_FEAR, urand(15000, 20000));
scheduler.Schedule(5s, 10s, [this](TaskContext context)
{
DoCastVictim(SPELL_CORROSIVE_ACID);
context.Repeat(15s, 25s);
}).Schedule(15s, 20s, [this](TaskContext context)
{
DoCastAOE(SPELL_FEAR);
context.Repeat(20s, 35s);
});
if (IsHeroic())
{
events.ScheduleEvent(EVENT_SPELL_ENRAGE, 180000);
scheduler.Schedule(5min, [this](TaskContext)
{
DoCastSelf(SPELL_ENRAGE, true);
});
}
if (instance)
{
instance->SetData(TYPE_HELLMAW, IN_PROGRESS);
}
_JustEngagedWith();
}
void MoveInLineOfSight(Unit* who) override
@@ -163,15 +154,16 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
{
Talk(SAY_SLAY);
}
}
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_HELLMAW, DONE);
_JustDied();
}
bool CanAIAttack(Unit const* /*unit*/) const override
@@ -231,28 +223,13 @@ public:
if (!UpdateVictim())
return;
events.Update(diff);
switch (events.ExecuteEvent())
{
case EVENT_SPELL_CORROSIVE:
me->CastSpell(me->GetVictim(), SPELL_CORROSIVE_ACID, false);
events.RepeatEvent(urand(15000, 25000));
break;
case EVENT_SPELL_FEAR:
me->CastSpell(me, SPELL_FEAR, false);
events.RepeatEvent(urand(20000, 35000));
break;
case EVENT_SPELL_ENRAGE:
me->CastSpell(me->GetVictim(), SPELL_ENRAGE, false);
break;
}
scheduler.Update(diff);
DoMeleeAttackIfReady(me->FindCurrentSpellBySpellId(SPELL_CORROSIVE_ACID) != nullptr);
}
};
};
void AddSC_boss_ambassador_hellmaw()
{
new boss_ambassador_hellmaw();
RegisterShadowLabyrinthCreatureAI(boss_ambassador_hellmaw);
}
@@ -50,4 +50,6 @@ inline AI* GetShadowLabyrinthAI(T* obj)
return GetInstanceAI<AI>(obj, ShadowLabyrinthScriptName);
}
#define RegisterShadowLabyrinthCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetShadowLabyrinthAI)
#endif