Fix the return values of BuffExpires and BuffPresent in corner cases.
Johnny C. Lam [10-15-13 - 03:07]
Fix the return values of BuffExpires and BuffPresent in corner cases.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1063 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 233fa09..6ab35dd 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -943,7 +943,11 @@ OvaleCondition.conditions.buffexpires = function(condition)
return TestBoolean(true)
end
Ovale:Logf("timeBefore = %s, ending = %s", timeBefore, ending)
- return ending - timeBefore, math.huge
+ if ending - timeBefore <= start then
+ return start, math.huge
+ else
+ return ending - timeBefore, math.huge
+ end
end
OvaleCondition.conditions.debuffexpires = OvaleCondition.conditions.buffexpires
@@ -1034,7 +1038,11 @@ OvaleCondition.conditions.buffpresent = function(condition)
return nil
end
local timeBefore = TimeWithHaste(condition[2], condition.haste)
- return start, ending - timeBefore
+ if ending - timeBefore <= start then
+ return nil
+ else
+ return start, ending - timeBefore
+ end
end
OvaleCondition.conditions.debuffpresent = OvaleCondition.conditions.buffpresent