From 45dd82e59c4df29ffa3ddd16ca05cc4b1168b0e6 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 10 May 2019 08:03:25 +0200 Subject: [PATCH] Core/Spells: * fixed a logic mistake for Howling Blast's damage handling * Rolling Thunder will now only proc when Lightning Shield is active --- src/server/scripts/Spells/spell_dk.cpp | 7 +- src/server/scripts/Spells/spell_shaman.cpp | 79 ++++++++++------------ 2 files changed, 40 insertions(+), 46 deletions(-) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 91721fb194f..bf97e7acbe8 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1384,14 +1384,13 @@ class spell_dk_howling_blast : public SpellScript void HandleDamage(SpellEffIndex /*effIndex*/) { if (GetExplTargetUnit() && GetHitUnit()) - - if (GetExplTargetUnit() != GetHitUnit()) - SetEffectValue(CalculatePct(GetEffectValue(), GetSpellInfo()->Effects[EFFECT_2].BasePoints)); + if (GetExplTargetUnit() != GetHitUnit()) + SetHitDamage(CalculatePct(GetHitDamage(), GetSpellInfo()->Effects[EFFECT_2].BasePoints)); } void Register() override { - OnEffectLaunchTarget += SpellEffectFn(spell_dk_howling_blast::HandleDamage, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); + OnEffectHitTarget += SpellEffectFn(spell_dk_howling_blast::HandleDamage, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); } }; diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index ae4510bdb1f..d1606cdf51f 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -1115,52 +1115,47 @@ class spell_sha_nature_guardian : public SpellScriptLoader } }; -// 88756 - Rolling Thunder -class spell_sha_rolling_thunder : public SpellScriptLoader +// -88756 - Rolling Thunder +class spell_sha_rolling_thunder : public AuraScript { - public: - spell_sha_rolling_thunder() : SpellScriptLoader("spell_sha_rolling_thunder") { } + PrepareAuraScript(spell_sha_rolling_thunder); - class spell_sha_rolling_thunder_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_SHAMAN_LIGHTNING_SHIELD, + SPELL_SHAMAN_FULMINATION_PROC + }); + } + + bool CheckProc(ProcEventInfo& /*eventInfo*/) + { + return GetTarget()->HasAura(SPELL_SHAMAN_LIGHTNING_SHIELD); + } + + void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + Unit* target = GetTarget(); + + if (Aura* aura = target->GetAura(SPELL_SHAMAN_LIGHTNING_SHIELD)) { - PrepareAuraScript(spell_sha_rolling_thunder_AuraScript); + uint8 charges = std::min(aura->GetCharges() + 1, aurEff->GetAmount()); + aura->SetCharges(charges); + aura->RefreshDuration(); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_SHAMAN_LIGHTNING_SHIELD, - SPELL_SHAMAN_FULMINATION_PROC - }); - } - - void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - Unit* target = GetTarget(); - - if (Aura* aura = target->GetAura(SPELL_SHAMAN_LIGHTNING_SHIELD)) - { - uint8 charges = std::min(aura->GetCharges() + 1, aurEff->GetAmount()); - aura->SetCharges(charges); - aura->RefreshDuration(); - - // Fulmination visual - if (AuraEffect const* fulAurEff = target->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_FULMINATION, EFFECT_0)) - if (charges == aurEff->GetAmount()) - target->CastSpell(GetTarget(), SPELL_SHAMAN_FULMINATION_PROC, true, nullptr, aurEff); - } - } - - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_sha_rolling_thunder_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_sha_rolling_thunder_AuraScript(); + // Fulmination visual + if (AuraEffect const* fulAurEff = target->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_FULMINATION, EFFECT_0)) + if (charges == aurEff->GetAmount()) + target->CastSpell(GetTarget(), SPELL_SHAMAN_FULMINATION_PROC, true, nullptr, aurEff); } + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_sha_rolling_thunder::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_sha_rolling_thunder::HandleEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; // 82984 - Telluric Currents @@ -2041,7 +2036,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_mana_tide_totem(); new spell_sha_nature_guardian(); new spell_sha_resurgence(); - new spell_sha_rolling_thunder(); + RegisterAuraScript(spell_sha_rolling_thunder); RegisterAuraScript(spell_sha_static_shock); new spell_sha_telluric_currents(); new spell_sha_thunderstorm();