aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeader <keader.android@gmail.com>2021-08-14 21:12:20 -0300
committerKeader <keader.android@gmail.com>2021-08-14 21:12:46 -0300
commitbea682f95c374d914f47925448fff6b8c9d3fcb4 (patch)
tree86af7248808e42caaacb993dac1d3d8ae0f0ee51
parentc8f2056b177ec5f72ff0b183e5bdbbba1db9b4de (diff)
Scripts/Spells: Fixed Anti-Magic Zone amount calculation
Spell is casted by a trigger, not a player, so script need get owner instead caster
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp12
1 files changed, 8 insertions, 4 deletions
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);
}