mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
refactor(Scripts/Mechanar): Modernize Pathaleon's script (#15494)
This commit is contained in:
@@ -43,116 +43,77 @@ enum Spells
|
||||
SPELL_SUMMON_NETHER_WRAITH_4 = 35288,
|
||||
};
|
||||
|
||||
enum Events
|
||||
struct boss_pathaleon_the_calculator : public BossAI
|
||||
{
|
||||
EVENT_SUMMON = 1,
|
||||
EVENT_MANA_TAP = 2,
|
||||
EVENT_ARCANE_TORRENT = 3,
|
||||
EVENT_DOMINATION = 4,
|
||||
EVENT_ARCANE_EXPLOSION = 5,
|
||||
EVENT_FRENZY = 6,
|
||||
};
|
||||
|
||||
class boss_pathaleon_the_calculator : public CreatureScript
|
||||
{
|
||||
public:
|
||||
boss_pathaleon_the_calculator(): CreatureScript("boss_pathaleon_the_calculator") { }
|
||||
|
||||
struct boss_pathaleon_the_calculatorAI : public BossAI
|
||||
boss_pathaleon_the_calculator(Creature* creature) : BossAI(creature, DATA_PATHALEON_THE_CALCULATOR)
|
||||
{
|
||||
boss_pathaleon_the_calculatorAI(Creature* creature) : BossAI(creature, DATA_PATHALEON_THE_CALCULATOR) { }
|
||||
|
||||
void InitializeAI() override
|
||||
scheduler.SetValidator([this]
|
||||
{
|
||||
BossAI::InitializeAI();
|
||||
}
|
||||
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||
});
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
{
|
||||
_JustEngagedWith();
|
||||
|
||||
ScheduleHealthCheckEvent(20, [&]()
|
||||
{
|
||||
_JustEngagedWith();
|
||||
events.ScheduleEvent(EVENT_SUMMON, 30000);
|
||||
events.ScheduleEvent(EVENT_MANA_TAP, 12000);
|
||||
events.ScheduleEvent(EVENT_ARCANE_TORRENT, 16000);
|
||||
events.ScheduleEvent(EVENT_DOMINATION, 25000);
|
||||
events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, 8000);
|
||||
events.ScheduleEvent(EVENT_FRENZY, 1000);
|
||||
Talk(SAY_AGGRO);
|
||||
}
|
||||
summons.DespawnAll();
|
||||
DoCastSelf(SPELL_DISGRUNTLED_ANGER, true);
|
||||
Talk(SAY_ENRAGE);
|
||||
});
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
scheduler.Schedule(30s, [this](TaskContext context)
|
||||
{
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
for (uint8 i = 0; i < DUNGEON_MODE(3, 4); ++i)
|
||||
me->CastSpell(me, SPELL_SUMMON_NETHER_WRAITH_1 + i, true);
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
Talk(SAY_SUMMON);
|
||||
context.Repeat(30s, 40s);
|
||||
}).Schedule(12s, [this](TaskContext context)
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, PowerUsersSelector(me, POWER_MANA, 40.0f, false)))
|
||||
{
|
||||
case EVENT_ARCANE_EXPLOSION:
|
||||
me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false);
|
||||
events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, 12000);
|
||||
break;
|
||||
case EVENT_ARCANE_TORRENT:
|
||||
me->RemoveAurasDueToSpell(SPELL_MANA_TAP);
|
||||
me->ModifyPower(POWER_MANA, 5000);
|
||||
me->CastSpell(me, SPELL_ARCANE_TORRENT, false);
|
||||
events.ScheduleEvent(EVENT_ARCANE_TORRENT, 15000);
|
||||
break;
|
||||
case EVENT_MANA_TAP:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, PowerUsersSelector(me, POWER_MANA, 40.0f, false)))
|
||||
me->CastSpell(target, SPELL_MANA_TAP, false);
|
||||
events.ScheduleEvent(EVENT_MANA_TAP, 18000);
|
||||
break;
|
||||
case EVENT_DOMINATION:
|
||||
Talk(SAY_DOMINATION);
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 50.0f))
|
||||
me->CastSpell(target, SPELL_DOMINATION, false);
|
||||
events.ScheduleEvent(EVENT_DOMINATION, 30000);
|
||||
break;
|
||||
case EVENT_FRENZY:
|
||||
if (me->HealthBelowPct(20))
|
||||
{
|
||||
summons.DespawnAll();
|
||||
me->CastSpell(me, SPELL_DISGRUNTLED_ANGER, true);
|
||||
Talk(SAY_ENRAGE);
|
||||
break;
|
||||
}
|
||||
events.ScheduleEvent(EVENT_FRENZY, 1000);
|
||||
break;
|
||||
case EVENT_SUMMON:
|
||||
for (uint8 i = 0; i < DUNGEON_MODE(3, 4); ++i)
|
||||
me->CastSpell(me, SPELL_SUMMON_NETHER_WRAITH_1 + i, true);
|
||||
|
||||
Talk(SAY_SUMMON);
|
||||
events.ScheduleEvent(EVENT_SUMMON, urand(30000, 45000));
|
||||
break;
|
||||
DoCast(target, SPELL_MANA_TAP);
|
||||
}
|
||||
context.Repeat(18s);
|
||||
}).Schedule(16s, [this](TaskContext context)
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_MANA_TAP);
|
||||
me->ModifyPower(POWER_MANA, 5000);
|
||||
DoCastSelf(SPELL_ARCANE_TORRENT);
|
||||
context.Repeat(15s);
|
||||
}).Schedule(25s, [this](TaskContext context)
|
||||
{
|
||||
Talk(SAY_DOMINATION);
|
||||
DoCastRandomTarget(SPELL_DOMINATION, 1, 50.0f);
|
||||
context.Repeat(30s);
|
||||
}).Schedule(8s, [this](TaskContext context)
|
||||
{
|
||||
DoCastAOE(SPELL_ARCANE_EXPLOSION);
|
||||
context.Repeat(12s);
|
||||
});
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
Talk(SAY_AGGRO);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
return GetMechanarAI<boss_pathaleon_the_calculatorAI>(creature);
|
||||
if (victim->IsPlayer())
|
||||
{
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_pathaleon_the_calculator()
|
||||
{
|
||||
new boss_pathaleon_the_calculator();
|
||||
RegisterMechanarCreatureAI(boss_pathaleon_the_calculator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user