From a43072e16998d962a5d85f15dcec325e2d6cc18d Mon Sep 17 00:00:00 2001 From: Ovah Date: Wed, 8 Nov 2017 23:56:57 +0000 Subject: [PATCH] Core/Spells: properly fixed Steady Shot focus gain and fixed Improved Steady Shot --- .../world/4.3.4/2017_11_09_02_world.sql | 11 ++++ src/server/scripts/Spells/spell_hunter.cpp | 64 ++++++++++++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/4.3.4/2017_11_09_02_world.sql diff --git a/sql/updates/world/4.3.4/2017_11_09_02_world.sql b/sql/updates/world/4.3.4/2017_11_09_02_world.sql new file mode 100644 index 00000000000..9cb5276120d --- /dev/null +++ b/sql/updates/world/4.3.4/2017_11_09_02_world.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_proc` WHERE `SpellID`= -53221; +INSERT INTO `spell_proc` (`SpellID`, `SpellFamilyName`, `SpellFamilyMask0`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`) VALUES +(-53221, 0, 0, 0x00011100, 1, 1); + +DELETE FROM `spell_script_names` WHERE `spell_id`= -53221; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(-53221, 'spell_hun_improved_steady_shot'); + +DELETE FROM `spell_bonus_data` WHERE `entry`= 7268; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(7268, 0, 0, 0.021, 0, 'Steady Shot'); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 7e38dd0f599..5d306c32f26 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -53,7 +53,9 @@ enum HunterSpells SPELL_HUNTER_SERPENT_STING = 1978, SPELL_HUNTER_SNIPER_TRAINING_R1 = 53302, SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 = 64418, + SPELL_HUNTER_STEADY_SHOT = 56641, SPELL_HUNTER_STEADY_SHOT_FOCUS = 77443, + SPELL_HUNTER_IMPROVED_STEADY_SHOT_TRIGGERED = 53220, SPELL_HUNTER_THRILL_OF_THE_HUNT = 34720, SPELL_LOCK_AND_LOAD_TRIGGER = 56453, SPELL_LOCK_AND_LOAD_MARKER = 67544 @@ -966,14 +968,14 @@ class spell_hun_steady_shot : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - void HandleOnHit() + void HandleLaunch(SpellEffIndex /*effIndex*/) { GetCaster()->CastSpell(GetCaster(), SPELL_HUNTER_STEADY_SHOT_FOCUS, true); } void Register() override { - OnHit += SpellHitFn(spell_hun_steady_shot_SpellScript::HandleOnHit); + OnEffectLaunchTarget += SpellEffectFn(spell_hun_steady_shot_SpellScript::HandleLaunch, EFFECT_0, SPELL_EFFECT_NORMALIZED_WEAPON_DMG); } }; @@ -983,6 +985,63 @@ class spell_hun_steady_shot : public SpellScriptLoader } }; +// 53221 - 53221 - 53224 - Improved Steady Shot + +class spell_hun_improved_steady_shot : public SpellScriptLoader +{ + public: + spell_hun_improved_steady_shot() : SpellScriptLoader("spell_hun_improved_steady_shot") { } + + class spell_hun_improved_steady_shot_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_improved_steady_shot_AuraScript); + + bool Load() override + { + _steadyShotCounter = 0; + return true; + } + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_STEADY_SHOT)) + return false; + + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_IMPROVED_STEADY_SHOT_TRIGGERED)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + if (eventInfo.GetSpellInfo()->Id == SPELL_HUNTER_STEADY_SHOT) + { + _steadyShotCounter++; + if (_steadyShotCounter == 2) + { + GetCaster()->CastCustomSpell(SPELL_HUNTER_IMPROVED_STEADY_SHOT_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetCaster(), true); + _steadyShotCounter = 0; + } + } + else + _steadyShotCounter = 0; + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_hun_improved_steady_shot_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } + + uint8 _steadyShotCounter; + }; + + AuraScript* GetAuraScript() const override + { + return new spell_hun_improved_steady_shot_AuraScript(); + } +}; + // 1515 - Tame Beast class spell_hun_tame_beast : public SpellScriptLoader { @@ -1168,6 +1227,7 @@ void AddSC_hunter_spell_scripts() new spell_hun_scatter_shot(); new spell_hun_sniper_training(); new spell_hun_steady_shot(); + new spell_hun_improved_steady_shot(); new spell_hun_tame_beast(); new spell_hun_target_only_pet_and_owner(); new spell_hun_thrill_of_the_hunt();