diff options
author | offl <11556157+offl@users.noreply.github.com> | 2021-04-12 15:56:43 +0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-03-08 15:58:04 +0100 |
commit | 84236d7ce1936303f4c7639eca460ea2f03c239a (patch) | |
tree | 91713acacde6025d16933b97271e5abf54ec3a92 /src | |
parent | f7441f02349500b46341f76b054f5ef1eb7baa1d (diff) |
Scripts/Violet Hold: Update Cyanigosa to new model (#26371)
Co-authored-by: offl <offl@users.noreply.github.com>
(cherry picked from commit 94299a3ae929ed92787c8ebdb10df3b13b678c98)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp | 184 | ||||
-rw-r--r-- | src/server/scripts/Northrend/VioletHold/violet_hold.h | 2 |
2 files changed, 83 insertions, 103 deletions
diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index 0a2a1050de3..315e9e6d9d2 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -43,87 +43,76 @@ enum Yells SAY_SPECIAL_ATTACK = 6 }; -class boss_cyanigosa : public CreatureScript +struct boss_cyanigosa : public BossAI { - public: - boss_cyanigosa() : CreatureScript("boss_cyanigosa") { } - - struct boss_cyanigosaAI : public BossAI + boss_cyanigosa(Creature* creature) : BossAI(creature, DATA_CYANIGOSA) { } + + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); + Talk(SAY_AGGRO); + } + + void KilledUnit(Unit* victim) override + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } + + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_DEATH); + _JustDied(); + } + + void MoveInLineOfSight(Unit* /*who*/) override { } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + scheduler.Update(diff, + std::bind(&BossAI::DoMeleeAttackIfReady, this)); + } + + void ScheduleTasks() override + { + scheduler.Schedule(Seconds(10), [this](TaskContext task) { - boss_cyanigosaAI(Creature* creature) : BossAI(creature, DATA_CYANIGOSA) { } - - void JustEngagedWith(Unit* who) override - { - BossAI::JustEngagedWith(who); - Talk(SAY_AGGRO); - } + DoCastAOE(SPELL_ARCANE_VACUUM); + task.Repeat(); + }); - void KilledUnit(Unit* victim) override - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); - } - - void JustDied(Unit* /*killer*/) override - { - Talk(SAY_DEATH); - _JustDied(); - } - - void MoveInLineOfSight(Unit* /*who*/) override { } + scheduler.Schedule(Seconds(15), [this](TaskContext task) + { + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true)) + DoCast(target, SPELL_BLIZZARD); + task.Repeat(); + }); - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; + scheduler.Schedule(Seconds(20), [this](TaskContext task) + { + DoCastVictim(SPELL_TAIL_SWEEP); + task.Repeat(); + }); - scheduler.Update(diff, - std::bind(&BossAI::DoMeleeAttackIfReady, this)); - } + scheduler.Schedule(Seconds(25), [this](TaskContext task) + { + DoCastVictim(SPELL_UNCONTROLLABLE_ENERGY); + task.Repeat(); + }); - void ScheduleTasks() override - { - scheduler.Schedule(Seconds(10), [this](TaskContext task) - { - DoCastAOE(SPELL_ARCANE_VACUUM); - task.Repeat(); - }); - - scheduler.Schedule(Seconds(15), [this](TaskContext task) - { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true)) - DoCast(target, SPELL_BLIZZARD); - task.Repeat(); - }); - - scheduler.Schedule(Seconds(20), [this](TaskContext task) - { - DoCastVictim(SPELL_TAIL_SWEEP); - task.Repeat(); - }); - - scheduler.Schedule(Seconds(25), [this](TaskContext task) - { - DoCastVictim(SPELL_UNCONTROLLABLE_ENERGY); - task.Repeat(); - }); - - if (IsHeroic()) - { - scheduler.Schedule(Seconds(30), [this](TaskContext task) - { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true)) - DoCast(target, SPELL_MANA_DESTRUCTION); - task.Repeat(); - }); - } - } - }; - - CreatureAI* GetAI(Creature* creature) const override + if (IsHeroic()) { - return GetVioletHoldAI<boss_cyanigosaAI>(creature); + scheduler.Schedule(Seconds(30), [this](TaskContext task) + { + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true)) + DoCast(target, SPELL_MANA_DESTRUCTION); + task.Repeat(); + }); } + } }; class achievement_defenseless : public AchievementCriteriaScript @@ -144,40 +133,29 @@ class achievement_defenseless : public AchievementCriteriaScript } }; -class spell_cyanigosa_arcane_vacuum : public SpellScriptLoader +class spell_cyanigosa_arcane_vacuum : public SpellScript { - public: - spell_cyanigosa_arcane_vacuum() : SpellScriptLoader("spell_cyanigosa_arcane_vacuum") { } - - class spell_cyanigosa_arcane_vacuum_SpellScript : public SpellScript - { - PrepareSpellScript(spell_cyanigosa_arcane_vacuum_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_SUMMON_PLAYER }); - } - - void HandleScript(SpellEffIndex /*effIndex*/) - { - GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_PLAYER, true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_cyanigosa_arcane_vacuum_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_cyanigosa_arcane_vacuum_SpellScript(); - } + PrepareSpellScript(spell_cyanigosa_arcane_vacuum); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SUMMON_PLAYER }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_PLAYER, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_cyanigosa_arcane_vacuum::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; void AddSC_boss_cyanigosa() { - new boss_cyanigosa(); + RegisterVioletHoldCreatureAI(boss_cyanigosa); new achievement_defenseless(); - new spell_cyanigosa_arcane_vacuum(); + RegisterSpellScript(spell_cyanigosa_arcane_vacuum); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h index d9202f03383..fa4f2d965ba 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.h +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h @@ -161,4 +161,6 @@ inline AI* GetVioletHoldAI(T* obj) return GetInstanceAI<AI>(obj, VioletHoldScriptName); } +#define RegisterVioletHoldCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetVioletHoldAI) + #endif // VIOLET_HOLD_H_ |