mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Core/Auras: Registering a new owned aura will now search existing owned auras instead of applied auras to check for unstackable one
Closes #22234
(cherry picked from commit dc661a34b1)
This commit is contained in:
@@ -3269,7 +3269,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
|
||||
ASSERT(!m_cleanupDone);
|
||||
m_ownedAuras.emplace(aura->GetId(), aura);
|
||||
|
||||
_RemoveNoStackAurasDueToAura(aura);
|
||||
_RemoveNoStackAurasDueToAura(aura, true);
|
||||
|
||||
if (aura->IsRemoved())
|
||||
return;
|
||||
@@ -3363,7 +3363,7 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask)
|
||||
{
|
||||
Aura* aura = aurApp->GetBase();
|
||||
|
||||
_RemoveNoStackAurasDueToAura(aura);
|
||||
_RemoveNoStackAurasDueToAura(aura, false);
|
||||
|
||||
if (aurApp->GetRemoveMode())
|
||||
return;
|
||||
@@ -3517,7 +3517,7 @@ void Unit::_UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode)
|
||||
ABORT();
|
||||
}
|
||||
|
||||
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
|
||||
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura, bool owned)
|
||||
{
|
||||
SpellInfo const* spellProto = aura->GetSpellInfo();
|
||||
|
||||
@@ -3531,23 +3531,10 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
|
||||
return;
|
||||
}
|
||||
|
||||
bool remove = false;
|
||||
for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
|
||||
{
|
||||
if (remove)
|
||||
{
|
||||
remove = false;
|
||||
i = m_appliedAuras.begin();
|
||||
}
|
||||
|
||||
if (aura->CanStackWith(i->second->GetBase()))
|
||||
continue;
|
||||
|
||||
RemoveAura(i, AURA_REMOVE_BY_DEFAULT);
|
||||
if (i == m_appliedAuras.end())
|
||||
break;
|
||||
remove = true;
|
||||
}
|
||||
if (owned)
|
||||
RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); }, AURA_REMOVE_BY_DEFAULT);
|
||||
else
|
||||
RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); }, AURA_REMOVE_BY_DEFAULT);
|
||||
}
|
||||
|
||||
void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)
|
||||
|
||||
@@ -1320,7 +1320,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void _ApplyAura(AuraApplication* aurApp, uint8 effMask);
|
||||
void _UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMode);
|
||||
void _UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode);
|
||||
void _RemoveNoStackAurasDueToAura(Aura* aura);
|
||||
void _RemoveNoStackAurasDueToAura(Aura* aura, bool owned);
|
||||
void _RegisterAuraEffect(AuraEffect* aurEff, bool apply);
|
||||
|
||||
// m_ownedAuras container management
|
||||
|
||||
Reference in New Issue
Block a user