Add new SpellInfo parameters to handle buffs generating extra resources.
Johnny C. Lam [03-02-13 - 17:58]
Add new SpellInfo parameters to handle buffs generating extra resources.
``buff_<resource>'' is an optional parameter that is set to the spell ID
of the buff that causes extra resources to be generated when present.
``buff_<resource>_amount'' is an optional parameter that is set to the
number of extra resources generated when the buff listed in
``buff_<resource>'' is present. If not set, then it defaults to ``1''.
Drop special handling of Shadow Blades in OvaleState now that it can be
described and handled directly in the rogue script with the above
parameters.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@712 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvaleState.lua b/OvaleState.lua
index 75e068e..f0d189a 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -181,6 +181,13 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
else
self.state[k] = self.state[k] - newSpellInfo[k]
end
+ -- Add extra resource generated by presence of a buff.
+ local buffParam = "buff_" .. tostring(k)
+ local buffAmoumtParam = buffParam .. "_amount"
+ if newSpellInfo[k] < 0 and newSpellInfo[buffParam] and self:GetAura("player", newSpellInfo[buffParam], true) then
+ local buffAmount = newSpellInfo[buffAmountParam] or 1
+ self.state[k] = self.state[k] + buffAmount
+ end
if self.state[k] < v.mini then
self.state[k] = v.mini
end
@@ -201,9 +208,10 @@ function OvaleState:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd,
self.state.combo = 0
elseif newSpellInfo.combo > 0 then
self.state.combo = self.state.combo + newSpellInfo.combo
- if OvaleData.className == "ROGUE" and self:GetAura("player", 121471, true) then
- -- Shadow Blades generates an extra combo point.
- self.state.combo = self.state.combo + 1
+ -- Add extra combo points generated by presence of a buff.
+ if newSpellInfo.buff_combo and self:GetAura("player", newSpellInfo.buff_combo, true) then
+ local buffAmount = newSpellInfo.buff_combo_amount or 1
+ self.state.combo = self.state.combo + buffAmount
end
if self.state.combo > MAX_COMBO_POINTS then
self.state.combo = MAX_COMBO_POINTS