Quantcast

Make TicksAdded() semantics match SimC's add_ticks property.

Johnny C. Lam [04-06-14 - 18:47]
Make TicksAdded() semantics match SimC's add_ticks property.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1277 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
conditions/TicksAdded.lua
diff --git a/conditions/TicksAdded.lua b/conditions/TicksAdded.lua
index 632511e..6107600 100644
--- a/conditions/TicksAdded.lua
+++ b/conditions/TicksAdded.lua
@@ -1,7 +1,7 @@
 --[[--------------------------------------------------------------------
     Ovale Spell Priority
     Copyright (C) 2012, 2013 Sidoine
-    Copyright (C) 2012, 2013 Johnny C. Lam
+    Copyright (C) 2012, 2013, 2014 Johnny C. Lam

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License in the LICENSE
@@ -16,11 +16,9 @@ do

 	local Compare = OvaleCondition.Compare
 	local ParseCondition = OvaleCondition.ParseCondition
-	local TestValue = OvaleCondition.TestValue
 	local state = OvaleState.state

-	--- Get the number of ticks that would be added if the dot were refreshed.
-	-- Not implemented, always returns 0.
+	--- Get the number of ticks that would be added if the dot were cast with a current snapshot.
 	-- @name TicksAdded
 	-- @paramsig number or boolean
 	-- @param id The aura spell ID
@@ -32,10 +30,9 @@ do
 	local function TicksAdded(condition)
 		local auraId, comparator, limit = condition[1], condition[2], condition[3]
 		local target, filter, mine = ParseCondition(condition)
-		local aura = state:GetAura(target, auraId, filter, mine)
-		if state:IsActiveAura(aura) then
-			local start, ending, tick = aura.start, aura.ending, aura.tick
-			return TestValue(start, ending, 0, start, 0, comparator, limit)
+		local _, _, _, numTicks = state:GetDuration(auraId)
+		if numTicks and numTicks > 0 then
+			return Compare(numTicks, comparator, limit)
 		end
 		return Compare(0, comparator, limit)
 	end