From 62058ffbeaeee94ec9fce57284af15dd10d4f008 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:52:54 +0200 Subject: [PATCH] fix(Script/Spells): Anti-Magic Zone amount calc (#7438) * cherry-pick commit (https://github.com/TrinityCore/TrinityCore/commit/bea682f95c374d914f47925448fff6b8c9d3fcb4) Co-authored-by: Lucas Nascimento --- src/server/scripts/Spells/spell_dk.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index ceb753145..f0001b6e3 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1185,14 +1185,21 @@ public: return ValidateSpellInfo({ SPELL_DK_ANTI_MAGIC_SHELL_TALENT }); } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { SpellInfo const* talentSpell = sSpellMgr->AssertSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT); - amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster()); - if (Unit* totem = GetCaster()) - if (Unit* owner = totem->ToTotem()->GetSummoner()) - amount += int32(2 * owner->GetTotalAttackPowerValue(BASE_ATTACK)); - canBeRecalculated = false; + + Unit* owner = GetCaster()->GetOwner(); + if (!owner) + { + return; + } + + amount = talentSpell->Effects[EFFECT_0].CalcValue(owner); + if (Player* player = owner->ToPlayer()) + { + amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK)); + } } void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)