aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMykhailo Redko <ovitnez@gmail.com>2024-02-09 21:28:54 +0200
committerGitHub <noreply@github.com>2024-02-09 20:28:54 +0100
commit86551ba71669712cadf82f2dc1f0c5481f0fba1b (patch)
tree0436008771208408c9df082c9f62c7ea2856e772 /src
parentf647199e22a411a7822502ae15ffb6b4f9009bb9 (diff)
Core/Spells: Immune a reflected spell if the original caster cannot be it's target. (#29645)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Spell.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index db440a3d394..bcef84cbdbe 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)));