Changed health calculation to have more precision
Scott King [01-16-14 - 02:52]
Changed health calculation to have more precision
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index 77b16c6..670ad08 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -31,7 +31,7 @@ end
function HealthPercentage()
-- Health value to display. Whole numbers only.
- TargetPercentHealth = math.ceil((UnitHealth("target") / UnitHealthMax("target") * 100));
+ TargetPercentHealth = (UnitHealth("target") / UnitHealthMax("target") * 100);
-- Class detection
@@ -69,12 +69,13 @@ function HealthPercentage()
PortraitHealth_Health:SetTextColor(1,1,0);
end
+ local h = string.format("%.0f",TargetPercentHealth);
-- change the portrait to show current health
if UnitIsDead("target") then
PortraitHealth_Health:SetText('Dead');
else
- PortraitHealth_Health:SetText(TargetPercentHealth .. '%');
+ PortraitHealth_Health:SetText(h .. '%');
end
end