Quantcast

fix for RelativeLevel

Sidoine De Wispelaere [02-05-11 - 16:21]
fix for RelativeLevel

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@353 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
diff --git a/Condition.lua b/Condition.lua
index 9c7cc29..7db56c5 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -623,19 +623,6 @@ Ovale.conditions=
 		buildStunSpellList()
 		return testbool(not HasFullControl() and isDebuffInList(stunSpellList), condition[1])
 	end,
-	-- Test the target level difference with the player
-	-- 1 : "less" or "more"
-	-- 2 : [target level]-[player level] limit
-	TargetRelativeLevel = function(condition)
-		local difference
-		if (UnitLevel("target") == -1) then
-			difference = 3
-		else
-			difference = UnitLevel("target") - UnitLevel("player")
-		end
-
-		return compare(difference, condition[1], condition[2])
-	end,
 	LastSpellDamage = function(condition)
 		local spellId = condition[1]
 		if not Ovale.spellDamage[spellId] then
@@ -822,6 +809,20 @@ Ovale.conditions=
 		end
 		return maxCD
 	end,
+	-- Test the target level difference with the player
+	-- 1 : "less" or "more"
+	-- 2 : [target level]-[player level] limit
+	RelativeLevel = function(condition)
+		local difference
+		local target = getTarget(condition.target)
+		if (UnitLeveltarget) == -1) then
+			difference = 3
+		else
+			difference = UnitLevel(target) - UnitLevel("player")
+		end
+
+		return compare(difference, condition[1], condition[2])
+	end,
 	SoulShards = function(condition)
 		return compare(Ovale.state.shard, condition[1], condition[2])
 	end,