diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-02-16 00:54:03 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2018-02-16 00:54:53 -0300 |
commit | 7dc78d8e3f437ad7f3ad40bf1ef6801ac1ed5fc2 (patch) | |
tree | 29c3b564a0f30203915900957c77483a9568b33e /src | |
parent | ab1aa8e3844753e8f8d0c2ec0974c6050acfea55 (diff) |
Core/Scripts: implemented Fungal Decay & Tail Sting
Refs #18542
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 746b1f69ae1..fbc95735cdd 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1238,6 +1238,118 @@ class spell_gen_damage_reduction_aura : public AuraScript } }; +class spell_gen_decay_over_time : public SpellScriptLoader +{ + public: + spell_gen_decay_over_time(char const* name) : SpellScriptLoader(name) { } + + SpellScript* GetSpellScript() const override + { + return new spell_gen_decay_over_time_SpellScript(); + } + + private: + class spell_gen_decay_over_time_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_decay_over_time_SpellScript); + + void ModAuraStack() + { + if (Aura* aur = GetHitAura()) + aur->SetStackAmount(static_cast<uint8>(GetSpellInfo()->StackAmount)); + } + + void Register() override + { + AfterHit += SpellHitFn(spell_gen_decay_over_time_SpellScript::ModAuraStack); + } + }; + + protected: + class spell_gen_decay_over_time_AuraScript : public AuraScript + { + protected: + PrepareAuraScript(spell_gen_decay_over_time_AuraScript); + + bool CheckProc(ProcEventInfo& eventInfo) + { + return (eventInfo.GetSpellInfo() == GetSpellInfo()); + } + + void Decay(ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + ModStackAmount(-1); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_gen_decay_over_time_AuraScript::CheckProc); + OnProc += AuraProcFn(spell_gen_decay_over_time_AuraScript::Decay); + } + + ~spell_gen_decay_over_time_AuraScript() = default; + }; + + ~spell_gen_decay_over_time() = default; +}; + +enum FungalDecay +{ + // found in sniffs, there is no duration entry we can possibly use + AURA_DURATION = 12600 +}; + +// 32065 - Fungal Decay +class spell_gen_decay_over_time_fungal_decay : public spell_gen_decay_over_time +{ + public: + spell_gen_decay_over_time_fungal_decay() : spell_gen_decay_over_time("spell_gen_decay_over_time_fungal_decay") { } + + class spell_gen_decay_over_time_fungal_decay_AuraScript : public spell_gen_decay_over_time_AuraScript + { + PrepareAuraScript(spell_gen_decay_over_time_fungal_decay_AuraScript); + + void ModDuration(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // only on actual reapply, not on stack decay + if (GetDuration() == GetMaxDuration()) + { + SetMaxDuration(AURA_DURATION); + SetDuration(AURA_DURATION); + } + } + + void Register() override + { + spell_gen_decay_over_time_AuraScript::Register(); + OnEffectApply += AuraEffectApplyFn(spell_gen_decay_over_time_fungal_decay_AuraScript::ModDuration, EFFECT_0, SPELL_AURA_MOD_DECREASE_SPEED, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_gen_decay_over_time_fungal_decay_AuraScript(); + } +}; + +// 36659 - Tail Sting +class spell_gen_decay_over_time_tail_sting : public spell_gen_decay_over_time +{ + public: + spell_gen_decay_over_time_tail_sting() : spell_gen_decay_over_time("spell_gen_decay_over_time_tail_sting") { } + + class spell_gen_decay_over_time_tail_sting_AuraScript : public spell_gen_decay_over_time_AuraScript + { + PrepareAuraScript(spell_gen_decay_over_time_tail_sting_AuraScript); + }; + + AuraScript* GetAuraScript() const override + { + return new spell_gen_decay_over_time_tail_sting_AuraScript(); + } +}; + enum DefendVisuals { SPELL_VISUAL_SHIELD_1 = 63130, @@ -3840,6 +3952,8 @@ void AddSC_generic_spell_scripts() new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise"); RegisterAuraScript(spell_gen_damage_reduction_aura); + new spell_gen_decay_over_time_fungal_decay(); + new spell_gen_decay_over_time_tail_sting(); RegisterAuraScript(spell_gen_defend); RegisterSpellScript(spell_gen_despawn_self); RegisterSpellScript(spell_gen_divine_storm_cd_reset); |