From 82ffeb587b5f77e24349f00d0ce1af998c3c7408 Mon Sep 17 00:00:00 2001 From: ariel- Date: Sat, 3 Sep 2022 10:15:44 +0200 Subject: [PATCH] Core/Spells: fix delayed hit aura crash --- src/server/game/Spells/Spell.cpp | 7 +++++-- src/server/game/Spells/Spell.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 9cf577cdf58..124b50f9e20 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2737,9 +2737,9 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell) else if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT && spell->m_caster->ToGameObject()->AI()) spell->m_caster->ToGameObject()->AI()->SpellHitTarget(_spellHitTarget, spell->m_spellInfo); - if (spell->_spellAura) + if (HitAura) { - if (AuraApplication* aurApp = spell->_spellAura->GetApplicationOfTarget(_spellHitTarget->GetGUID())) + if (AuraApplication* aurApp = HitAura->GetApplicationOfTarget(_spellHitTarget->GetGUID())) { // only apply unapplied effects (for reapply case) uint8 effMask = EffectMask & aurApp->GetEffectsToApply(); @@ -3027,7 +3027,10 @@ void Spell::DoSpellEffectHit(Unit* unit, uint8 effIndex, TargetInfo& hitInfo) } } else + { + hitInfo.HitAura = _spellAura; _spellAura->AddStaticApplication(unit, aura_effmask); + } } } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 6b2cd9b0e3b..983fc2b0c3c 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -694,6 +694,7 @@ class TC_GAME_API Spell SpellInfo const* AuraSpellInfo = nullptr; int32 AuraBasePoints[MAX_SPELL_EFFECTS] = { }; bool Positive = true; + UnitAura* HitAura = nullptr; private: Unit* _spellHitTarget = nullptr; // changed for example by reflect