From 45c579eb9d1c4c328a2556e22cc01ae9adbf2757 Mon Sep 17 00:00:00 2001 From: Mykhailo Redko Date: Sun, 26 May 2024 18:22:01 +0300 Subject: [PATCH] Core/Spells: Fix dispelling movement impairing auras by PvP-trinket and similar spells. (#29966) --- src/server/game/Spells/SpellInfo.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index c6beaf286663f..d308b1ff0235d 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -227,6 +227,7 @@ struct SpellEffectInfo::ImmunityInfo uint32 MechanicImmuneMask = 0; uint32 DispelImmune = 0; uint32 DamageSchoolMask = 0; + bool RemoveEffectsWithMechanic = false; Trinity::Containers::FlatSet AuraTypeImmune; Trinity::Containers::FlatSet SpellEffectImmune; @@ -2588,6 +2589,7 @@ void SpellInfo::_LoadImmunityInfo() uint32 mechanicImmunityMask = 0; uint32 dispelImmunity = 0; uint32 damageImmunityMask = 0; + bool removeEffectsWithMechanic = false; int32 miscVal = effect.MiscValue; int32 amount = effect.CalcValue(); @@ -2761,11 +2763,13 @@ void SpellInfo::_LoadImmunityInfo() case 59752: // Every Man for Himself mechanicImmunityMask |= IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; immuneInfo.AuraTypeImmune.insert(SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED); + removeEffectsWithMechanic = true; break; case 34471: // The Beast Within case 19574: // Bestial Wrath case 53490: // Bullheaded mechanicImmunityMask |= IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; + removeEffectsWithMechanic = true; break; case 54508: // Demonic Empowerment mechanicImmunityMask |= (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN); @@ -2777,6 +2781,11 @@ void SpellInfo::_LoadImmunityInfo() mechanicImmunityMask |= 1 << miscVal; break; } + + // Special 100 ms duration spells - PvP trinket, Every Man for Himself and some other + if (GetMaxDuration() == 100) + removeEffectsWithMechanic = true; + break; } case SPELL_AURA_EFFECT_IMMUNITY: @@ -2818,6 +2827,7 @@ void SpellInfo::_LoadImmunityInfo() immuneInfo.MechanicImmuneMask = mechanicImmunityMask; immuneInfo.DispelImmune = dispelImmunity; immuneInfo.DamageSchoolMask = damageImmunityMask; + immuneInfo.RemoveEffectsWithMechanic = removeEffectsWithMechanic; immuneInfo.AuraTypeImmune.shrink_to_fit(); immuneInfo.SpellEffectImmune.shrink_to_fit(); @@ -2908,8 +2918,8 @@ void SpellInfo::ApplyAllSpellImmunitiesTo(Unit* target, SpellEffectInfo const& s if (HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)) { if (apply) - target->RemoveAurasWithMechanic(mechanicImmunity, AURA_REMOVE_BY_DEFAULT, Id); - else + target->RemoveAurasWithMechanic(mechanicImmunity, AURA_REMOVE_BY_DEFAULT, Id, immuneInfo->RemoveEffectsWithMechanic); + else if (!immuneInfo->RemoveEffectsWithMechanic) { std::vector aurasToUpdateTargets; target->RemoveAppliedAuras([mechanicImmunity, &aurasToUpdateTargets](AuraApplication const* aurApp)