aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp40
-rw-r--r--src/game/SpellAuras.h3
2 files changed, 20 insertions, 23 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 7bfc87cc49d..eed34712d93 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -414,8 +414,8 @@ m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_aura
else
m_partAuras[i]=CreateAuraEffect(this, i, NULL , caster);
// correct flags if aura couldn't be created
- //if (!m_partAuras[i])
- //m_auraFlags &= (~(uint8(1) << i));
+ if (!m_partAuras[i])
+ m_auraFlags &= uint8(~(uint8(1) << i));
}
else
{
@@ -628,12 +628,12 @@ void Aura::Update(uint32 diff)
if (caster->GetHealth()>manaPerSecond)
caster->ModifyHealth(-manaPerSecond);
else
- m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
+ RemoveAura();
}
else if (caster->GetPower(powertype)>=manaPerSecond)
caster->ModifyPower(powertype,-manaPerSecond);
else
- m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
+ RemoveAura();
}
}
}
@@ -645,7 +645,7 @@ void Aura::Update(uint32 diff)
Unit* caster = GetCaster();
if(!caster)
{
- m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
+ RemoveAura();
return;
}
// Get spell range
@@ -671,7 +671,7 @@ void Aura::Update(uint32 diff)
if(!caster->IsWithinDistInMap(m_target,radius))
{
- m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
+ RemoveAura();
return;
}
}
@@ -758,7 +758,7 @@ void AreaAuraEffect::Update(uint32 diff)
//if(actualSpellInfo != GetSpellProto())
// actualBasePoints = actualSpellInfo->EffectBasePoints[m_effIndex];
Aura * aur = (*tIter)->AddAuraEffect(actualSpellInfo->Id, GetEffIndex(), caster);
- aur->SetAuraDuration(aur->GetAuraDuration());
+ RemoveParentAura();
if(m_areaAuraType == AREA_AURA_ENEMY)
caster->CombatStart(*tIter);
@@ -788,7 +788,7 @@ void AreaAuraEffect::Update(uint32 diff)
caster->IsFriendlyTo(tmp_target) != needFriendly
)
{
- GetParentAura()->SetAuraDuration(0);
+ GetParentAura()->RemoveAura();
}
else if (!caster->IsWithinDistInMap(tmp_target, m_radius))
{
@@ -796,10 +796,10 @@ void AreaAuraEffect::Update(uint32 diff)
{
m_removeTime -= diff;
if (m_removeTime < 0)
- GetParentAura()->SetAuraDuration(0);
+ GetParentAura()->RemoveAura();
}
else
- GetParentAura()->SetAuraDuration(0);
+ GetParentAura()->RemoveAura();
}
else
{
@@ -808,17 +808,17 @@ void AreaAuraEffect::Update(uint32 diff)
if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group
{
if(!tmp_target->IsInPartyWith(caster))
- GetParentAura()->SetAuraDuration(0);
+ GetParentAura()->RemoveAura();
}
else if( m_areaAuraType == AREA_AURA_RAID)
{
if(!tmp_target->IsInRaidWith(caster))
- GetParentAura()->SetAuraDuration(0);
+ GetParentAura()->RemoveAura();
}
else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER )
{
if( tmp_target->GetGUID() != caster->GetCharmerOrOwnerGUID() )
- GetParentAura()->SetAuraDuration(0);
+ GetParentAura()->RemoveAura();
}
}
}
@@ -845,16 +845,10 @@ void PersistentAreaAuraEffect::Update(uint32 diff)
else
remove = true;
- Unit *tmp_target = m_target;
- uint32 tmp_id = GetId();
- uint64 tmp_guid = GetCasterGUID();
+ if(remove)
+ GetParentAura()->RemoveAura();
- // WARNING: the aura may get deleted during the update
- // DO NOT access its members after update!
AuraEffect::Update(diff);
-
- if(remove)
- GetParentAura()->SetAuraDuration(0);
}
void AuraEffect::ApplyModifier(bool apply, bool Real)
@@ -1073,7 +1067,7 @@ void Aura::_AddAura()
bool Aura::SetPartAura(AuraEffect* aurEff, uint8 effIndex)
{
- if (m_auraFlags & 1<<effIndex)
+ if (m_auraFlags & (1<<effIndex))
return false;
m_auraFlags |= 1<<effIndex;
m_partAuras[effIndex]=aurEff;
@@ -1243,7 +1237,7 @@ void Aura::SetAuraDuration(int32 duration)
m_duration = duration;
//if (duration<0)
//m_permanent=true;
- // else
+ //else
//m_permanent=false;
SendAuraUpdate();
}
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index d43424a31bf..9ef35965937 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -92,6 +92,8 @@ class TRINITY_DLL_SPEC Aura
void SetNegative() { m_positive = false; }
void SetPositive() { m_positive = true; }
bool IsPermanent() const { return m_permanent; }
+ void RemoveAura() { m_permanent = false; m_duration=0; }
+
bool IsPassive() const { return m_isPassive; }
bool IsDeathPersistent() const { return m_isDeathPersist; }
bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
@@ -353,6 +355,7 @@ class TRINITY_DLL_SPEC AuraEffect
int32 GetAmount() const {return m_amount;}
void SetAmount(int32 amount) { m_amount = amount; }
void CleanupTriggeredSpells();
+ bool RemoveParentAura();
protected:
AuraEffect (Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit * caster,Item * castItem);