From 86551ba71669712cadf82f2dc1f0c5481f0fba1b Mon Sep 17 00:00:00 2001 From: Mykhailo Redko Date: Fri, 9 Feb 2024 21:28:54 +0200 Subject: [PATCH] Core/Spells: Immune a reflected spell if the original caster cannot be it's target. (#29645) --- src/server/game/Spells/Spell.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index db440a3d39478..bcef84cbdbee4 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2139,9 +2139,14 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= // If target reflect spell back to caster if (targetInfo.MissCondition == SPELL_MISS_REFLECT) { - // Calculate reflected spell result on caster (shouldn't be able to reflect gameobject spells) + // Shouldn't be able to reflect gameobject spells Unit* unitCaster = ASSERT_NOTNULL(m_caster->ToUnit()); - targetInfo.ReflectResult = unitCaster->SpellHitResult(unitCaster, m_spellInfo, false); // can't reflect twice + + // Calculate reflected spell result on caster + if (m_spellInfo->CheckTarget(target, unitCaster, implicit) == SPELL_CAST_OK) + targetInfo.ReflectResult = unitCaster->SpellHitResult(unitCaster, m_spellInfo, false); // can't reflect twice + else + targetInfo.ReflectResult = SPELL_MISS_IMMUNE; // Proc spell reflect aura when missile hits the original target target->m_Events.AddEvent(new ProcReflectDelayed(target, m_originalCasterGUID), target->m_Events.CalculateTime(Milliseconds(targetInfo.TimeDelay)));