fix(Core/Unit): prevent self-immunity in IsImmunedToSpell (#25984)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -954,6 +954,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, uint32 effectMask, Unit
|
|||||||
for (auto const& [immunitySchoolMask, immunityAuraId] : schoolList)
|
for (auto const& [immunitySchoolMask, immunityAuraId] : schoolList)
|
||||||
{
|
{
|
||||||
SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(immunityAuraId);
|
SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(immunityAuraId);
|
||||||
|
if (immunityAuraId == spellInfo->Id)
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((immunitySchoolMask & schoolMask) != schoolMask)
|
if ((immunitySchoolMask & schoolMask) != schoolMask)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -10087,6 +10090,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
|||||||
SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
||||||
for (auto itr = schoolList.begin(); itr != schoolList.end(); ++itr)
|
for (auto itr = schoolList.begin(); itr != schoolList.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
if (itr->second == spellInfo->Id)
|
||||||
|
continue;
|
||||||
|
|
||||||
SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second);
|
SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second);
|
||||||
if (!(itr->first & spellSchoolMask))
|
if (!(itr->first & spellSchoolMask))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user