Fix arguments passed to state:GetCD().
Johnny C. Lam [11-26-13 - 14:04]
Fix arguments passed to state:GetCD().
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1208 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvaleCooldown.lua b/OvaleCooldown.lua
index 6d0ed57..5856643 100644
--- a/OvaleCooldown.lua
+++ b/OvaleCooldown.lua
@@ -185,7 +185,7 @@ do
-- Return the cooldown for the spell in the simulator.
statePrototype.GetSpellCooldown = function(state, spellId)
local start, duration, enable
- local cd = state:GetCD(state, spellId)
+ local cd = state:GetCD(spellId)
if cd and cd.start then
start = cd.start
duration = cd.duration
@@ -199,10 +199,15 @@ do
-- Force the cooldown of a spell to reset at the specified time.
statePrototype.ResetSpellCooldown = function(state, spellId, atTime)
if atTime >= state.currentTime then
- local cd = state:GetCD(state, spellId)
- cd.start = state.currentTime
- cd.duration = atTime - state.currentTime
- cd.enable = 1
+ local start, duration, enable = state:GetSpellCooldown(spellId)
+ if start + duration > state.currentTime then
+ local cd = state:GetCD(spellId)
+ if cd then
+ cd.start = state.currentTime
+ cd.duration = atTime - state.currentTime
+ cd.enable = 1
+ end
+ end
end
end
end