From bc688c2a51827030f50fae84b5ca92edd272f129 Mon Sep 17 00:00:00 2001 From: avarishd <46330494+avarishd@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:53:45 +0200 Subject: [PATCH] fix(Core/Spells): Script Choking Vines (#17615) * fix(DB/Custom): Choking Vines should stack from different sources * script spell * comment --- .../rev_1698597123341587200.sql | 6 ++++ src/server/scripts/Spells/spell_generic.cpp | 35 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1698597123341587200.sql diff --git a/data/sql/updates/pending_db_world/rev_1698597123341587200.sql b/data/sql/updates/pending_db_world/rev_1698597123341587200.sql new file mode 100644 index 000000000..dcd14c6dd --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1698597123341587200.sql @@ -0,0 +1,6 @@ +-- Choking Vines +DELETE FROM `spell_custom_attr` WHERE `spell_id`=35244; +INSERT INTO `spell_custom_attr` (`spell_id`, `attributes`) VALUES (35244, 4194304); + +DELETE FROM `spell_script_names` WHERE `spell_id`=35244 AND `ScriptName`='spell_gen_choking_vines'; +INSERT INTO `spell_script_names` VALUES (35244, 'spell_gen_choking_vines'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index bfd937f03..2eb72152b 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5102,6 +5102,40 @@ class spell_gen_yehkinya_bramble : public SpellScript } }; +// 35244 - Choking Vines +enum ChokingVines +{ + SPELL_CHOKING_VINES = 35244, + SPELL_CHOKING_WOUND = 35247 +}; + +class spell_gen_choking_vines : public AuraScript +{ + PrepareAuraScript(spell_gen_choking_vines); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_CHOKING_VINES, SPELL_CHOKING_WOUND }); + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + { + if (GetStackAmount() == GetSpellInfo()->StackAmount) // 5 stacks + { + target->RemoveAurasDueToSpell(SPELL_CHOKING_VINES); + target->CastSpell(target, SPELL_CHOKING_WOUND, true); // Unknown if it's a self cast or casted by the source on 5th + } + } + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_gen_choking_vines::OnApply, EFFECT_0, SPELL_AURA_MOD_DECREASE_SPEED, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } +}; + void AddSC_generic_spell_scripts() { RegisterSpellScript(spell_silithyst); @@ -5254,4 +5288,5 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_planting_scourge_banner); RegisterSpellScript(spell_gen_jubling_cooldown); RegisterSpellScript(spell_gen_yehkinya_bramble); + RegisterSpellScript(spell_gen_choking_vines); }