fix(Core/Scripts): Rework Pandemonius (#16407)

This commit is contained in:
Angelo Venturini
2023-05-31 23:22:00 -03:00
committed by GitHub
parent 61e63b2401
commit dc624fd86f
2 changed files with 45 additions and 80 deletions
@@ -0,0 +1,2 @@
--
UPDATE `creature_template` SET `mechanic_immune_mask` = `mechanic_immune_mask`|33554432 WHERE `entry` IN (18341, 20267);
@@ -34,42 +34,54 @@ enum Spells
SPELL_DARK_SHELL = 32358 SPELL_DARK_SHELL = 32358
}; };
enum Events enum Groups
{ {
EVENT_VOID_BLAST = 1, GROUP_VOID_BLAST = 1
EVENT_DARK_SHELL
}; };
class boss_pandemonius : public CreatureScript constexpr uint8 MAX_VOID_BLAST = 5;
{
public:
boss_pandemonius() : CreatureScript("boss_pandemonius") { }
CreatureAI* GetAI(Creature* creature) const override struct boss_pandemonius : public BossAI
{ {
return GetManaTombsAI<boss_pandemoniusAI>(creature); boss_pandemonius(Creature* creature) : BossAI(creature, DATA_PANDEMONIUS)
{
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
} }
struct boss_pandemoniusAI : public ScriptedAI void JustEngagedWith(Unit* who) override
{ {
boss_pandemoniusAI(Creature* creature) : ScriptedAI(creature) { }
EventMap events;
void Reset() override
{
events.Reset();
VoidBlastCounter = 0;
}
void JustEngagedWith(Unit*) override
{
me->SetInCombatWithZone();
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_DARK_SHELL, 20000); scheduler.
events.ScheduleEvent(EVENT_VOID_BLAST, urand(8000, 23000)); Schedule(20s, GROUP_VOID_BLAST, [this](TaskContext context)
{
if (me->IsNonMeleeSpellCast(false))
{
me->InterruptNonMeleeSpells(true);
}
Talk(EMOTE_DARK_SHELL);
DoCastSelf(SPELL_DARK_SHELL);
context.Repeat();
})
.Schedule(8s, 23s, [this](TaskContext context)
{
if (!(context.GetRepeatCounter() % (MAX_VOID_BLAST + 1)))
{
context.Repeat(15s, 25s);
}
else
{
DoCastRandomTarget(SPELL_VOID_BLAST);
context.Repeat(500ms);
context.DelayGroup(GROUP_VOID_BLAST, 500ms);
}
});
BossAI::JustEngagedWith(who);
} }
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
@@ -78,63 +90,14 @@ public:
Talk(SAY_KILL); Talk(SAY_KILL);
} }
void JustDied(Unit* /*killer*/) override void JustDied(Unit* killer) override
{ {
Talk(SAY_DEATH); Talk(SAY_DEATH);
BossAI::JustDied(killer);
} }
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_VOID_BLAST:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
{
DoCast(target, SPELL_VOID_BLAST);
++VoidBlastCounter;
}
if (VoidBlastCounter == 5)
{
VoidBlastCounter = 0;
events.RescheduleEvent(EVENT_VOID_BLAST, urand(15000, 25000));
}
else
{
events.RescheduleEvent(EVENT_VOID_BLAST, 500);
events.DelayEvents(EVENT_DARK_SHELL, 500);
}
break;
case EVENT_DARK_SHELL:
if (me->IsNonMeleeSpellCast(false))
{
me->InterruptNonMeleeSpells(true);
}
Talk(EMOTE_DARK_SHELL);
DoCast(me, SPELL_DARK_SHELL);
events.RescheduleEvent(EVENT_DARK_SHELL, 20000);
break;
default:
break;
}
DoMeleeAttackIfReady();
}
private:
uint32 VoidBlastCounter;
};
}; };
void AddSC_boss_pandemonius() void AddSC_boss_pandemonius()
{ {
new boss_pandemonius(); RegisterManaTombsCreatureAI(boss_pandemonius);
} }