[8295] Remove single target auras at caster/target shift to not accessable phase. Author: VladimirMangos
This must fix another source of "Couldn't find the caster of the single target aura" errors. --HG-- branch : trunk
This commit is contained in:
+21
-4
@@ -4174,13 +4174,24 @@ void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::RemoveNotOwnSingleTargetAuras()
|
void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
||||||
{
|
{
|
||||||
// single target auras from other casters
|
// single target auras from other casters
|
||||||
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
|
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
|
||||||
{
|
{
|
||||||
if (iter->second->GetCasterGUID()!=GetGUID() && IsSingleTargetSpell(iter->second->GetSpellProto()))
|
if (iter->second->GetCasterGUID()!=GetGUID() && IsSingleTargetSpell(iter->second->GetSpellProto()))
|
||||||
|
{
|
||||||
|
if(!newPhase)
|
||||||
RemoveAura(iter);
|
RemoveAura(iter);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Unit* caster = iter->second->GetCaster();
|
||||||
|
if(!caster || !caster->InSamePhase(newPhase))
|
||||||
|
RemoveAura(iter);
|
||||||
|
else
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
@@ -4189,12 +4200,12 @@ void Unit::RemoveNotOwnSingleTargetAuras()
|
|||||||
AuraList& scAuras = GetSingleCastAuras();
|
AuraList& scAuras = GetSingleCastAuras();
|
||||||
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
|
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
|
||||||
{
|
{
|
||||||
Aura * aur=*iter;
|
Aura * aura=*iter;
|
||||||
++iter;
|
++iter;
|
||||||
if (aur->GetTarget()!=this)
|
if (aura->GetTarget() != this && !aura->GetTarget()->InSamePhase(newPhase))
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAurasCount;
|
uint32 removedAuras = m_removedAurasCount;
|
||||||
aur->GetTarget()->RemoveAura(aur->GetId(),aur->GetCasterGUID());
|
aura->GetTarget()->RemoveAura(aura->GetId(),aura->GetCasterGUID());
|
||||||
if (removedAuras+1<m_removedAurasCount)
|
if (removedAuras+1<m_removedAurasCount)
|
||||||
iter=scAuras.begin();
|
iter=scAuras.begin();
|
||||||
}
|
}
|
||||||
@@ -14837,6 +14848,12 @@ float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType,
|
|||||||
|
|
||||||
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||||
{
|
{
|
||||||
|
if(newPhaseMask==GetPhaseMask())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(IsInWorld())
|
||||||
|
RemoveNotOwnSingleTargetAuras(newPhaseMask); // we can lost access to caster or target
|
||||||
|
|
||||||
WorldObject::SetPhaseMask(newPhaseMask,update);
|
WorldObject::SetPhaseMask(newPhaseMask,update);
|
||||||
|
|
||||||
if(!IsInWorld())
|
if(!IsInWorld())
|
||||||
|
|||||||
+4
-1
@@ -1450,7 +1450,10 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
|
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
|
||||||
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except=NULL, bool negative = true, bool positive = true);
|
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except=NULL, bool negative = true, bool positive = true);
|
||||||
void RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell = NULL);
|
void RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell = NULL);
|
||||||
void RemoveNotOwnSingleTargetAuras();
|
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
|
||||||
|
|
||||||
|
void RemoveSpellsCausingAura(AuraType auraType);
|
||||||
|
void RemoveRankAurasDueToSpell(uint32 spellId);
|
||||||
bool RemoveNoStackAurasDueToAura(Aura *Aur);
|
bool RemoveNoStackAurasDueToAura(Aura *Aur);
|
||||||
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = NULL);
|
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = NULL);
|
||||||
void RemoveAurasWithFamily(uint32 family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID);
|
void RemoveAurasWithFamily(uint32 family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID);
|
||||||
|
|||||||
Reference in New Issue
Block a user