refactor(Scripts/Mechanar): Modernize Serpethrea script (#15493)
* refactor(Scripts/Mechanar): Modernize Serpethrea script * validators
This commit is contained in:
@@ -36,7 +36,13 @@ enum Spells
|
|||||||
|
|
||||||
struct boss_gatewatcher_gyrokill : public BossAI
|
struct boss_gatewatcher_gyrokill : public BossAI
|
||||||
{
|
{
|
||||||
boss_gatewatcher_gyrokill(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL) { }
|
boss_gatewatcher_gyrokill(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL)
|
||||||
|
{
|
||||||
|
scheduler.SetValidator([this]
|
||||||
|
{
|
||||||
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/) override
|
void JustDied(Unit* /*killer*/) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,13 @@ enum Spells
|
|||||||
|
|
||||||
struct boss_gatewatcher_iron_hand : public BossAI
|
struct boss_gatewatcher_iron_hand : public BossAI
|
||||||
{
|
{
|
||||||
boss_gatewatcher_iron_hand(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND) { }
|
boss_gatewatcher_iron_hand(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND)
|
||||||
|
{
|
||||||
|
scheduler.SetValidator([this]
|
||||||
|
{
|
||||||
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,99 +36,65 @@ enum Spells
|
|||||||
SPELL_DRAGONS_BREATH = 35250,
|
SPELL_DRAGONS_BREATH = 35250,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Events
|
struct boss_nethermancer_sepethrea : public BossAI
|
||||||
{
|
{
|
||||||
EVENT_FROST_ATTACK = 1,
|
boss_nethermancer_sepethrea(Creature* creature) : BossAI(creature, DATA_NETHERMANCER_SEPRETHREA)
|
||||||
EVENT_ARCANE_BLAST = 2,
|
|
||||||
EVENT_DRAGONS_BREATH = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
class boss_nethermancer_sepethrea : public CreatureScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
boss_nethermancer_sepethrea(): CreatureScript("boss_nethermancer_sepethrea") { }
|
|
||||||
|
|
||||||
struct boss_nethermancer_sepethreaAI : public BossAI
|
|
||||||
{
|
{
|
||||||
boss_nethermancer_sepethreaAI(Creature* creature) : BossAI(creature, DATA_NETHERMANCER_SEPRETHREA) { }
|
scheduler.SetValidator([this]
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
|
||||||
{
|
{
|
||||||
_JustEngagedWith();
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
events.ScheduleEvent(EVENT_FROST_ATTACK, 6000);
|
});
|
||||||
events.ScheduleEvent(EVENT_ARCANE_BLAST, 14000);
|
}
|
||||||
events.ScheduleEvent(EVENT_DRAGONS_BREATH, 18000);
|
|
||||||
|
|
||||||
Talk(SAY_AGGRO);
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
me->CastSpell(me, SPELL_SUMMON_RAGIN_FLAMES, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustSummoned(Creature* summon) override
|
|
||||||
{
|
|
||||||
summons.Summon(summon);
|
|
||||||
if (Unit* victim = me->GetVictim())
|
|
||||||
{
|
|
||||||
summon->AI()->AttackStart(victim);
|
|
||||||
summon->AddThreat(victim, 1000.0f);
|
|
||||||
summon->SetInCombatWithZone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KilledUnit(Unit* victim) override
|
|
||||||
{
|
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
Talk(SAY_SLAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/) override
|
|
||||||
{
|
|
||||||
events.Reset();
|
|
||||||
if (instance)
|
|
||||||
{
|
|
||||||
instance->SetBossState(DATA_NETHERMANCER_SEPRETHREA, DONE);
|
|
||||||
instance->SaveToDB();
|
|
||||||
}
|
|
||||||
Talk(SAY_DEATH);
|
|
||||||
|
|
||||||
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
|
|
||||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
|
|
||||||
Unit::Kill(summon, summon);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
|
||||||
{
|
|
||||||
if (!UpdateVictim())
|
|
||||||
return;
|
|
||||||
|
|
||||||
events.Update(diff);
|
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
case EVENT_FROST_ATTACK:
|
|
||||||
me->CastSpell(me->GetVictim(), SPELL_FROST_ATTACK, false);
|
|
||||||
events.ScheduleEvent(EVENT_FROST_ATTACK, 8000);
|
|
||||||
break;
|
|
||||||
case EVENT_ARCANE_BLAST:
|
|
||||||
me->CastSpell(me->GetVictim(), SPELL_ARCANE_BLAST, false);
|
|
||||||
events.ScheduleEvent(EVENT_ARCANE_BLAST, 12000);
|
|
||||||
break;
|
|
||||||
case EVENT_DRAGONS_BREATH:
|
|
||||||
me->CastSpell(me->GetVictim(), SPELL_DRAGONS_BREATH, true);
|
|
||||||
events.ScheduleEvent(EVENT_DRAGONS_BREATH, 16000);
|
|
||||||
if (roll_chance_i(50))
|
|
||||||
Talk(SAY_DRAGONS_BREATH);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
{
|
||||||
return GetMechanarAI<boss_nethermancer_sepethreaAI>(creature);
|
_JustEngagedWith();
|
||||||
|
|
||||||
|
scheduler.Schedule(6s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_FROST_ATTACK);
|
||||||
|
context.Repeat(8s);
|
||||||
|
}).Schedule(14s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_ARCANE_BLAST);
|
||||||
|
context.Repeat(12s);
|
||||||
|
}).Schedule(18s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_DRAGONS_BREATH);
|
||||||
|
context.Repeat(16s);
|
||||||
|
if (roll_chance_i(50))
|
||||||
|
{
|
||||||
|
Talk(SAY_DRAGONS_BREATH);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Talk(SAY_AGGRO);
|
||||||
|
DoCastSelf(SPELL_SUMMON_RAGIN_FLAMES, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void JustSummoned(Creature* summon) override
|
||||||
|
{
|
||||||
|
summons.Summon(summon);
|
||||||
|
if (Unit* victim = me->GetVictim())
|
||||||
|
{
|
||||||
|
summon->AI()->AttackStart(victim);
|
||||||
|
summon->AddThreat(victim, 1000.0f);
|
||||||
|
summon->SetInCombatWithZone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KilledUnit(Unit* victim) override
|
||||||
|
{
|
||||||
|
if (victim->IsPlayer())
|
||||||
|
{
|
||||||
|
Talk(SAY_SLAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JustDied(Unit* /*killer*/) override
|
||||||
|
{
|
||||||
|
_JustDied();
|
||||||
|
Talk(SAY_DEATH);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -142,89 +108,68 @@ enum raginFlames
|
|||||||
EVENT_SPELL_INFERNO = 2
|
EVENT_SPELL_INFERNO = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_ragin_flames : public CreatureScript
|
struct npc_ragin_flames : public ScriptedAI
|
||||||
{
|
{
|
||||||
public:
|
npc_ragin_flames(Creature* creature) : ScriptedAI(creature) { }
|
||||||
npc_ragin_flames() : CreatureScript("npc_ragin_flames") { }
|
|
||||||
|
|
||||||
struct npc_ragin_flamesAI : public ScriptedAI
|
EventMap events;
|
||||||
|
|
||||||
|
void Reset() override
|
||||||
{
|
{
|
||||||
npc_ragin_flamesAI(Creature* creature) : ScriptedAI(creature) { }
|
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, true);
|
||||||
|
}
|
||||||
|
|
||||||
EventMap events;
|
void JustEngagedWith(Unit*) override
|
||||||
|
{
|
||||||
|
events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500);
|
||||||
|
events.ScheduleEvent(EVENT_SPELL_INFERNO, urand(10000, 20000));
|
||||||
|
}
|
||||||
|
|
||||||
void Reset() override
|
void UpdateAI(uint32 diff) override
|
||||||
|
{
|
||||||
|
if (!UpdateVictim())
|
||||||
|
return;
|
||||||
|
|
||||||
|
events.Update(diff);
|
||||||
|
switch (events.ExecuteEvent())
|
||||||
{
|
{
|
||||||
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, true);
|
case EVENT_SPELL_INFERNO:
|
||||||
}
|
if (me->IsWithinCombatRange(me->GetVictim(), 5.0f))
|
||||||
|
|
||||||
void JustEngagedWith(Unit*) override
|
|
||||||
{
|
|
||||||
events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500);
|
|
||||||
events.ScheduleEvent(EVENT_SPELL_INFERNO, urand(10000, 20000));
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
|
||||||
{
|
|
||||||
if (!UpdateVictim())
|
|
||||||
return;
|
|
||||||
|
|
||||||
events.Update(diff);
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
{
|
||||||
case EVENT_SPELL_INFERNO:
|
me->CastSpell(me, SPELL_INFERNO, true);
|
||||||
if (me->IsWithinCombatRange(me->GetVictim(), 5.0f))
|
events.ScheduleEvent(EVENT_SPELL_INFERNO, 20000);
|
||||||
{
|
|
||||||
me->CastSpell(me, SPELL_INFERNO, true);
|
|
||||||
events.ScheduleEvent(EVENT_SPELL_INFERNO, 20000);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
events.ScheduleEvent(EVENT_SPELL_INFERNO, 1000);
|
|
||||||
break;
|
|
||||||
case EVENT_SPELL_FIRE_TAIL:
|
|
||||||
me->CastSpell(me, SPELL_FIRE_TAIL, true);
|
|
||||||
events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
DoMeleeAttackIfReady();
|
events.ScheduleEvent(EVENT_SPELL_INFERNO, 1000);
|
||||||
|
break;
|
||||||
|
case EVENT_SPELL_FIRE_TAIL:
|
||||||
|
me->CastSpell(me, SPELL_FIRE_TAIL, true);
|
||||||
|
events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
DoMeleeAttackIfReady();
|
||||||
{
|
|
||||||
return GetMechanarAI<npc_ragin_flamesAI>(creature);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_ragin_flames_inferno : public SpellScriptLoader
|
class spell_ragin_flames_inferno : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_ragin_flames_inferno);
|
||||||
spell_ragin_flames_inferno() : SpellScriptLoader("spell_ragin_flames_inferno") { }
|
|
||||||
|
|
||||||
class spell_ragin_flames_inferno_AuraScript : public AuraScript
|
void HandlePeriodic(AuraEffect const* aurEff)
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_ragin_flames_inferno_AuraScript);
|
GetUnitOwner()->CastCustomSpell(SPELL_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
void HandlePeriodic(AuraEffect const* aurEff)
|
void Register() override
|
||||||
{
|
|
||||||
GetUnitOwner()->CastCustomSpell(SPELL_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ragin_flames_inferno_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AuraScript* GetAuraScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_ragin_flames_inferno_AuraScript();
|
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ragin_flames_inferno::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_nethermancer_sepethrea()
|
void AddSC_boss_nethermancer_sepethrea()
|
||||||
{
|
{
|
||||||
new boss_nethermancer_sepethrea();
|
RegisterMechanarCreatureAI(boss_nethermancer_sepethrea);
|
||||||
new npc_ragin_flames();
|
RegisterMechanarCreatureAI(npc_ragin_flames);
|
||||||
new spell_ragin_flames_inferno();
|
RegisterSpellScript(spell_ragin_flames_inferno);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user