aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-01-20 21:00:53 -0300
committerariel- <ariel-@users.noreply.github.com>2018-01-20 21:09:22 -0300
commit9f5d1e2b10013e5fecf35fdd5af70921c96d07d1 (patch)
tree4c932a91ff0b5d512121b4cbc65b7d4983232ef6 /src/server/scripts/Spells
parentcb75105434f5002ae53aef2c9c2e6417eaf8f5f0 (diff)
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
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp25
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp8
2 files changed, 22 insertions, 11 deletions
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);
}
};