aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorLiberate <tbaart@gmail.com>2011-10-18 23:27:39 +0200
committerLiberate <tbaart@gmail.com>2011-10-18 23:27:39 +0200
commit89bae3b51c5208931bb3b409f8092e07c55b80e3 (patch)
tree9930536057d02cb16abe5bedb931c5cb0624c1f9 /src/server/game/Entities/Unit
parentfd45c111b05e4f9b34db11330d7876b093e801fb (diff)
Core/Spells: Add a new stack rule for spellgroups: SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT
This stack rule makes the effects of the spells in the spellgroup non-stackable, but the spells/auras itself are stackable. a spell should be in only 1 group with this stack rule. Fixes #2243
Diffstat (limited to 'src/server/game/Entities/Unit')
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6510d60101e..bb4d92927c8 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4425,14 +4425,26 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask)
float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
{
+ std::map<SpellGroup, int32> SameEffectSpellGroup;
float multiplier = 1.0f;
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
{
- if ((*i)->GetMiscValue()& misc_mask)
- AddPctN(multiplier, (*i)->GetAmount());
+ if (((*i)->GetMiscValue() & misc_mask))
+ {
+ // Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup
+ // If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual
+ if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
+ AddPctN(multiplier, (*i)->GetAmount());
+ }
}
+ // Add the highest of the Same Effect Stack Rule SpellGroups to the multiplier
+ for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
+ {
+ AddPctN(multiplier, itr->second);
+ }
+
return multiplier;
}