Core/Auras: Registering a new owned aura will now search existing owned auras instead of applied auras to check for unstackable one

This commit is contained in:
Shauren authored and Ovahlord committed 2023-10-18 21:43:46 +02:00
1 parent 7bc8e31be0
commit 77c017555b
2 files changed
+8 -21

No files matched your search

+7 -20
View File
@@ -3042,7 +3042,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;
@@ -3136,7 +3136,7 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask)
{
Aura* aura = aurApp->GetBase();
_RemoveNoStackAurasDueToAura(aura);
_RemoveNoStackAurasDueToAura(aura, false);
if (aurApp->GetRemoveMode().HasAnyFlag())
return;
@@ -3283,7 +3283,7 @@ void Unit::_UnapplyAura(AuraApplication* aurApp, AuraRemoveFlags removeMode)
ABORT();
}
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura, bool owned)
{
SpellInfo const* spellProto = aura->GetSpellInfo();
@@ -3297,23 +3297,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, AuraRemoveFlags::ByDefault);
if (i == m_appliedAuras.end())
break;
remove = true;
}
if (owned)
RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); }, AuraRemoveFlags::ByDefault);
else
RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); }, AuraRemoveFlags::ByDefault);
}
void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)
+1 -1
View File
@@ -1283,7 +1283,7 @@ class TC_GAME_API Unit : public WorldObject
void _ApplyAura(AuraApplication* aurApp, uint8 effMask);
void _UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveFlags removeMode);
void _UnapplyAura(AuraApplication* aurApp, AuraRemoveFlags removeMode);
void _RemoveNoStackAurasDueToAura(Aura* aura);
void _RemoveNoStackAurasDueToAura(Aura* aura, bool owned);
void _RegisterAuraEffect(AuraEffect* aurEff, bool apply);
// m_ownedAuras container management