Core/Spells: check for spell immunities only for effects that are affecting the checked target

This commit is contained in:
Ovahlord committed 2020-07-10 19:12:37 +02:00
1 parent d9c941d2fc
commit 9e2e37e074
5 files changed
+16 -9

No files matched your search

+2 -2
View File
@@ -2236,7 +2236,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (Unit* owner = m_originalCaster->GetOwner())
caster = owner;
targetInfo.missCondition = caster->SpellHitResult(target, m_spellInfo, m_canReflect && !(m_spellInfo->IsPositive() && m_caster->IsFriendlyTo(target)));
targetInfo.missCondition = caster->SpellHitResult(target, m_spellInfo, m_canReflect && !(m_spellInfo->IsPositive() && m_caster->IsFriendlyTo(target)), effectMask);
if (m_skipCheck && targetInfo.missCondition != SPELL_MISS_IMMUNE)
targetInfo.missCondition = SPELL_MISS_NONE;
}
@@ -2742,7 +2742,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
return SPELL_MISS_EVADE;
// For delayed spells immunity may be applied between missile launch and hit - check immunity for that case
if (m_spellInfo->Speed && unit->IsImmunedToSpell(m_spellInfo, m_caster))
if (m_spellInfo->Speed && unit->IsImmunedToSpell(m_spellInfo, m_caster, effectMask))
return SPELL_MISS_IMMUNE;
// disable effects to which unit is immune