fix(Core/Spells): possible crashes within class spells (#9168)

This commit is contained in:
Nefertumm
2021-11-21 11:41:51 -03:00
committed by GitHub
parent 92b3617f63
commit 61c7488698
9 changed files with 66 additions and 25 deletions

View File

@@ -1142,12 +1142,14 @@ class spell_warl_drain_soul : public AuraScript
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
// Improved Drain Soul.
if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
if (Unit* caster = eventInfo.GetActor())
{
int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
// Improved Drain Soul.
if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
{
int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
}
}
}