From bea682f95c374d914f47925448fff6b8c9d3fcb4 Mon Sep 17 00:00:00 2001 From: Keader Date: Sat, 14 Aug 2021 21:12:20 -0300 Subject: Scripts/Spells: Fixed Anti-Magic Zone amount calculation Spell is casted by a trigger, not a player, so script need get owner instead caster --- src/server/scripts/Spells/spell_dk.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 6cb0003c03d..ff374b5e6ed 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -344,15 +344,19 @@ private: 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 (Player* player = GetCaster()->ToPlayer()) + 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) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32 &absorbAmount) { absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } -- cgit v1.2.3