aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellAuras.cpp
diff options
context:
space:
mode:
authorQAston <none@none>2009-06-06 08:32:14 +0200
committerQAston <none@none>2009-06-06 08:32:14 +0200
commitc99b74151727a081423c60d3f42f1bd6caf4cc7e (patch)
tree61d45f78cdd770e10a81c32a7f938e725b72d78d /src/game/SpellAuras.cpp
parent8bc46785de9950218f791f9eb6efc598d1a97d29 (diff)
parent39548d6822ce2a8cea49e4467f8329335aa0d85d (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/SpellAuras.cpp')
-rw-r--r--src/game/SpellAuras.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 0d4606e6e84..dae7436e599 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -623,6 +623,8 @@ Unit* AuraEffect::GetSource() const
void Aura::Update(uint32 diff)
{
+ // TODO: store pointer to caster in aura class for update/mod handling code
+
if (m_duration > 0)
{
m_duration -= diff;
@@ -666,9 +668,23 @@ void Aura::Update(uint32 diff)
}
}
+ // Apply charged spellmods for channeled auras
+ // used for example when triggered spell of spell:10 is modded
+ Spell * modSpell = NULL;
+ Unit* caster = NULL;
+ if (IS_PLAYER_GUID(GetCasterGUID())
+ {
+ caster = GetCaster();
+ modSpell = ((Player*)caster)->FindCurrentSpellBySpellId(GetId());
+ if (caster)
+ ((Player*)caster)->SetSpellModTakingSpell(modSpell, true);
+ }
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_partAuras[i])
m_partAuras[i]->Update(diff);
+
+ if (caster)
+ ((Player*)caster)->SetSpellModTakingSpell(modSpell, false);
}
void AuraEffect::Update(uint32 diff)
@@ -1295,15 +1311,19 @@ void Aura::SetAuraCharges(uint8 charges)
SendAuraUpdate();
}
-void Aura::DropAuraCharge()
+bool Aura::DropAuraCharge()
{
if(m_procCharges) //auras without charges always have charge = 0
{
if(--m_procCharges) // Send charge change
SendAuraUpdate();
else // Last charge dropped
+ {
m_target->RemoveAura(this, AURA_REMOVE_BY_EXPIRE);
+ return true;
+ }
}
+ return false;
}
bool Aura::IsPersistent() const
@@ -1533,7 +1553,7 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real, bool changeAmount)
if (apply)
{
- SpellModifier *mod = new SpellModifier;
+ SpellModifier *mod = new SpellModifier(GetParentAura());
mod->op = SpellModOp(modOp);
mod->value = m_amount;
mod->type = SpellModType(m_auraName); // SpellModType value == spell aura types