diff options
| author | Shauren <shauren.trinity@gmail.com> | 2022-09-05 18:22:39 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-09-05 18:22:39 +0200 |
| commit | 3306a4d06cc557967c23adcc60c2e3257811b324 (patch) | |
| tree | ba39127335e73b1af89750fdba18c0329a036146 /src/server/game/Spells/SpellInfo.cpp | |
| parent | f3384fecaa17c2b14bf2089c6813a31f5799a020 (diff) | |
Core/Auras: Improve aura interactions with immunities on spell effect level
* Effects that target is immune to will be suppressed instead of completely removed
Closes #28096
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 88479010f44..cabad3bd6d2 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2855,13 +2855,22 @@ void SpellInfo::ApplyAllSpellImmunitiesTo(Unit* target, uint8 effIndex, bool app if (mechanicImmunity & (1 << i)) target->ApplySpellImmune(Id, IMMUNITY_MECHANIC, i, apply); - if (apply && HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)) + if (HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)) { - // exception for purely snare mechanic (eg. hands of freedom)! - if (mechanicImmunity == (1 << MECHANIC_SNARE)) - target->RemoveMovementImpairingAuras(false); - else + if (apply) target->RemoveAurasWithMechanic(mechanicImmunity, AURA_REMOVE_BY_DEFAULT, Id); + else + { + target->RemoveAppliedAuras([mechanicImmunity](AuraApplication const* aurApp) + { + Aura* aura = aurApp->GetBase(); + if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanicImmunity) + aura->UpdateTargetMap(aura->GetCaster()); + + // only update targets, don't remove anything + return false; + }); + } } } |
