From 0f4442c63064a184a5a5a38f55d7f01b80d8b8f9 Mon Sep 17 00:00:00 2001 From: Alan Deutscher Date: Fri, 30 Sep 2022 11:33:04 +0200 Subject: [PATCH] Core/Auras: Do not remove auras unaffected by invincibility * Mark WSG's Focused Assault and Brutal Assault as unaffected by immunities --- src/server/game/Entities/Unit/Unit.cpp | 1 + src/server/game/Spells/SpellInfo.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d807221fa7..0dea0cc2d1 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7371,6 +7371,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, WorldObject const* caste continue; SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second); + // Consider the school immune if any of these conditions are not satisfied. // In case of no immuneSpellInfo, ignore that condition and check only the other conditions if ((immuneSpellInfo && !immuneSpellInfo->IsPositive()) || !spellInfo->IsPositive() || !caster || !IsFriendlyTo(caster)) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index ecb2838870..2b3fd1a7d6 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -3150,7 +3150,11 @@ void SpellInfo::ApplyAllSpellImmunitiesTo(Unit* target, uint8 effIndex, bool app { target->ApplySpellImmune(Id, IMMUNITY_STATE, auraType, apply); if (apply && HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT)) - target->RemoveAurasByType(auraType); + target->RemoveAurasByType(auraType, [](AuraApplication const* aurApp) -> bool + { + // if the aura has SPELL_ATTR0_NO_IMMUNITIES, then it cannot be removed by immunity + return !aurApp->GetBase()->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES); + }); } for (SpellEffects effectType : immuneInfo->SpellEffectImmune)