diff --git a/sql/updates/world/4.3.4/2017_12_08_01_world.sql b/sql/updates/world/4.3.4/2017_12_08_01_world.sql new file mode 100644 index 00000000000..2e923abccf0 --- /dev/null +++ b/sql/updates/world/4.3.4/2017_12_08_01_world.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_hun_serpent_sting'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(1978, 'spell_hun_serpent_sting'); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 0044fdea04c..4d7193e8b6f 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -38,6 +38,9 @@ enum HunterSpells SPELL_HUNTER_FIRE = 82926, SPELL_HUNTER_GENERIC_ENERGIZE_FOCUS = 91954, SPELL_HUNTER_IMPROVED_MEND_PET = 24406, + SPELL_HUNTER_IMPROVED_SERPENT_STING_DAMAGE = 83077, + SPELL_HUNTER_IMPROVED_SERPENT_STING_R1 = 19464, + SPELL_HUNTER_IMPROVED_SERPENT_STING_R2 = 82834, SPELL_HUNTER_INSANITY = 95809, SPELL_HUNTER_INVIGORATION_TRIGGERED = 53398, SPELL_HUNTER_LOCK_AND_LOAD = 56453, @@ -1246,6 +1249,58 @@ class spell_hun_wild_quiver : public SpellScriptLoader } }; +// 1978 - Serpent Sting +class spell_hun_serpent_sting : public SpellScriptLoader +{ + public: + spell_hun_serpent_sting() : SpellScriptLoader("spell_hun_serpent_sting") { } + + class spell_hun_serpent_sting_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_serpent_sting_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_HUNTER_IMPROVED_SERPENT_STING_DAMAGE, + SPELL_HUNTER_IMPROVED_SERPENT_STING_R1, + SPELL_HUNTER_IMPROVED_SERPENT_STING_R2 + }); + } + + void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + uint32 spellId = 0; + + if (caster->HasAura(SPELL_HUNTER_IMPROVED_SERPENT_STING_R2)) + spellId = SPELL_HUNTER_IMPROVED_SERPENT_STING_R2; + else if (caster->HasAura(SPELL_HUNTER_IMPROVED_SERPENT_STING_R1)) + spellId = SPELL_HUNTER_IMPROVED_SERPENT_STING_R1; + + if (Aura* stingAura = caster->GetAura(spellId)) + { + uint32 periodicDamage = aurEff->GetAmount() * aurEff->GetTotalTicks(); + uint32 damage = CalculatePct(periodicDamage * stingAura->GetSpellInfo()->Effects[EFFECT_0].BasePoints, 1); + caster->CastCustomSpell(SPELL_HUNTER_IMPROVED_SERPENT_STING_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true); + } + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_hun_serpent_sting_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_hun_serpent_sting_AuraScript(); + } +}; + void AddSC_hunter_spell_scripts() { new spell_hun_ancient_hysteria(); @@ -1267,6 +1322,7 @@ void AddSC_hunter_spell_scripts() new spell_hun_readiness(); new spell_hun_ready_set_aim(); new spell_hun_scatter_shot(); + new spell_hun_serpent_sting(); new spell_hun_sniper_training(); new spell_hun_steady_shot(); new spell_hun_improved_steady_shot();