Skip to content

Commit

Permalink
healthprediction: Add showRawAbsorb option
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- authored and p3lim committed Jul 23, 2024
1 parent 02078dd commit f3da3de
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions elements/healthprediction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ myBar - A `StatusBar` used to represent incoming heals from the player.
otherBar - A `StatusBar` used to represent incoming heals from others.
absorbBar - A `StatusBar` used to represent damage absorbs.
healAbsorbBar - A `StatusBar` used to represent heal absorbs.
overAbsorb - A `Texture` used to signify that the amount of damage absorb is greater than the unit's missing health.
overAbsorb - A `Texture` used to signify that the amount of damage absorb is greater than either the unit's missing
health or the unit's maximum health, if .showRawAbsorb is enabled.
overHealAbsorb - A `Texture` used to signify that the amount of heal absorb is greater than the unit's current health.
## Notes
Expand All @@ -23,8 +24,9 @@ A default texture will be applied to the Texture widgets if they don't have a te
## Options
.maxOverflow - The maximum amount of overflow past the end of the health bar. Set this to 1 to disable the overflow.
Defaults to 1.05 (number)
.maxOverflow - The maximum amount of overflow past the end of the health bar. Set this to 1 to disable the overflow.
Defaults to 1.05 (number)
.showRawAbsorb - Makes the element show the raw amount of damage absorb (boolean)
## Examples
Expand Down Expand Up @@ -149,7 +151,11 @@ local function Update(self, event, unit)
end

local hasOverAbsorb = false
if(health + allIncomingHeal + absorb >= maxHealth) then
if(element.showRawAbsorb) then
if(absorb > maxHealth) then
hasOverAbsorb = true
end
elseif(health + allIncomingHeal + absorb >= maxHealth) then
if(absorb > 0) then
hasOverAbsorb = true
end
Expand Down Expand Up @@ -206,7 +212,7 @@ local function Update(self, event, unit)
* otherIncomingHeal - the amount of incoming healing done by others (number)
* absorb - the amount of damage the unit can absorb without losing health (number)
* healAbsorb - the amount of healing the unit can absorb without gaining health (number)
* hasOverAbsorb - indicates if the amount of damage absorb is higher than the unit's missing health (boolean)
* hasOverAbsorb - indicates if the amount of damage absorb is higher than either the unit's missing health or the unit's maximum health, if .showRawAbsorb is enabled (boolean)
* hasOverHealAbsorb - indicates if the amount of heal absorb is higher than the unit's current health (boolean)
--]]
if(element.PostUpdate) then
Expand Down

0 comments on commit f3da3de

Please sign in to comment.