* Make sure that aura is applied on unit before trying to remove it.
--HG-- branch : trunk
This commit is contained in:
@@ -428,16 +428,17 @@ void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||
// remove auras with duration lower than 30s
|
||||
Unit::AuraMap & auraMap = plr->GetOwnedAuras();
|
||||
for (Unit::AuraMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
|
||||
Unit::AuraApplicationMap & auraMap = plr->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
|
||||
{
|
||||
Aura * aura = iter->second;
|
||||
AuraApplication * aurApp = iter->second;
|
||||
Aura * aura = aurApp->GetBase();
|
||||
if (!aura->IsPermanent()
|
||||
&& aura->GetDuration() <= 30*IN_MILISECONDS
|
||||
&& aura->IsPositive(plr)
|
||||
&& aurApp->IsPositive()
|
||||
&& (!(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
||||
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
|
||||
plr->RemoveOwnedAura(iter);
|
||||
plr->RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
|
||||
@@ -157,10 +157,6 @@ class TRINITY_DLL_SPEC Aura
|
||||
AuraApplication * GetApplicationOfTarget (uint64 const & guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
|
||||
bool IsAppliedOnTarget (uint64 const & guid) const { return m_applications.find(guid) != m_applications.end(); }
|
||||
|
||||
bool IsPositive(Unit * const target) const { return (GetApplicationOfTarget(target->GetGUID()))->IsPositive(); }
|
||||
bool GetEffectMask(Unit * const target) const { return (GetApplicationOfTarget(target->GetGUID()))->GetEffectMask(); }
|
||||
uint8 GetSlot(Unit * const target) const { return (GetApplicationOfTarget(target->GetGUID()))->GetSlot(); }
|
||||
bool HasEffect(Unit * const target, uint8 eff) const { return (GetApplicationOfTarget(target->GetGUID()))->HasEffect(eff); }
|
||||
void SetNeedClientUpdateForTargets() const;
|
||||
void HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, bool apply);
|
||||
private:
|
||||
|
||||
@@ -3742,11 +3742,15 @@ void Spell::EffectDispel(uint32 i)
|
||||
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
{
|
||||
Aura * aura = itr->second;
|
||||
AuraApplication * aurApp = aura->GetApplicationOfTarget(unitTarget->GetGUID());
|
||||
if (!aurApp)
|
||||
continue;
|
||||
|
||||
if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
|
||||
{
|
||||
if(aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
|
||||
{
|
||||
bool positive = aura->IsPositive(unitTarget) ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_NEGATIVE)) : false;
|
||||
bool positive = aurApp->IsPositive() ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_NEGATIVE)) : false;
|
||||
|
||||
// do not remove positive auras if friendly target
|
||||
// negative auras if non-friendly target
|
||||
@@ -6812,10 +6816,12 @@ void Spell::EffectDispelMechanic(uint32 i)
|
||||
|
||||
std::queue < std::pair < uint32, uint64 > > dispel_list;
|
||||
|
||||
Unit::AuraMap& Auras = unitTarget->GetOwnedAuras();
|
||||
for (Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); iter++)
|
||||
Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
|
||||
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
{
|
||||
Aura * aura = iter->second;
|
||||
Aura * aura = itr->second;
|
||||
if (!aura->GetApplicationOfTarget(unitTarget->GetGUID()))
|
||||
continue;
|
||||
if((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1<<(mechanic))) && GetDispelChance(aura->GetCaster(), aura->GetId()))
|
||||
{
|
||||
dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID() ) );
|
||||
@@ -7173,10 +7179,14 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
|
||||
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
{
|
||||
Aura * aura = itr->second;
|
||||
AuraApplication * aurApp = aura->GetApplicationOfTarget(unitTarget->GetGUID());
|
||||
if (!aurApp)
|
||||
continue;
|
||||
|
||||
if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
|
||||
{
|
||||
// Need check for passive? this
|
||||
if (!aura->IsPositive(unitTarget) || aura->IsPassive() || aura->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_NOT_STEALABLE)
|
||||
if (!aurApp->IsPositive() || aura->IsPassive() || aura->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_NOT_STEALABLE)
|
||||
continue;
|
||||
|
||||
bool dispel_charges = aura->GetSpellProto()->AttributesEx7 & SPELL_ATTR_EX7_DISPEL_CHARGES;
|
||||
|
||||
+8
-7
@@ -2210,9 +2210,9 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
||||
{
|
||||
// Get total damage bonus from auras
|
||||
int32 current_dmg = 0;
|
||||
std::pair<AuraMap::const_iterator, AuraMap::const_iterator> range = pVictim->GetOwnedAuras().equal_range(44413);
|
||||
for (AuraMap::const_iterator iter = range.first; iter != range.second; ++iter)
|
||||
if (AuraEffect const * bonusEff = iter->second->GetEffect(0))
|
||||
std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> range = pVictim->GetAppliedAuras().equal_range(44413);
|
||||
for (AuraApplicationMap::const_iterator iter = range.first; iter != range.second; ++iter)
|
||||
if (AuraEffect const * bonusEff = iter->second->GetBase()->GetEffect(0))
|
||||
current_dmg += bonusEff->GetAmount();
|
||||
|
||||
int32 new_dmg = (int32)*absorb * aurEff->GetAmount() / 100;
|
||||
@@ -4292,14 +4292,15 @@ void Unit::RemoveArenaAuras(bool onleave)
|
||||
{
|
||||
// in join, remove positive buffs, on end, remove negative
|
||||
// used to remove positive visible auras in arenas
|
||||
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
|
||||
{
|
||||
Aura const * aura = iter->second;
|
||||
AuraApplication const * aurApp = iter->second;
|
||||
Aura const * aura = aurApp->GetBase();
|
||||
if ( !(aura->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras
|
||||
&& !aura->IsPassive() // don't remove passive auras
|
||||
&& (!(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) || !(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNK8)) // not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable)
|
||||
&& (aura->IsPositive(this) ^ onleave)) // remove positive buffs on enter, negative buffs on leave
|
||||
RemoveOwnedAura(iter);
|
||||
&& (aurApp->IsPositive() ^ onleave)) // remove positive buffs on enter, negative buffs on leave
|
||||
RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user