chore(Scripts/ShadowLabyrinth): Modernize Ambassador Hellmaw (#15944)
* chore(Scripts/ShadowLabyrinth): Modernize Ambassador Hellmaw * Update boss_ambassador_hellmaw.cpp
This commit is contained in:
@@ -42,32 +42,17 @@ enum eEnums
|
|||||||
SOUND_INTRO = 9349
|
SOUND_INTRO = 9349
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_ambassador_hellmaw : public CreatureScript
|
struct boss_ambassador_hellmaw : public BossAI
|
||||||
{
|
{
|
||||||
public:
|
boss_ambassador_hellmaw(Creature* creature) : BossAI(creature, TYPE_HELLMAW) { }
|
||||||
boss_ambassador_hellmaw() : CreatureScript("boss_ambassador_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;
|
bool isBanished;
|
||||||
|
|
||||||
void InitializeAI() override
|
void InitializeAI() override
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
if (instance && instance->GetData(TYPE_RITUALISTS) != DONE)
|
if (instance->GetData(TYPE_RITUALISTS) != DONE)
|
||||||
{
|
{
|
||||||
isBanished = true;
|
isBanished = true;
|
||||||
me->SetImmuneToAll(true);
|
me->SetImmuneToAll(true);
|
||||||
@@ -85,13 +70,9 @@ public:
|
|||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
events.Reset();
|
_Reset();
|
||||||
isBanished = false;
|
isBanished = false;
|
||||||
me->SetImmuneToAll(false);
|
me->SetImmuneToAll(false);
|
||||||
if (instance)
|
|
||||||
{
|
|
||||||
instance->SetData(TYPE_HELLMAW, NOT_STARTED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAction(int32 param) override
|
void DoAction(int32 param) override
|
||||||
@@ -118,16 +99,26 @@ public:
|
|||||||
|
|
||||||
Talk(SAY_AGGRO);
|
Talk(SAY_AGGRO);
|
||||||
events.ScheduleEvent(EVENT_SPELL_CORROSIVE, urand(5000, 10000));
|
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())
|
if (IsHeroic())
|
||||||
{
|
{
|
||||||
events.ScheduleEvent(EVENT_SPELL_ENRAGE, 180000);
|
scheduler.Schedule(5min, [this](TaskContext)
|
||||||
|
{
|
||||||
|
DoCastSelf(SPELL_ENRAGE, true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance)
|
_JustEngagedWith();
|
||||||
{
|
|
||||||
instance->SetData(TYPE_HELLMAW, IN_PROGRESS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit* who) override
|
void MoveInLineOfSight(Unit* who) override
|
||||||
@@ -163,15 +154,16 @@ public:
|
|||||||
|
|
||||||
void KilledUnit(Unit* victim) override
|
void KilledUnit(Unit* victim) override
|
||||||
{
|
{
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
|
if (victim->IsPlayer() && urand(0, 1))
|
||||||
|
{
|
||||||
Talk(SAY_SLAY);
|
Talk(SAY_SLAY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/) override
|
void JustDied(Unit* /*killer*/) override
|
||||||
{
|
{
|
||||||
Talk(SAY_DEATH);
|
Talk(SAY_DEATH);
|
||||||
if (instance)
|
_JustDied();
|
||||||
instance->SetData(TYPE_HELLMAW, DONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanAIAttack(Unit const* /*unit*/) const override
|
bool CanAIAttack(Unit const* /*unit*/) const override
|
||||||
@@ -231,28 +223,13 @@ public:
|
|||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
events.Update(diff);
|
scheduler.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady(me->FindCurrentSpellBySpellId(SPELL_CORROSIVE_ACID) != nullptr);
|
DoMeleeAttackIfReady(me->FindCurrentSpellBySpellId(SPELL_CORROSIVE_ACID) != nullptr);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_ambassador_hellmaw()
|
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);
|
return GetInstanceAI<AI>(obj, ShadowLabyrinthScriptName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RegisterShadowLabyrinthCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetShadowLabyrinthAI)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user