From f3da3de13cf9d3d57c98e80070dc760aa7d23310 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Thu, 18 Jul 2024 19:30:53 +0700 Subject: [PATCH] healthprediction: Add showRawAbsorb option --- elements/healthprediction.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/elements/healthprediction.lua b/elements/healthprediction.lua index b2021ec0..f47e28e1 100644 --- a/elements/healthprediction.lua +++ b/elements/healthprediction.lua @@ -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 @@ -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 @@ -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 @@ -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