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
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
DELETE FROM `spell_group` WHERE `id` = 1114;
|
||||||
|
INSERT INTO `spell_group` (`id`, `spell_id`) VALUES
|
||||||
|
(1114,1490),
|
||||||
|
(1114,60431),
|
||||||
|
(1114,60432),
|
||||||
|
(1114,60433),
|
||||||
|
(1114,51726),
|
||||||
|
(1114,51734),
|
||||||
|
(1114,51735);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
DELETE FROM `spell_group_stack_rules` WHERE `group_id` = 1114;
|
||||||
|
INSERT INTO `spell_group_stack_rules` (`group_id`, `stack_rule`) VALUES
|
||||||
|
(1114,3);
|
||||||
@@ -4425,14 +4425,26 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask)
|
|||||||
|
|
||||||
float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
|
float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
|
||||||
{
|
{
|
||||||
|
std::map<SpellGroup, int32> SameEffectSpellGroup;
|
||||||
float multiplier = 1.0f;
|
float multiplier = 1.0f;
|
||||||
|
|
||||||
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
|
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
|
||||||
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
|
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
|
||||||
{
|
{
|
||||||
if ((*i)->GetMiscValue()& misc_mask)
|
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());
|
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;
|
return multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -694,6 +694,38 @@ void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpellMgr::AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int32 amount, std::map<SpellGroup, int32>& groups) const
|
||||||
|
{
|
||||||
|
uint32 spellId = spellInfo->GetFirstRankSpell()->Id;
|
||||||
|
SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellId);
|
||||||
|
// Find group with SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT if it belongs to one
|
||||||
|
for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
|
||||||
|
{
|
||||||
|
SpellGroup group = itr->second;
|
||||||
|
SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(group);
|
||||||
|
if (found != mSpellGroupStack.end())
|
||||||
|
{
|
||||||
|
if (found->second == SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT)
|
||||||
|
{
|
||||||
|
// Put the highest amount in the map
|
||||||
|
if (groups.find(group) == groups.end())
|
||||||
|
groups[group] = amount;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int32 curr_amount = groups[group];
|
||||||
|
// Take absolute value because this also counts for the highest negative aura
|
||||||
|
if (abs(curr_amount) < abs(amount))
|
||||||
|
groups[group] = amount;
|
||||||
|
}
|
||||||
|
// return because a spell should be in only one SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT group
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Not in a SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT group, so return false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const
|
SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const
|
||||||
{
|
{
|
||||||
uint32 spellid_1 = spellInfo1->GetFirstRankSpell()->Id;
|
uint32 spellid_1 = spellInfo1->GetFirstRankSpell()->Id;
|
||||||
@@ -3116,6 +3148,7 @@ void SpellMgr::LoadDbcDataCorrections()
|
|||||||
case 51726:
|
case 51726:
|
||||||
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
|
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
|
||||||
spellInfo->SpellFamilyFlags[2] = 0x10;
|
spellInfo->SpellFamilyFlags[2] = 0x10;
|
||||||
|
spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN;
|
||||||
break;
|
break;
|
||||||
case 41913: // Parasitic Shadowfiend Passive
|
case 41913: // Parasitic Shadowfiend Passive
|
||||||
spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends
|
spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
|
|||||||
|
|
||||||
enum SpellGroup
|
enum SpellGroup
|
||||||
{
|
{
|
||||||
|
SPELL_GROUP_NONE = 0,
|
||||||
SPELL_GROUP_ELIXIR_BATTLE = 1,
|
SPELL_GROUP_ELIXIR_BATTLE = 1,
|
||||||
SPELL_GROUP_ELIXIR_GUARDIAN = 2,
|
SPELL_GROUP_ELIXIR_GUARDIAN = 2,
|
||||||
SPELL_GROUP_ELIXIR_UNSTABLE = 3,
|
SPELL_GROUP_ELIXIR_UNSTABLE = 3,
|
||||||
@@ -344,8 +345,9 @@ enum SpellGroupStackRule
|
|||||||
SPELL_GROUP_STACK_RULE_DEFAULT = 0,
|
SPELL_GROUP_STACK_RULE_DEFAULT = 0,
|
||||||
SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1,
|
SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1,
|
||||||
SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER = 2,
|
SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER = 2,
|
||||||
|
SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT = 3,
|
||||||
};
|
};
|
||||||
#define SPELL_GROUP_STACK_RULE_MAX 3
|
#define SPELL_GROUP_STACK_RULE_MAX 4
|
||||||
|
|
||||||
typedef std::map<SpellGroup, SpellGroupStackRule> SpellGroupStackMap;
|
typedef std::map<SpellGroup, SpellGroupStackRule> SpellGroupStackMap;
|
||||||
|
|
||||||
@@ -596,6 +598,7 @@ class SpellMgr
|
|||||||
void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells, std::set<SpellGroup>& usedGroups) const;
|
void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells, std::set<SpellGroup>& usedGroups) const;
|
||||||
|
|
||||||
// Spell Group Stack Rules table
|
// Spell Group Stack Rules table
|
||||||
|
bool AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int32 amount, std::map<SpellGroup, int32>& groups) const;
|
||||||
SpellGroupStackRule CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const;
|
SpellGroupStackRule CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const;
|
||||||
|
|
||||||
// Spell proc event table
|
// Spell proc event table
|
||||||
|
|||||||
Reference in New Issue
Block a user