From 9f5d1e2b10013e5fecf35fdd5af70921c96d07d1 Mon Sep 17 00:00:00 2001 From: ariel- Date: Sat, 20 Jan 2018 21:00:53 -0300 Subject: Core/Scripts: fix wrong uses of SetHitDamage hook. This hook modifies damage AFTER it has been reduced by target auras/armor/resistances etc, it's useful if you want to scale damage by a factor, but not to add flat bonuses. We're fixing those by moving calculation to Launch phase, where target taken bonuses haven't been used yet. - Bronjahm: Magic's Bane - BPC: Shadow Prison - Oculus: Shock Lance - Ymiron: Dark Slash (extra fix, it was wrongly damaging half of total health, it's supposed to be half of CURRENT health!) - DK: Raise Ally Thrash spell (also extra fix: corrected formula) - Warrior: Bloodthirst (shouldn't matter much as it's damage class none and those don't get bonuses by default) - Warrior: Concussion Blow - Warlock: extra fix for Haunt, healing part shouldn't scale with spell power Closes #9560 --- src/server/scripts/Spells/spell_dk.cpp | 25 ++++++++++++++++++------- src/server/scripts/Spells/spell_warrior.cpp | 8 ++++---- 2 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src/server/scripts/Spells') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 4fb4bfb5816..8729fb4c889 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -2975,14 +2975,25 @@ public: return ValidateSpellInfo({ SPELL_GHOUL_FRENZY }); } - void CalcDamage() + void CalcDamage(SpellEffIndex /*effIndex*/) { - if (Aura* aur = GetCaster()->GetAura(SPELL_GHOUL_FRENZY)) + /* + Causes more damage per frenzy point: + 1 point : ${$AP*$m1*0.01+$AP*0.05}-${$AP*$m1*0.01+$AP*0.10} damage + 2 points : ${$AP*$m1*0.01+$AP*0.10}-${$AP*$m1*0.01+$AP*0.20} damage + 3 points : ${$AP*$m1*0.01+$AP*0.15}-${$AP*$m1*0.01+$AP*0.30} damage + 4 points : ${$AP*$m1*0.01+$AP*0.20}-${$AP*$m1*0.01+$AP*0.40} damage + 5 points : ${$AP*$m1*0.01+$AP*0.25}-${$AP*$m1*0.01+$AP*0.50} damage + */ + + if (Aura* frenzy = GetCaster()->GetAura(SPELL_GHOUL_FRENZY)) { - int32 damage = GetHitDamage(); - damage += int32(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.05f * aur->GetStackAmount()); - aur->Remove(); - SetHitDamage(damage); + float APBonus = GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK); + float fixedDamageBonus = APBonus * GetEffectValue() * 0.01f; + APBonus *= 0.05f * frenzy->GetStackAmount(); + + frenzy->Remove(AURA_REMOVE_BY_ENEMY_SPELL); + SetEffectValue(fixedDamageBonus + irand(int32(APBonus), int32(APBonus * 2.f))); } /* @@ -2995,7 +3006,7 @@ public: void Register() override { - OnHit += SpellHitFn(spell_dk_ghoul_thrash_SpellScript::CalcDamage); + OnEffectLaunchTarget += SpellEffectFn(spell_dk_ghoul_thrash_SpellScript::CalcDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index fd657f0ae94..bb787d828ac 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -143,12 +143,12 @@ class spell_warr_bloodthirst_heal : public SpellScriptLoader { SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_WARRIOR_BLOODTHIRST_DAMAGE); int32 const healPct = spellInfo->Effects[EFFECT_1].CalcValue(GetCaster()); - SetHitHeal(GetCaster()->CountPctFromMaxHealth(healPct)); + SetEffectValue(GetCaster()->CountPctFromMaxHealth(healPct)); } void Register() override { - OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + OnEffectLaunchTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); } }; @@ -209,12 +209,12 @@ class spell_warr_concussion_blow : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - SetHitDamage(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue())); + SetEffectValue(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetSpellInfo()->Effects[EFFECT_2].CalcValue())); } void Register() override { - OnEffectHitTarget += SpellEffectFn(spell_warr_concussion_blow_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); + OnEffectLaunchTarget += SpellEffectFn(spell_warr_concussion_blow_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); } }; -- cgit v1.2.3