fix(Core/Spells): Fix movement impairment auras not being removed (#19684)

This commit is contained in:
Andrew
2024-08-22 15:09:43 -03:00
committed by GitHub
parent 7037108e9c
commit c0b6eae0e1
3 changed files with 11 additions and 6 deletions

View File

@@ -5185,17 +5185,12 @@ void Unit::RemoveMovementImpairingAuras(bool withRoot)
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
{
Aura const* aura = iter->second->GetBase();
if (aura->GetSpellInfo()->Mechanic == MECHANIC_SNARE)
if (aura->GetSpellInfo()->Mechanic == MECHANIC_SNARE || aura->GetSpellInfo()->HasEffectMechanic(MECHANIC_SNARE))
{
RemoveAura(iter);
continue;
}
// Xinef: turn off snare auras by setting amount to 0 :)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (((1 << i) & iter->second->GetEffectMask()) && aura->GetSpellInfo()->Effects[i].Mechanic == MECHANIC_SNARE)
aura->GetEffect(i)->ChangeAmount(0);
++iter;
}
}

View File

@@ -880,6 +880,15 @@ bool SpellInfo::HasEffect(SpellEffects effect) const
return false;
}
bool SpellInfo::HasEffectMechanic(Mechanics mechanic) const
{
for (auto const& effect : Effects)
if (effect.Mechanic == mechanic)
return true;
return false;
}
bool SpellInfo::HasAura(AuraType aura) const
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)

View File

@@ -407,6 +407,7 @@ public:
uint32 GetCategory() const;
bool HasEffect(SpellEffects effect) const;
bool HasEffectMechanic(Mechanics mechanic) const;
bool HasAura(AuraType aura) const;
bool HasAnyAura() const;
bool HasAreaAuraEffect() const;