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:
1 parent
7bc8e31be0
commit
77c017555b
2 files changed
+8
-21
No files matched your search
@@ -3042,7 +3042,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
|
|||||||
ASSERT(!m_cleanupDone);
|
ASSERT(!m_cleanupDone);
|
||||||
m_ownedAuras.emplace(aura->GetId(), aura);
|
m_ownedAuras.emplace(aura->GetId(), aura);
|
||||||
|
|
||||||
_RemoveNoStackAurasDueToAura(aura);
|
_RemoveNoStackAurasDueToAura(aura, true);
|
||||||
|
|
||||||
if (aura->IsRemoved())
|
if (aura->IsRemoved())
|
||||||
return;
|
return;
|
||||||
@@ -3136,7 +3136,7 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask)
|
|||||||
{
|
{
|
||||||
Aura* aura = aurApp->GetBase();
|
Aura* aura = aurApp->GetBase();
|
||||||
|
|
||||||
_RemoveNoStackAurasDueToAura(aura);
|
_RemoveNoStackAurasDueToAura(aura, false);
|
||||||
|
|
||||||
if (aurApp->GetRemoveMode().HasAnyFlag())
|
if (aurApp->GetRemoveMode().HasAnyFlag())
|
||||||
return;
|
return;
|
||||||
@@ -3283,7 +3283,7 @@ void Unit::_UnapplyAura(AuraApplication* aurApp, AuraRemoveFlags removeMode)
|
|||||||
ABORT();
|
ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
|
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura, bool owned)
|
||||||
{
|
{
|
||||||
SpellInfo const* spellProto = aura->GetSpellInfo();
|
SpellInfo const* spellProto = aura->GetSpellInfo();
|
||||||
|
|
||||||
@@ -3297,23 +3297,10 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool remove = false;
|
if (owned)
|
||||||
for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
|
RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); }, AuraRemoveFlags::ByDefault);
|
||||||
{
|
else
|
||||||
if (remove)
|
RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); }, AuraRemoveFlags::ByDefault);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)
|
void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)
|
||||||
|
|||||||
@@ -1283,7 +1283,7 @@ class TC_GAME_API Unit : public WorldObject
|
|||||||
void _ApplyAura(AuraApplication* aurApp, uint8 effMask);
|
void _ApplyAura(AuraApplication* aurApp, uint8 effMask);
|
||||||
void _UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveFlags removeMode);
|
void _UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveFlags removeMode);
|
||||||
void _UnapplyAura(AuraApplication* aurApp, AuraRemoveFlags removeMode);
|
void _UnapplyAura(AuraApplication* aurApp, AuraRemoveFlags removeMode);
|
||||||
void _RemoveNoStackAurasDueToAura(Aura* aura);
|
void _RemoveNoStackAurasDueToAura(Aura* aura, bool owned);
|
||||||
void _RegisterAuraEffect(AuraEffect* aurEff, bool apply);
|
void _RegisterAuraEffect(AuraEffect* aurEff, bool apply);
|
||||||
|
|
||||||
// m_ownedAuras container management
|
// m_ownedAuras container management
|
||||||
|
|||||||
Reference in new issue
Block a user