Skip to content

Commit

Permalink
Core/Spells: Fix dispelling movement impairing auras by PvP-trinket a…
Browse files Browse the repository at this point in the history
…nd similar spells. (TrinityCore#29966)
  • Loading branch information
r4d1sh authored May 26, 2024
1 parent 623180a commit 45c579e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/server/game/Spells/SpellInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ struct SpellEffectInfo::ImmunityInfo
uint32 MechanicImmuneMask = 0;
uint32 DispelImmune = 0;
uint32 DamageSchoolMask = 0;
bool RemoveEffectsWithMechanic = false;

Trinity::Containers::FlatSet<AuraType> AuraTypeImmune;
Trinity::Containers::FlatSet<SpellEffects> SpellEffectImmune;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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:
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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<Aura*> aurasToUpdateTargets;
target->RemoveAppliedAuras([mechanicImmunity, &aurasToUpdateTargets](AuraApplication const* aurApp)
Expand Down

0 comments on commit 45c579e

Please sign in to comment.