From c7892087fe4993039014b40b455ad05bd4e85449 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Mon, 27 Dec 2021 13:46:05 +0100 Subject: [PATCH] Core/Spells: fixed Serpent Spread talent --- .../world/4.3.4/2021_12_27_01_world.sql | 25 +++++++++ src/server/game/Spells/SpellMgr.cpp | 10 ++++ src/server/scripts/Spells/spell_hunter.cpp | 54 ++++++++++++++----- 3 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 sql/updates/world/4.3.4/2021_12_27_01_world.sql diff --git a/sql/updates/world/4.3.4/2021_12_27_01_world.sql b/sql/updates/world/4.3.4/2021_12_27_01_world.sql new file mode 100644 index 00000000000..f6be0cf7944 --- /dev/null +++ b/sql/updates/world/4.3.4/2021_12_27_01_world.sql @@ -0,0 +1,25 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_hun_serpent_spread', 'spell_hun_serpent_sting'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(-87934, 'spell_hun_serpent_spread'), +(1978, 'spell_hun_serpent_sting'), +(88466, 'spell_hun_serpent_sting'), +(88453, 'spell_hun_serpent_sting'); + +DELETE FROM `spell_proc` WHERE `SpellId`= -87934; +INSERT INTO `spell_proc` (`SpellId`,`SpellFamilyName`, `SpellFamilyMask0`, `SpellTypeMask`, `SpellPhaseMask`) VALUES +(-87934, 9, 0x1000, 1, 2); + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (88453, 88466); +INSERT INTO `spell_bonus_data` (`entry`, `ap_dot_bonus`, `comments`) VALUES +(88453, 0.08, 'Hunter - Serpent Sting'), +(88466, 0.08, 'Hunter - Serpent Sting'); + +DELETE FROM `spell_group` WHERE `id`= 1150; +INSERT INTO `spell_group` (`id`, `spell_id`) VALUES +(1150, 88453), +(1150, 88466), +(1150, 1978); + +DELETE FROM `spell_group_stack_rules` WHERE `group_id`= 1150; +INSERT INTO `spell_group_stack_rules` (`group_id`, `stack_rule`) VALUES +(1150, 2); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index fca4e16c9c5..57bcc5f3aa1 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -5947,6 +5947,16 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->SpellFamilyName = SPELLFAMILY_ROGUE; }); + // Serpent Spread + ApplySpellFix({ + 87934, + 87935 + }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_DUMMY; + spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_APPLY_AURA; + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 4432b0e9d62..ff46141dfee 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -76,7 +76,6 @@ enum HunterSpells SPELL_HUNTER_READINESS = 23989, SPELL_HUNTER_SIC_EM_R1 = 83359, SPELL_HUNTER_SIC_EM_R2 = 89388, - SPELL_HUNTER_SERPENT_STING = 1978, SPELL_HUNTER_STEADY_SHOT = 56641, SPELL_HUNTER_STEADY_SHOT_FOCUS = 77443, SPELL_HUNTER_TRAP_LAUNCHER_LINKED = 82946, @@ -136,6 +135,15 @@ class spell_hun_ancient_hysteria : public SpellScript } }; +// Universal helper to get the serpent sting aura of all variants of it (original and the procced versions of Serpent Spread) +static Aura* GetSerpentStingAura(Unit* target, ObjectGuid casterGUID) +{ + if (AuraEffect* aurff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x4000, 0, 0, casterGUID)) + return aurff->GetBase(); + + return nullptr; +} + // 53209 - Chimera Shot class spell_hun_chimera_shot : public SpellScript { @@ -146,11 +154,7 @@ class spell_hun_chimera_shot : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo( - { - SPELL_HUNTER_CHIMERA_SHOT_HEAL, - SPELL_HUNTER_SERPENT_STING - }); + return ValidateSpellInfo({ SPELL_HUNTER_CHIMERA_SHOT_HEAL }); } void HandleScriptEffect(SpellEffIndex /*effIndex*/) @@ -161,7 +165,7 @@ class spell_hun_chimera_shot : public SpellScript caster->CastSpell(nullptr, SPELL_HUNTER_CHIMERA_SHOT_HEAL, true); - if (Aura* serpentSting = GetHitUnit()->GetAura(SPELL_HUNTER_SERPENT_STING, caster->GetGUID())) + if (Aura* serpentSting = GetSerpentStingAura(GetHitUnit(), caster->GetGUID())) serpentSting->RefreshDuration(); } @@ -181,11 +185,7 @@ class spell_hun_cobra_shot : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo( - { - SPELL_HUNTER_GENERIC_ENERGIZE_FOCUS, - SPELL_HUNTER_SERPENT_STING - }); + return ValidateSpellInfo({ SPELL_HUNTER_GENERIC_ENERGIZE_FOCUS }); } void HandleLaunch(SpellEffIndex /*effIndex*/) @@ -203,7 +203,7 @@ class spell_hun_cobra_shot : public SpellScript void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (Aura* aur = GetHitUnit()->GetAura(SPELL_HUNTER_SERPENT_STING, GetCaster()->GetGUID())) + if (Aura* aur = GetSerpentStingAura(GetHitUnit(), GetCaster()->GetGUID())) { int32 newDuration = aur->GetDuration() + GetEffectValue() * IN_MILLISECONDS; aur->SetDuration(std::min(newDuration, aur->GetMaxDuration()), true); @@ -1401,6 +1401,33 @@ class spell_hun_sic_em : public AuraScript } }; +// -87934 - Sperpent Spread +static std::array SerpentSpreadSerpentStingSpellIds = +{ + 88453, + 88466 +}; + +class spell_hun_serpent_spread : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo(SerpentSpreadSerpentStingSpellIds); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + uint8 index = GetSpellInfo()->GetRank() - 1; + GetTarget()->CastSpell(eventInfo.GetProcTarget(), SerpentSpreadSerpentStingSpellIds[index], CastSpellExtraArgs(aurEff)); + } + + void Register() override + { + OnEffectProc.Register(&spell_hun_serpent_spread::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } +}; + void AddSC_hunter_spell_scripts() { RegisterSpellScript(spell_hun_ancient_hysteria); @@ -1434,6 +1461,7 @@ void AddSC_hunter_spell_scripts() RegisterSpellScript(spell_hun_ready_set_aim); RegisterSpellScript(spell_hun_scatter_shot); RegisterSpellScript(spell_hun_serpent_sting); + RegisterSpellScript(spell_hun_serpent_spread); RegisterSpellScript(spell_hun_sic_em); RegisterSpellScript(spell_hun_sniper_training); RegisterSpellScript(spell_hun_steady_shot);