From 6cafe8787352bc0993ad1644e5cca538d347eff8 Mon Sep 17 00:00:00 2001 From: Vollmer Date: Mon, 23 Sep 2024 14:52:58 +0200 Subject: [PATCH] [Bugfix] Fix Shield Bar going beyond Health Bar --- Widgets/Bars/ShieldBar.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Widgets/Bars/ShieldBar.lua b/Widgets/Bars/ShieldBar.lua index 873756b..a9fe9af 100644 --- a/Widgets/Bars/ShieldBar.lua +++ b/Widgets/Bars/ShieldBar.lua @@ -94,6 +94,7 @@ end local function Enable(self) self._owner:AddEventListener("UNIT_ABSORB_AMOUNT_CHANGED", Update) self._owner:AddEventListener("UNIT_MAXHEALTH", Update) + self._owner:AddEventListener("UNIT_HEALTH", Update) self.Update(self._owner) @@ -104,6 +105,7 @@ end local function Disable(self) self._owner:RemoveEventListener("UNIT_ABSORB_AMOUNT_CHANGED", Update) self._owner:RemoveEventListener("UNIT_MAXHEALTH", Update) + self._owner:RemoveEventListener("UNIT_HEALTH", Update) end ------------------------------------------------- @@ -119,20 +121,19 @@ local function ShieldBar_SetValue(bar, percent) local barWidth = maxWidth * percent if bar.currentPoint == "healthBar" then - local maxLossWidth = bar.parentHealthBarLoss:GetWidth() - local ratio = maxLossWidth / maxWidth + local ratio = 1 - bar._owner.states.healthPercent if percent > ratio then if bar.reverseFill then bar:Repoint("RIGHT") else - barWidth = maxLossWidth + barWidth = maxWidth * ratio end elseif bar.reverseFill then bar:Repoint() end - if bar.showOverShield and maxLossWidth == 0 then + if bar.showOverShield and ratio == 0 then bar.overShieldGlow:Show() end end