Commit 22ef54f6 authored by Val Voronov's avatar Val Voronov Committed by Adrian L Lange

healthprediction: Maths update

parent 53ec0f76
......@@ -104,41 +104,40 @@ local function Update(self, event, unit)
local absorb = UnitGetTotalAbsorbs(unit) or 0
local healAbsorb = UnitGetTotalHealAbsorbs(unit) or 0
local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit)
local otherIncomingHeal = 0
local hasOverHealAbsorb = false
if(health < healAbsorb) then
hasOverHealAbsorb = true
healAbsorb = health
end
if(health - healAbsorb + allIncomingHeal > maxHealth * element.maxOverflow) then
allIncomingHeal = maxHealth * element.maxOverflow - health + healAbsorb
end
if(healAbsorb > allIncomingHeal) then
healAbsorb = healAbsorb - allIncomingHeal
allIncomingHeal = 0
myIncomingHeal = 0
local otherIncomingHeal = 0
if(allIncomingHeal < myIncomingHeal) then
myIncomingHeal = allIncomingHeal
if(health < healAbsorb) then
hasOverHealAbsorb = true
healAbsorb = health
end
else
otherIncomingHeal = allIncomingHeal - myIncomingHeal
end
allIncomingHeal = allIncomingHeal - healAbsorb
healAbsorb = 0
local hasOverAbsorb = false
if(health - healAbsorb + allIncomingHeal + absorb >= maxHealth or health + absorb >= maxHealth) then
if(absorb > 0) then
hasOverAbsorb = true
if(health + allIncomingHeal > maxHealth * element.maxOverflow) then
allIncomingHeal = maxHealth * element.maxOverflow - health
end
if(allIncomingHeal > healAbsorb) then
absorb = math.max(0, maxHealth - (health - healAbsorb + allIncomingHeal))
if(allIncomingHeal < myIncomingHeal) then
myIncomingHeal = allIncomingHeal
else
absorb = math.max(0, maxHealth - health)
otherIncomingHeal = allIncomingHeal - myIncomingHeal
end
end
if(healAbsorb > allIncomingHeal) then
healAbsorb = healAbsorb - allIncomingHeal
else
healAbsorb = 0
local hasOverAbsorb = false
if(health + allIncomingHeal + absorb >= maxHealth) then
if(absorb > 0) then
hasOverAbsorb = true
end
absorb = math.max(0, maxHealth - health - allIncomingHeal)
end
if(element.myBar) then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment