From 1cccafbe0c1ca2bb653cefff0fddb5566e33d795 Mon Sep 17 00:00:00 2001 From: sogladev Date: Thu, 28 May 2026 08:17:39 +0200 Subject: [PATCH] fix(Core/Unit): prevent self-immunity in IsImmunedToSpell (#25984) Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/server/game/Entities/Unit/Unit.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5a6652e631..d02ed9d536 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -954,6 +954,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, uint32 effectMask, Unit for (auto const& [immunitySchoolMask, immunityAuraId] : schoolList) { SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(immunityAuraId); + if (immunityAuraId == spellInfo->Id) + continue; + if ((immunitySchoolMask & schoolMask) != schoolMask) continue; @@ -10087,6 +10090,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell) SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (auto itr = schoolList.begin(); itr != schoolList.end(); ++itr) { + if (itr->second == spellInfo->Id) + continue; + SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second); if (!(itr->first & spellSchoolMask)) continue;