Quantcast

Add TickValue() script condition to get tick amounts of DoTs.

Johnny C. Lam [10-26-12 - 05:24]
Add TickValue() script condition to get tick amounts of DoTs.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@624 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleCondition.lua
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 189cfc9..119738a 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -55,7 +55,7 @@ local UnitClassification, UnitCreatureFamily, UnitCreatureType = UnitClassificat
 local UnitDebuff, UnitDetailedThreatSituation, UnitExists = UnitDebuff, UnitDetailedThreatSituation, UnitExists
 local UnitHealth, UnitHealthMax, UnitIsDead = UnitHealth, UnitHealthMax, UnitIsDead
 local UnitIsFriend, UnitIsUnit, UnitLevel = UnitIsFriend, UnitIsUnit, UnitLevel
-local UnitPower, UnitPowerMax = UnitPower, UnitPowerMax
+local UnitPower, UnitPowerMax, UnitAura = UnitPower, UnitPowerMax, UnitAura

 --</private-static-properties>

@@ -2391,6 +2391,33 @@ OvaleCondition.conditions=
 		return compare(threatpct, condition[1], condition[2])
 	end,

+--- Get the current tick value of a damage-over-time (DoT) aura on the target.
+-- @name TickValue
+-- @paramsig number or boolean
+-- @param id The aura spell ID.
+-- @param operator Optional. Comparison operator: equal, less, more.
+-- @param number Optional. The number to compare against.
+-- @param target Optional. Sets the target to check. The target may also be given as a prefix to the condition.
+--     Defaults to target=player.
+--     Valid values: player, target, focus, pet.
+-- @return The tick value.
+-- @return A boolean value for the result of the comparison.
+-- @see TicksRemain
+-- @usage
+-- if DebuffRemains(light_stagger) >0 and TickValue(light_stagger) >10000
+--     Spell(purifying_brew)
+
+	tickvalue = function(condition)
+		local target = getTarget(condition.target)
+		local name = GetSpellInfo(condition[1])
+		local value = select(14, UnitAura(target, name, "", "HARMFUL"))
+		if not value then
+			value = select(14, UnitAura(target, name, "", "HELPFUL"))
+		end
+		value = value or 0
+		return compare(value, condition[2], condition[3])
+	end,
+
 --- Get the estimated total number of ticks of a damage-over-time (DoT) aura.
 -- @name Ticks
 -- @paramsig number or boolean