Quantcast

Another change to buff conditions for constant values.

Johnny C. Lam [05-03-14 - 00:25]
Another change to buff conditions for constant values.

Enforce the buff start and ending times for valid domains, and default to
zero when outside of the domain.  This more closely matches the semantics
that people expect with constant values.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1357 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
conditions/BuffAmount.lua
conditions/BuffComboPoints.lua
conditions/BuffDamageMultiplier.lua
conditions/BuffDuration.lua
conditions/BuffSnapshot.lua
conditions/BuffStacks.lua
conditions/TickTime.lua
diff --git a/conditions/BuffAmount.lua b/conditions/BuffAmount.lua
index ba250ef..f3a2eca 100644
--- a/conditions/BuffAmount.lua
+++ b/conditions/BuffAmount.lua
@@ -54,10 +54,10 @@ do
 			statName = "value3"
 		end
 		local aura = state:GetAura(target, auraId, filter, mine)
-		if aura then
+		if state:IsActiveAura(aura) then
 			local start, ending = aura.start, aura.ending
 			local value = aura[statName] or 0
-			return TestValue(start, math.huge, value, start, 0, comparator, limit)
+			return TestValue(start, ending, value, start, 0, comparator, limit)
 		end
 		return Compare(0, comparator, limit)
 	end
diff --git a/conditions/BuffComboPoints.lua b/conditions/BuffComboPoints.lua
index 731f52d..a4689ab 100644
--- a/conditions/BuffComboPoints.lua
+++ b/conditions/BuffComboPoints.lua
@@ -37,10 +37,10 @@ do
 		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 aura then
+		if state:IsActiveAura(aura) then
 			local start, ending = aura.start, aura.ending
 			local value = aura and aura.combo or 0
-			return TestValue(start, math.huge, value, start, 0, comparator, limit)
+			return TestValue(start, ending, value, start, 0, comparator, limit)
 		end
 		return Compare(0, comparator, limit)
 	end
diff --git a/conditions/BuffDamageMultiplier.lua b/conditions/BuffDamageMultiplier.lua
index 78f357e..7955e81 100644
--- a/conditions/BuffDamageMultiplier.lua
+++ b/conditions/BuffDamageMultiplier.lua
@@ -37,12 +37,12 @@ do
 		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 aura then
+		if state:IsActiveAura(aura) then
 			local start, ending = aura.start, aura.ending
 			local baseDamageMultiplier = aura.snapshot and aura.snapshot.baseDamageMultiplier or 1
 			local damageMultiplier = aura.damageMultiplier or 1
 			local value = baseDamageMultiplier * damageMultiplier
-			return TestValue(start, math.huge, value, start, 0, comparator, limit)
+			return TestValue(start, ending, value, start, 0, comparator, limit)
 		end
 		return Compare(1, comparator, limit)
 	end
diff --git a/conditions/BuffDuration.lua b/conditions/BuffDuration.lua
index 2149316..e92b08e 100644
--- a/conditions/BuffDuration.lua
+++ b/conditions/BuffDuration.lua
@@ -35,10 +35,10 @@ do
 		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 aura then
+		if state:IsActiveAura(aura) then
 			local start, ending = aura.start, aura.ending
 			local value = ending - start
-			return TestValue(start, math.huge, value, start, 0, comparator, limit)
+			return TestValue(start, ending, value, start, 0, comparator, limit)
 		end
 		return Compare(0, comparator, limit)
 	end
diff --git a/conditions/BuffSnapshot.lua b/conditions/BuffSnapshot.lua
index d81be30..4aeb7e7 100644
--- a/conditions/BuffSnapshot.lua
+++ b/conditions/BuffSnapshot.lua
@@ -23,10 +23,10 @@ do
 		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 aura then
-			local start = aura.start
+		if state:IsActiveAura(aura) then
+			local start, ending = aura.start, aura.ending
 			local value = aura.snapshot and aura.snapshot[statName] or defaultValue
-			return TestValue(start, math.huge, value, start, 0, comparator, limit)
+			return TestValue(start, ending, value, start, 0, comparator, limit)
 		end
 		return Compare(defaultValue, comparator, limit)
 	end
@@ -36,13 +36,13 @@ do
 		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 aura then
+		if state:IsActiveAura(aura) then
 			local start, ending = aura.start, aura.ending
 			local value = aura.snapshot and aura.snapshot[statName] or defaultValue
 			if condition.unlimited ~= 1 and value > 100 then
 				value = 100
 			end
-			return TestValue(start, math.huge, value, start, 0, comparator, limit)
+			return TestValue(start, ending, value, start, 0, comparator, limit)
 		end
 		return Compare(defaultValue, comparator, limit)
 	end
diff --git a/conditions/BuffStacks.lua b/conditions/BuffStacks.lua
index 7c74b0b..5568b63 100644
--- a/conditions/BuffStacks.lua
+++ b/conditions/BuffStacks.lua
@@ -43,10 +43,10 @@ do
 		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 aura then
+		if state:IsActiveAura(aura) then
 			local start, ending = aura.start, aura.ending
 			local value = aura.stacks or 0
-			return TestValue(start, math.huge, value, start, 0, comparator, limit)
+			return TestValue(start, ending, value, start, 0, comparator, limit)
 		end
 		return Compare(0, comparator, limit)
 	end
diff --git a/conditions/TickTime.lua b/conditions/TickTime.lua
index 5b09fe5..5bfd6be 100644
--- a/conditions/TickTime.lua
+++ b/conditions/TickTime.lua
@@ -38,7 +38,7 @@ do
 		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 aura and aura.tick then
+		if state:IsActiveAura(aura) and aura.tick then
 			local value = aura.tick
 			return Compare(value, comparator, limit)
 		end