Fixed periodic damage for stackable auras (Deadly Poison...). Patch by Lyall. Closes issue #1368.

--HG--
branch : trunk
This commit is contained in:
Xanadu
2010-06-28 05:26:00 +02:00
parent f4531c5a58
commit 0485d99e5d
2 changed files with 15 additions and 0 deletions
+12
View File
@@ -3496,8 +3496,20 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), 0, aura)) if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), 0, aura))
{ {
if (aura->GetSpellProto()->StackAmount) if (aura->GetSpellProto()->StackAmount)
{
aura->ModStackAmount(foundAura->GetStackAmount()); 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 // Use the new one to replace the old one
// This is the only place where AURA_REMOVE_BY_STACK should be used // This is the only place where AURA_REMOVE_BY_STACK should be used
RemoveOwnedAura(foundAura, AURA_REMOVE_BY_STACK); RemoveOwnedAura(foundAura, AURA_REMOVE_BY_STACK);
@@ -45,6 +45,9 @@ class AuraEffect
int32 GetAmount() const { return m_amount; } int32 GetAmount() const { return m_amount; }
void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;} 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); int32 CalculateAmount(Unit * caster);
void CalculatePeriodic(Unit * caster, bool create = false); void CalculatePeriodic(Unit * caster, bool create = false);
void CalculateSpellMod(); void CalculateSpellMod();