diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-02-16 00:54:03 -0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-06-22 13:15:11 +0200 |
commit | d36f8bb7547c5ebef067f834c79754c57ff66a34 (patch) | |
tree | 0199a183a388420186bdc2157ae3d4e781731c9b | |
parent | 1fe817a9957bdc62d1e9a0b33f4615746831a6a7 (diff) |
Core/Scripts: implemented Fungal Decay & Tail Sting
Refs #18542
(cherry picked from commit 7dc78d8e3f437ad7f3ad40bf1ef6801ac1ed5fc2)
-rw-r--r-- | sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql | 8 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 114 |
2 files changed, 122 insertions, 0 deletions
diff --git a/sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql b/sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql new file mode 100644 index 00000000000..ac6733d1059 --- /dev/null +++ b/sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc` WHERE `SpellId` IN (32065, 36659); +INSERT INTO `spell_proc` (`SpellId`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `ProcsPerMinute`, `Chance`, `Cooldown`, `Charges`) VALUES +(32065, 0x0, 0, 0x00000000, 0x00000000, 0x00000000, 0x80000, 0x1, 0x0, 0x0, 0x0, 0, 0, 0, 0), +(36659, 0x0, 0, 0x00000000, 0x00000000, 0x00000000, 0x80000, 0x1, 0x0, 0x0, 0x0, 0, 0, 0, 0); +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_decay_over_time_fungal_decay','spell_gen_decay_over_time_tail_sting'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(32065, 'spell_gen_decay_over_time_fungal_decay'), +(36659, 'spell_gen_decay_over_time_tail_sting'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 736ea803973..e6a36a36ed0 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1143,6 +1143,118 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader } }; +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, @@ -3928,6 +4040,8 @@ void AddSC_generic_spell_scripts() RegisterAuraScript(spell_gen_creature_permanent_feign_death); new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise"); + 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); |