Skip to content

Commit

Permalink
Core/Spells: Immune a reflected spell if the original caster cannot b…
Browse files Browse the repository at this point in the history
…e it's target. (TrinityCore#29645)
  • Loading branch information
r4d1sh authored Feb 9, 2024
1 parent f647199 commit 86551ba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/server/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down

0 comments on commit 86551ba

Please sign in to comment.