From 84e46d76e3cd344c370433f8375a6dd73abd33d3 Mon Sep 17 00:00:00 2001 From: ApoC Date: Mon, 6 Jul 2009 00:03:51 +0200 Subject: [PATCH] [8136] Fixed aura refresh on modify stack by negative amount. When decreasing stack amount of aura, aura should not be refreshed to full time. This should only happen on increasing stack. Signed-off-by: ApoC --- src/game/SpellAuras.cpp | 39 ++++++++++++++++++++++++--------------- src/shared/revision_nr.h | 2 +- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 67ece8a60..a1cb7643d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1178,23 +1178,32 @@ void Aura::SendAuraUpdate(bool remove) void Aura::SetStackAmount(uint8 stackAmount) { - if (stackAmount != m_stackAmount) + if (stackAmount == m_stackAmount) + // Nothing changed + return; + + Unit *target = GetTarget(); + Unit *caster = GetCaster(); + if (!target || !caster) + return; + + bool refresh = stackAmount > m_stackAmount; + m_stackAmount = stackAmount; + int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target); + // Reapply if amount change + if (amount!=m_modifier.m_amount) { - Unit *target = GetTarget(); - Unit *caster = GetCaster(); - if (!target || !caster) - return; - m_stackAmount = stackAmount; - int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target); - // Reapply if amount change - if (amount!=m_modifier.m_amount) - { - ApplyModifier(false, true); - m_modifier.m_amount = amount; - ApplyModifier(true, true); - } + ApplyModifier(false, true); + m_modifier.m_amount = amount; + ApplyModifier(true, true); } - RefreshAura(); + + if (refresh) + // Stack increased refresh duration + RefreshAura(); + else + // Stack decreased only send update + SendAuraUpdate(false); } bool Aura::modStackAmount(int32 num) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 23a9a6ad7..182d6e4c6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8135" + #define REVISION_NR "8136" #endif // __REVISION_NR_H__