Quantcast

Calculation change

Scott King [01-08-14 - 03:52]
Calculation change

Switched to math.ceil for better precision on execute abilities
Filename
PortraitHealth.lua
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index 57d78ed..b2d5f55 100644
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -1,10 +1,10 @@
 function HealthPercentage()
 	-- health value to display. whole numbers only.
-	local TargetPercentHealth = math.floor((UnitHealth("target") / UnitHealthMax("target") * 100));
+	local TargetPercentHealth = math.ceil((UnitHealth("target") / UnitHealthMax("target") * 100));


 	-- recolor text at 35% (future idea: class detection)
-	if TargetPercentHealth <= 35 then
+	if TargetPercentHealth < 35 then
 		PortraitHealth_Health:SetTextColor(1,0,0);
 	else
 		PortraitHealth_Health:SetTextColor(1,1,0);