Quantcast

bug fix with TargetDeadIn()

Sidoine De Wispelaere [10-13-09 - 20:09]
bug fix with TargetDeadIn()

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@121 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
diff --git a/Condition.lua b/Condition.lua
index 24cf62f..c3e12eb 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -223,13 +223,14 @@ local function getTargetDead()
 		savedHealth = {}
 	end
 	local newHealth = UnitHealth("target")
-	if second~=lastSaved then
+	if second~=lastSaved and targetGUID then
 		lastSaved = second
 		local mod10 = second % 10
 		local prevHealth = savedHealth[mod10]
 		savedHealth[mod10] = newHealth
-		if prevHealth then
-			lastSPD = 10/(newHealth-prevHealth)
+		if prevHealth>newHealth then
+			lastSPD = 10/(prevHealth-newHealth)
+--			print("dps = " .. (1/lastSPD))
 		end
 	end
 	-- Rough estimation