From 0485d99e5d0fac0632d218afcc52b23efb15372a Mon Sep 17 00:00:00 2001 From: Xanadu Date: Mon, 28 Jun 2010 05:26:00 +0200 Subject: Fixed periodic damage for stackable auras (Deadly Poison...). Patch by Lyall. Closes issue #1368. --HG-- branch : trunk --- src/server/game/Entities/Unit/Unit.cpp | 12 ++++++++++++ src/server/game/Spells/Auras/SpellAuraEffects.h | 3 +++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c5a6e8440be..3b292e4f7d5 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3496,7 +3496,19 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster) if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), 0, aura)) { if (aura->GetSpellProto()->StackAmount) + { aura->ModStackAmount(foundAura->GetStackAmount()); + + // Update periodic timers from the previous aura + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + AuraEffect *existingEff = foundAura->GetEffect(i); + AuraEffect *newEff = aura->GetEffect(i); + if (!existingEff || !newEff) + continue; + newEff->SetPeriodicTimer(existingEff->GetPeriodicTimer()); + } + } // Use the new one to replace the old one // This is the only place where AURA_REMOVE_BY_STACK should be used diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index c2c99b167e0..d44e73f360f 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -45,6 +45,9 @@ class AuraEffect int32 GetAmount() const { return m_amount; } void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;} + int32 GetPeriodicTimer() const { return m_periodicTimer; } + void SetPeriodicTimer(int32 periodicTimer) { m_periodicTimer = periodicTimer; } + int32 CalculateAmount(Unit * caster); void CalculatePeriodic(Unit * caster, bool create = false); void CalculateSpellMod(); -- cgit v1.2.3