Read HP deficit via ClassicAPI UnitHealthMissing

ValidateHpLost now gets the health deficit in one call through
CleveRoids.ClassicAPI.UnitHealthMissing, mirroring how ValidatePowerLost
uses UnitPowerMissing, instead of hand-computing max - current via
NampowerAPI.
This commit is contained in:
Brues
2026-07-27 19:48:36 -05:00
parent 7c71f8fc26
commit 77f985a927
2 changed files with 14 additions and 10 deletions
+1 -4
View File
@@ -3399,10 +3399,7 @@ end
-- returns: True or false
function CleveRoids.ValidateHpLost(unit, operator, amount)
if not unit or not operator or not amount then return false end
local API = CleveRoids.NampowerAPI
local maxHp = API and API.GetUnitMaxHealth and API.GetUnitMaxHealth(unit) or UnitHealthMax(unit)
local hp = API and API.GetUnitHealth and API.GetUnitHealth(unit) or UnitHealth(unit)
local hpLost = maxHp - hp
local hpLost = CleveRoids.ClassicAPI.UnitHealthMissing(unit)
if CleveRoids.operators[operator] then
return CleveRoids.comparators[operator](hpLost, amount)