diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-01-20 21:00:53 -0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-06-16 14:26:09 +0200 |
commit | 85ffcd9826f95127317a8a8427e9140542583bd5 (patch) | |
tree | a4362e504544a446f29bc9d721844a375944eb8b /src | |
parent | d4359bb560ff1022dac7b0339dab894906a09be4 (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
(cherry picked from commit 9f5d1e2b10013e5fecf35fdd5af70921c96d07d1)
Diffstat (limited to 'src')
7 files changed, 43 insertions, 24 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c8c6329a5c0..e6c6116b0af 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4720,29 +4720,28 @@ uint32 Unit::GetDiseasesByCaster(ObjectGuid casterGUID, bool remove) static const AuraType diseaseAuraTypes[] = { SPELL_AURA_PERIODIC_DAMAGE, // Frost Fever and Blood Plague - SPELL_AURA_LINKED, // Crypt Fever and Ebon Plague - SPELL_AURA_NONE + SPELL_AURA_LINKED // Crypt Fever and Ebon Plague }; uint32 diseases = 0; - for (AuraType const* itr = diseaseAuraTypes; *itr != SPELL_AURA_NONE; ++itr) + for (AuraType aType : diseaseAuraTypes) { - for (AuraEffectList::iterator i = m_modAuras[*itr].begin(); i != m_modAuras[*itr].end();) + for (auto itr = m_modAuras[aType].begin(); itr != m_modAuras[aType].end();) { // Get auras with disease dispel type by caster - if ((*i)->GetSpellInfo()->Dispel == DISPEL_DISEASE - && (*i)->GetCasterGUID() == casterGUID) + if ((*itr)->GetSpellInfo()->Dispel == DISPEL_DISEASE + && (*itr)->GetCasterGUID() == casterGUID) { ++diseases; if (remove) { - RemoveAura((*i)->GetId(), (*i)->GetCasterGUID()); - i = m_modAuras[*itr].begin(); + RemoveAura((*itr)->GetId(), (*itr)->GetCasterGUID()); + itr = m_modAuras[aType].begin(); continue; } } - ++i; + ++itr; } } return diseases; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 36ceb9ed465..061344e2754 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -896,7 +896,7 @@ class spell_impale : public SpellScriptLoader // make sure Impale doesnt do damage if we are standing on permafrost if (target && target->HasAura(SPELL_PERMAFROST)) - SetHitDamage(0); + PreventHitDamage(); } void Register() override diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 1367206bbb1..1fd1a8b4db5 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -268,20 +268,19 @@ class spell_bronjahm_magic_bane : public SpellScriptLoader { PrepareSpellScript(spell_bronjahm_magic_bane_SpellScript); - void RecalculateDamage() + void RecalculateDamage(SpellEffIndex /*effIndex*/) { if (GetHitUnit()->GetPowerType() != POWER_MANA) return; int32 const maxDamage = GetCaster()->GetMap()->IsHeroic() ? 15000 : 10000; - int32 newDamage = GetHitDamage() + (GetHitUnit()->GetMaxPower(POWER_MANA) / 2); - - SetHitDamage(std::min<int32>(maxDamage, newDamage)); + int32 newDamage = GetEffectValue() + (GetHitUnit()->GetMaxPower(POWER_MANA) / 2); + SetEffectValue(std::min<int32>(maxDamage, newDamage)); } void Register() override { - OnHit += SpellHitFn(spell_bronjahm_magic_bane_SpellScript::RecalculateDamage); + OnEffectLaunchTarget += SpellEffectFn(spell_bronjahm_magic_bane_SpellScript::RecalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 024ed6b8731..2c3d8b68098 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -1497,16 +1497,16 @@ class spell_blood_council_shadow_prison_damage : public SpellScriptLoader { PrepareSpellScript(spell_blood_council_shadow_prison_SpellScript); - void AddExtraDamage() + void AddExtraDamage(SpellEffIndex /*effIndex*/) { if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id)) if (AuraEffect const* eff = aur->GetEffect(EFFECT_1)) - SetHitDamage(GetHitDamage() + eff->GetAmount()); + SetEffectValue(GetEffectValue() + eff->GetAmount()); } void Register() override { - OnHit += SpellHitFn(spell_blood_council_shadow_prison_SpellScript::AddExtraDamage); + OnEffectLaunchTarget += SpellEffectFn(spell_blood_council_shadow_prison_SpellScript::AddExtraDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 68f5ecc9ab2..f61ab9bf2b3 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -518,22 +518,24 @@ class spell_oculus_shock_lance : public SpellScriptLoader return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE }); } - void CalcDamage() + void CalcDamage(SpellEffIndex /*effIndex*/) { - int32 damage = GetHitDamage(); + int32 damage = GetEffectValue(); if (Unit* target = GetHitUnit()) + { if (AuraEffect const* shockCharges = target->GetAuraEffect(SPELL_AMBER_SHOCK_CHARGE, EFFECT_0, GetCaster()->GetGUID())) { damage += shockCharges->GetAmount(); - shockCharges->GetBase()->Remove(); + shockCharges->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL); } + } - SetHitDamage(damage); + SetEffectValue(damage); } void Register() override { - OnHit += SpellHitFn(spell_oculus_shock_lance_SpellScript::CalcDamage); + OnEffectLaunchTarget += SpellEffectFn(spell_oculus_shock_lance_SpellScript::CalcDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index f0508e60b31..cfa74d6b59e 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -20,6 +20,7 @@ #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" +#include "SpellScript.h" #include "TemporarySummon.h" #include "utgarde_pinnacle.h" @@ -311,6 +312,23 @@ public: } }; +// 48292 - Dark Slash +class spell_dark_slash : public SpellScript +{ + PrepareSpellScript(spell_dark_slash); + + void CalculateDamage() + { + // Slashes the target with darkness, dealing damage equal to half the target's current health. + SetHitDamage(int32(ceil(GetHitUnit()->GetHealth() / 2.f))); + } + + void Register() override + { + OnHit += SpellHitFn(spell_dark_slash::CalculateDamage); + } +}; + class achievement_kings_bane : public AchievementCriteriaScript { public: @@ -332,5 +350,6 @@ class achievement_kings_bane : public AchievementCriteriaScript void AddSC_boss_ymiron() { new boss_ymiron(); + RegisterSpellScript(spell_dark_slash); new achievement_kings_bane(); } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 62f5dc423f7..e48cc486797 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -209,7 +209,7 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader Unit* target = GetHitUnit(); if (target->HasAura(GetTriggeringSpell()->Id)) - SetHitDamage(0); + PreventHitDamage(); } void Register() override |