diff options
author | QAston <none@none> | 2009-05-23 11:26:08 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-05-23 11:26:08 +0200 |
commit | 73faabbc491e72c4189f15c62546cdecf0f6bd39 (patch) | |
tree | c3fbfd448ba1a17b9697b381962209282201d9fb | |
parent | 4d9bce3270c52d654a9f43da585f138c696d4053 (diff) |
*Fix a crash.
--HG--
branch : trunk
-rw-r--r-- | src/game/SpellAuras.cpp | 12 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 6 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c0c64bd8181..e0c6184d695 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -848,7 +848,7 @@ void AuraEffect::ApplyModifier(bool apply, bool Real, bool changeAmount) (*this.*AuraHandler [m_auraName])(apply,Real, changeAmount); } -void AuraEffect::RecalculateAmount() +void AuraEffect::RecalculateAmount(bool applied) { Unit *caster = GetParentAura()->GetCaster(); int32 amount = GetParentAura()->GetStackAmount() * caster->CalculateSpellDamage(m_spellProto, GetEffIndex(), GetBasePoints(), m_target); @@ -856,9 +856,11 @@ void AuraEffect::RecalculateAmount() if (amount!=GetAmount()) { // Auras which are applying spellmod should have removed spellmods for real - ApplyModifier(false,false,true); + if (applied) + ApplyModifier(false,false,true); SetAmount(amount); - ApplyModifier(true,false,true); + if (applied) + ApplyModifier(true,false,true); } } @@ -1195,7 +1197,7 @@ void Aura::_RemoveAura() } } -void Aura::SetStackAmount(uint8 stackAmount) +void Aura::SetStackAmount(uint8 stackAmount, bool applied) { if (stackAmount != m_stackAmount) { @@ -1204,7 +1206,7 @@ void Aura::SetStackAmount(uint8 stackAmount) { if (AuraEffect * part = GetPartAura(i)) { - part->RecalculateAmount(); + part->RecalculateAmount(applied); } } } diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index a760b765878..a391f65407d 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -82,7 +82,7 @@ class TRINITY_DLL_SPEC Aura uint32 GetProcDamage() const { return m_procDamage; } int8 GetStackAmount() const {return m_stackAmount;} - void SetStackAmount(uint8 num); + void SetStackAmount(uint8 num, bool applied = true); bool modStackAmount(int32 num); // return true if last charge dropped uint32 GetAuraStateMask(){return m_auraStateMask;} void SetAuraState(uint8 num){m_auraStateMask |= 1<<(num-1);} //modifies auras' aura state (not unit!) @@ -172,7 +172,7 @@ class TRINITY_DLL_SPEC AuraEffect { public: friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit * formalCaster); - friend void Aura::SetStackAmount(uint8 stackAmount); + friend void Aura::SetStackAmount(uint8 stackAmount, bool applied); //aura handlers void HandleNULL(bool, bool, bool) { @@ -351,7 +351,7 @@ class TRINITY_DLL_SPEC AuraEffect bool isAffectedOnSpell(SpellEntry const *spell) const; void ApplyModifier(bool apply, bool Real = false, bool changeAmount=false); - void RecalculateAmount(); + void RecalculateAmount(bool applied = true); void HandleAuraEffect(bool apply); void ApplyAllModifiers(bool apply, bool Real); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f718fc3e8f7..cce161acaae 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3818,7 +3818,7 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects) uint8 stackAmount = foundAura->GetStackAmount() + 1; if (stackAmount > aurSpellInfo->StackAmount) stackAmount = aurSpellInfo->StackAmount; - Aur->SetStackAmount(stackAmount); + Aur->SetStackAmount(stackAmount, false); RemoveAura(foundAura, AURA_REMOVE_BY_STACK); return true; } |