aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 472af90c9ed..ab7f0eac759 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -703,21 +703,12 @@ void Aura::Update(uint32 diff, Unit* caster)
if (int32(caster->GetHealth()) > manaPerSecond)
caster->ModifyHealth(-manaPerSecond);
else
- {
Remove();
- return;
- }
}
+ else if (int32(caster->GetPower(powertype)) >= manaPerSecond)
+ caster->ModifyPower(powertype, -manaPerSecond);
else
- {
- if (int32(caster->GetPower(powertype)) >= manaPerSecond)
- caster->ModifyPower(powertype, -manaPerSecond);
- else
- {
- Remove();
- return;
- }
- }
+ Remove();
}
}
}
@@ -743,17 +734,17 @@ int32 Aura::CalcMaxDuration(Unit* caster) const
// IsPermanent() checks max duration (which we are supposed to calculate here)
if (maxDuration != -1 && modOwner)
modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration);
+
return maxDuration;
}
void Aura::SetDuration(int32 duration, bool withMods)
{
if (withMods)
- {
if (Unit* caster = GetCaster())
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, duration);
- }
+
m_duration = duration;
SetNeedClientUpdateForTargets();
}
@@ -808,6 +799,7 @@ void Aura::SetCharges(uint8 charges)
{
if (m_procCharges == charges)
return;
+
m_procCharges = charges;
m_isUsingCharges = m_procCharges != 0;
SetNeedClientUpdateForTargets();
@@ -822,6 +814,7 @@ uint8 Aura::CalcMaxCharges(Unit* caster) const
if (caster)
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, maxProcCharges);
+
return uint8(maxProcCharges);
}
@@ -844,6 +837,7 @@ bool Aura::ModCharges(int32 num, AuraRemoveMode removeMode)
SetCharges(charges);
}
+
return false;
}
@@ -912,6 +906,7 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode)
if (SpellModifier* mod = aurEff->GetSpellModifier())
mod->charges = GetCharges();
}
+
SetNeedClientUpdateForTargets();
return false;
}
@@ -927,10 +922,8 @@ bool Aura::HasMoreThanOneEffectForType(AuraType auraType) const
{
uint32 count = 0;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (HasEffect(i) && GetSpellInfo()->Effects[i].ApplyAuraName == auraType)
+ if (HasEffect(i) && AuraType(GetSpellInfo()->Effects[i].ApplyAuraName) == auraType)
++count;
- }
return count > 1;
}
@@ -938,10 +931,9 @@ bool Aura::HasMoreThanOneEffectForType(AuraType auraType) const
bool Aura::IsArea() const
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
if (HasEffect(i) && GetSpellInfo()->Effects[i].IsAreaAuraEffect())
return true;
- }
+
return false;
}