From deaf25c1f41433a45d17fe4a2ac7cfbae2a3ebad Mon Sep 17 00:00:00 2001 From: AlsoNotMehh Date: Wed, 10 Jun 2026 19:06:55 -0400 Subject: [PATCH] fix(Core/Spells): allow friendly auras during Divine Shield (#26052) --- src/server/game/Entities/Unit/Unit.cpp | 28 +++++++++++++-------- src/server/game/Entities/Unit/Unit.h | 2 ++ src/server/game/Spells/Auras/SpellAuras.cpp | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index fa19728a86..3115149357 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10017,7 +10017,12 @@ bool Unit::IsImmunedToAuraPeriodicTick(Unit const* caster, SpellInfo const* spel return false; } -bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell) +bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster) +{ + return IsImmunedToSpell(spellInfo, caster, spellInfo ? spellInfo->GetSchoolMask() : SPELL_SCHOOL_MASK_NONE); +} + +bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster, SpellSchoolMask spellSchoolMask) { if (!spellInfo) return false; @@ -10063,7 +10068,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell) continue; // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell - if (IsImmunedToSpellEffect(spellInfo, i)) + if (IsImmunedToSpellEffect(spellInfo, i, caster)) { if (spellInfo->HasAura(SPELL_AURA_TRANSFORM)) return true; @@ -10078,13 +10083,6 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell) if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES)) { - SpellSchoolMask spellSchoolMask = spellInfo->GetSchoolMask(); - Unit const* spellCaster = spell ? spell->GetCaster() : nullptr; - if (spell) - { - spellSchoolMask = spell->GetSpellSchoolMask(); - } - if (spellSchoolMask != SPELL_SCHOOL_MASK_NONE) { SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; @@ -10097,7 +10095,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell) if (!(itr->first & spellSchoolMask)) continue; - if (IgnoresSchoolImmunityFromFriendlyCaster(spellCaster, itr->second, immuneSpellInfo)) + if (IgnoresSchoolImmunityFromFriendlyCaster(caster, itr->second, immuneSpellInfo)) continue; if (spellInfo->CanPierceImmuneAura(immuneSpellInfo)) @@ -10111,6 +10109,16 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell) return false; } +bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell) +{ + if (!spellInfo) + return false; + + Unit const* spellCaster = spell ? spell->GetCaster() : nullptr; + SpellSchoolMask spellSchoolMask = spell ? spell->GetSpellSchoolMask() : spellInfo->GetSchoolMask(); + return IsImmunedToSpell(spellInfo, spellCaster, spellSchoolMask); +} + bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit const* caster /*= nullptr*/) const { if (!spellInfo || !spellInfo->Effects[index].IsEffect()) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 4144c9ecd6..041ab0beaa 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1637,6 +1637,8 @@ public: // Spells immunities void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType = SPELL_BLOCK_TYPE_ALL); virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell = nullptr); + bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster); + bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster, SpellSchoolMask spellSchoolMask); bool IsImmunedToSpell(SpellInfo const* spellInfo, uint32 effectMask, Unit const* caster = nullptr); bool IgnoresSchoolImmunityFromFriendlyCaster(Unit const* caster, uint32 immunityAuraId, SpellInfo const* immunitySpellInfo) const; [[nodiscard]] bool IsImmunedToDamage(SpellSchoolMask schoolMask) const; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 3ca928b47a..5f2b887f03 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -597,7 +597,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) if ((itr->second & (1 << effIndex)) && itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, GetCaster())) itr->second &= ~(1 << effIndex); } - if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo()) || !CanBeAppliedOn(itr->first)) + if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo(), GetCaster()) || !CanBeAppliedOn(itr->first)) addUnit = false; if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))