From c354b346cefa6b776bc1d6d0af33ccf1718e031c Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 23 Mar 2018 10:21:53 +0100 Subject: [PATCH] Core/Spells: fixed Healing Rain --- .../4.3.4/custom_2018_03_23_00_world.sql | 7 ++ src/server/scripts/Spells/spell_shaman.cpp | 79 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 sql/updates/world/4.3.4/custom_2018_03_23_00_world.sql diff --git a/sql/updates/world/4.3.4/custom_2018_03_23_00_world.sql b/sql/updates/world/4.3.4/custom_2018_03_23_00_world.sql new file mode 100644 index 00000000000..607fab89784 --- /dev/null +++ b/sql/updates/world/4.3.4/custom_2018_03_23_00_world.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_script_names` where `ScriptName` IN +('spell_sha_healing_rain', +'spell_sha_healing_rain_triggered'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(73920, 'spell_sha_healing_rain'), +(73921, 'spell_sha_healing_rain_trigger'); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index d78325f4ad2..1a07d6a6a68 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -55,6 +55,7 @@ enum ShamanSpells SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE = 55533, SPELL_SHAMAN_GLYPH_OF_MANA_TIDE = 55441, SPELL_SHAMAN_GLYPH_OF_THUNDERSTORM = 62132, + SPELL_SHAMAN_HEALING_RAIN_TRIGGERED = 73921, SPELL_SHAMAN_HEALING_SURGE = 8004, SPELL_SHAMAN_LAVA_BURST = 51505, SPELL_SHAMAN_LAVA_BURST_TRIGGERED = 77451, @@ -1641,6 +1642,82 @@ class spell_sha_earth_shock : public SpellScriptLoader } }; +// 73920 - Healing Rain +class spell_sha_healing_rain : public SpellScriptLoader +{ + public: + spell_sha_healing_rain() : SpellScriptLoader("spell_sha_healing_rain") { } + + class spell_sha_healing_rain_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_healing_rain_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + return ValidateSpellInfo({ SPELL_SHAMAN_HEALING_RAIN_TRIGGERED }); + } + + void HandleEffectPeriodic(AuraEffect const* aurEff) + { + if (DynamicObject* dyn = GetTarget()->GetDynObject(aurEff->GetId())) + GetTarget()->CastSpell(dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ(), SPELL_SHAMAN_HEALING_RAIN_TRIGGERED, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_healing_rain_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_sha_healing_rain_AuraScript(); + } +}; + +// 73921 - Healing Rain Triggered +class spell_sha_healing_rain_triggered : public SpellScriptLoader +{ + public: + spell_sha_healing_rain_triggered() : SpellScriptLoader("spell_sha_healing_rain_triggered") { } + + class spell_sha_healing_rain_triggered_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_healing_rain_triggered_SpellScript); + + bool Load() + { + _targets = 0; + return true; + } + + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (GetHitHeal() && _targets > 6) + SetHitHeal(GetHitHeal() / _targets); + } + + void FilterTargets(std::list& unitList) + { + _targets = unitList.size(); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_healing_rain_triggered_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY); + OnEffectHitTarget += SpellEffectFn(spell_sha_healing_rain_triggered_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } + + uint32 _targets; + }; + + SpellScript* GetSpellScript() const override + { + return new spell_sha_healing_rain_triggered_SpellScript(); + } +}; + + void AddSC_shaman_spell_scripts() { new spell_sha_ancestral_awakening(); @@ -1660,6 +1737,8 @@ void AddSC_shaman_spell_scripts() new spell_sha_flame_shock(); new spell_sha_focused_insight(); new spell_sha_glyph_of_healing_wave(); + new spell_sha_healing_rain(); + new spell_sha_healing_rain_triggered(); new spell_sha_healing_stream_totem(); new spell_sha_heroism(); new spell_sha_item_lightning_shield();