diff options
author | offl <11556157+offl@users.noreply.github.com> | 2021-04-14 12:52:21 +0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-03-08 22:08:55 +0100 |
commit | b79912156cb868f232b56dfc2f31f66e6febdbe7 (patch) | |
tree | d40c755a89fa57c7e7858627ac3a060b06519953 /src | |
parent | 10ca1d401f88e2e87496db2d1dfc7a200356f9dc (diff) |
Scripts/Violet Hold: Update Xevozz to new model (#26399)
Co-authored-by: offl <offl@users.noreply.github.com>
(cherry picked from commit 8cf2eea79e7e333a2f48e4ddf3765ac4674cf7a7)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp | 327 |
1 files changed, 147 insertions, 180 deletions
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index faf6e7f7722..3b62283c29d 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -48,15 +48,15 @@ enum NPCs enum CreatureSpells { - SPELL_ARCANE_POWER = 54160, H_SPELL_ARCANE_POWER = 59474, SPELL_MAGIC_PULL = 50770, SPELL_SUMMON_PLAYERS = 54164, SPELL_POWER_BALL_VISUAL = 54141, - SPELL_POWER_BALL_DAMAGE_TRIGGER = 54207, - SPELL_POWER_BALL_DAMAGE_TRIGGER_H = 59476 }; +#define SPELL_ARCANE_POWER DUNGEON_MODE<uint32>(54160,H_SPELL_ARCANE_POWER) +#define SPELL_POWER_BALL_DAMAGE_TRIGGER DUNGEON_MODE<uint32>(54207,59476) + enum Yells { // Xevozz @@ -77,215 +77,182 @@ enum SphereActions ACTION_SUMMON = 1, }; -class boss_xevozz : public CreatureScript +struct boss_xevozz : public BossAI { - public: - boss_xevozz() : CreatureScript("boss_xevozz") { } - - struct boss_xevozzAI : public BossAI + boss_xevozz(Creature* creature) : BossAI(creature, DATA_XEVOZZ) { } + + void Reset() override + { + BossAI::Reset(); + } + + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); + Talk(SAY_AGGRO); + } + + void JustReachedHome() override + { + BossAI::JustReachedHome(); + instance->SetData(DATA_HANDLE_CELLS, DATA_XEVOZZ); + } + + void JustSummoned(Creature* summon) override + { + BossAI::JustSummoned(summon); + summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); + } + + void KilledUnit(Unit* victim) override + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } + + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_DEATH); + _JustDied(); + } + + void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override + { + if (spellInfo->Id == SPELL_ARCANE_POWER || spellInfo->Id == H_SPELL_ARCANE_POWER) + Talk(SAY_SUMMON_ENERGY); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + scheduler.Update(diff, + std::bind(&BossAI::DoMeleeAttackIfReady, this)); + } + + void ScheduleTasks() override + { + scheduler.Schedule(Seconds(8), Seconds(10), [this](TaskContext task) { - boss_xevozzAI(Creature* creature) : BossAI(creature, DATA_XEVOZZ) { } - - void Reset() override - { - BossAI::Reset(); - } + DoCastAOE(SPELL_ARCANE_BARRAGE_VOLLEY); + task.Repeat(Seconds(8), Seconds(10)); + }); - void JustEngagedWith(Unit* who) override - { - BossAI::JustEngagedWith(who); - Talk(SAY_AGGRO); - } + scheduler.Schedule(Seconds(10), Seconds(11), [this](TaskContext task) + { + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true)) + DoCast(target, SPELL_ARCANE_BUFFET); + task.Repeat(Seconds(15), Seconds(20)); + }); - void JustReachedHome() override - { - BossAI::JustReachedHome(); - instance->SetData(DATA_HANDLE_CELLS, DATA_XEVOZZ); - } + scheduler.Schedule(Seconds(5), [this](TaskContext task) + { + Talk(SAY_REPEAT_SUMMON); - void JustSummoned(Creature* summon) override - { - BossAI::JustSummoned(summon); - summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); - } + std::list<uint8> summonSpells = { 0, 1, 2 }; - void KilledUnit(Unit* victim) override - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); - } + uint8 spell = Trinity::Containers::SelectRandomContainerElement(summonSpells); + DoCast(me, EtherealSphereSummonSpells[spell]); + summonSpells.remove(spell); - void JustDied(Unit* /*killer*/) override + if (IsHeroic()) { - Talk(SAY_DEATH); - _JustDied(); + spell = Trinity::Containers::SelectRandomContainerElement(summonSpells); + task.Schedule(Milliseconds(2500), [this, spell](TaskContext /*task*/) + { + DoCast(me, EtherealSphereHeroicSummonSpells[spell]); + }); } - void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override + task.Schedule(Seconds(33), Seconds(35), [this](TaskContext /*task*/) { - if (spellInfo->Id == SPELL_ARCANE_POWER || spellInfo->Id == H_SPELL_ARCANE_POWER) - Talk(SAY_SUMMON_ENERGY); - } + DummyEntryCheckPredicate pred; + summons.DoAction(ACTION_SUMMON, pred); + }); - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; + task.Repeat(Seconds(45), Seconds(47)); + }); + } +}; - scheduler.Update(diff, - std::bind(&BossAI::DoMeleeAttackIfReady, this)); - } +struct npc_ethereal_sphere : public ScriptedAI +{ + npc_ethereal_sphere(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + } - void ScheduleTasks() override - { - scheduler.Schedule(Seconds(8), Seconds(10), [this](TaskContext task) - { - DoCastAOE(SPELL_ARCANE_BARRAGE_VOLLEY); - task.Repeat(Seconds(8), Seconds(10)); - }); + void Reset() override + { + scheduler.CancelAll(); + ScheduledTasks(); - scheduler.Schedule(Seconds(10), Seconds(11), [this](TaskContext task) - { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true)) - DoCast(target, SPELL_ARCANE_BUFFET); - task.Repeat(Seconds(15), Seconds(20)); - }); + DoCast(me, SPELL_POWER_BALL_VISUAL); + DoCast(me, SPELL_POWER_BALL_DAMAGE_TRIGGER); - scheduler.Schedule(Seconds(5), [this](TaskContext task) - { - Talk(SAY_REPEAT_SUMMON); - - std::list<uint8> summonSpells = { 0, 1, 2 }; - - uint8 spell = Trinity::Containers::SelectRandomContainerElement(summonSpells); - DoCast(me, EtherealSphereSummonSpells[spell]); - summonSpells.remove(spell); - - if (IsHeroic()) - { - spell = Trinity::Containers::SelectRandomContainerElement(summonSpells); - task.Schedule(Milliseconds(2500), [this, spell](TaskContext /*task*/) - { - DoCast(me, EtherealSphereHeroicSummonSpells[spell]); - }); - } - - task.Schedule(Seconds(33), Seconds(35), [this](TaskContext /*task*/) - { - DummyEntryCheckPredicate pred; - summons.DoAction(ACTION_SUMMON, pred); - }); - - task.Repeat(Seconds(45), Seconds(47)); - }); - } - }; + me->DespawnOrUnsummon(40s); + } - CreatureAI* GetAI(Creature* creature) const override + void DoAction(int32 action) override + { + if (action == ACTION_SUMMON) { - return GetVioletHoldAI<boss_xevozzAI>(creature); + Talk(SAY_ETHEREAL_SPHERE_SUMMON); + DoCastAOE(SPELL_SUMMON_PLAYERS); } -}; + } -class npc_ethereal_sphere : public CreatureScript -{ - public: - npc_ethereal_sphere() : CreatureScript("npc_ethereal_sphere") { } + void UpdateAI(uint32 diff) override + { + scheduler.Update(diff); + } - struct npc_ethereal_sphereAI : public ScriptedAI + void ScheduledTasks() + { + scheduler.Schedule(Seconds(1), [this](TaskContext task) { - npc_ethereal_sphereAI(Creature* creature) : ScriptedAI(creature) + if (Creature* xevozz = instance->GetCreature(DATA_XEVOZZ)) { - instance = creature->GetInstanceScript(); - } - - void Reset() override - { - scheduler.CancelAll(); - ScheduledTasks(); - - DoCast(me, SPELL_POWER_BALL_VISUAL); - DoCast(me, DUNGEON_MODE(SPELL_POWER_BALL_DAMAGE_TRIGGER, SPELL_POWER_BALL_DAMAGE_TRIGGER_H)); - - me->DespawnOrUnsummon(40s); - } - - void DoAction(int32 action) override - { - if (action == ACTION_SUMMON) + if (me->IsWithinDist(xevozz, 3.0f)) { - Talk(SAY_ETHEREAL_SPHERE_SUMMON); - DoCastAOE(SPELL_SUMMON_PLAYERS); + DoCastAOE(SPELL_ARCANE_POWER); + me->DespawnOrUnsummon(8s); + return; } } + task.Repeat(); + }); + } - void UpdateAI(uint32 diff) override - { - scheduler.Update(diff); - } - - void ScheduledTasks() - { - scheduler.Schedule(Seconds(1), [this](TaskContext task) - { - if (Creature* xevozz = instance->GetCreature(DATA_XEVOZZ)) - { - if (me->IsWithinDist(xevozz, 3.0f)) - { - DoCastAOE(SPELL_ARCANE_POWER); - me->DespawnOrUnsummon(8s); - return; - } - } - task.Repeat(); - }); - } - - private: - InstanceScript* instance; - TaskScheduler scheduler; - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return GetVioletHoldAI<npc_ethereal_sphereAI>(creature); - } +private: + InstanceScript* instance; + TaskScheduler scheduler; }; -class spell_xevozz_summon_players : public SpellScriptLoader +class spell_xevozz_summon_players : public SpellScript { - public: - spell_xevozz_summon_players() : SpellScriptLoader("spell_xevozz_summon_players") { } - - class spell_xevozz_summon_players_SpellScript : public SpellScript - { - PrepareSpellScript(spell_xevozz_summon_players_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MAGIC_PULL }); - } - - void HandleScript(SpellEffIndex /*effIndex*/) - { - GetCaster()->CastSpell(GetHitUnit(), SPELL_MAGIC_PULL, true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_xevozz_summon_players_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_xevozz_summon_players_SpellScript(); - } + PrepareSpellScript(spell_xevozz_summon_players); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MAGIC_PULL }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), SPELL_MAGIC_PULL, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_xevozz_summon_players::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; void AddSC_boss_xevozz() { - new boss_xevozz(); - new npc_ethereal_sphere(); - new spell_xevozz_summon_players(); + RegisterVioletHoldCreatureAI(boss_xevozz); + RegisterVioletHoldCreatureAI(npc_ethereal_sphere); + RegisterSpellScript(spell_xevozz_summon_players); } |