diff --git a/Omen.lua b/Omen.lua index 11cc379..296cfe9 100644 --- a/Omen.lua +++ b/Omen.lua @@ -1289,7 +1289,9 @@ local function updatethreat(unitid, mobunitid) local guid = UnitGUID(unitid) if guid and not threatTable[guid] then local isTanking, state, scaledPercent, rawPercent, threatValue = UnitDetailedThreatSituation(unitid, mobunitid) - threatTable[guid] = threatValue or -1 + -- Threat can be negative due to temporary threat reduction effects such as Fade and Mirror Image. + -- So we cap the minimum threat to display at 0. We use the special value -1 to indicate nil here. + threatTable[guid] = (threatValue and (threatValue >= 0 and threatValue or 0)) or -1 if threatValue and threatValue > topthreat then topthreat = threatValue end if isTanking then tankGUID = guid end end @@ -1442,7 +1444,7 @@ function Omen:UpdateBarsReal() -- Sort the threatTable local i = 1 for k, v in pairs(threatTable) do - if v >= 0 then + if v ~= -1 then sortTable[i] = k i = i + 1 end @@ -1507,13 +1509,13 @@ function Omen:UpdateBarsReal() -- Update the text on the bar bar.Text1:SetText(guidNameLookup[guid]) if dbBar.ShowPercent and dbBar.ShowValue then - if dbBar.ShortNumbers and threat > 100000 then + if dbBar.ShortNumbers and threat >= 100000 then bar.Text2:SetFormattedText("%2.1fk [%d%%]", threat / 100000, tankThreat == 0 and 0 or threat / tankThreat * 100) else bar.Text2:SetFormattedText("%d [%d%%]", threat / 100, tankThreat == 0 and 0 or threat / tankThreat * 100) end elseif dbBar.ShowValue then - if dbBar.ShortNumbers and threat > 100000 then + if dbBar.ShortNumbers and threat >= 100000 then bar.Text2:SetFormattedText("%2.1fk", threat / 100000) else bar.Text2:SetFormattedText("%d", threat / 100) @@ -1532,7 +1534,7 @@ function Omen:UpdateBarsReal() -- Update the width of the bar, and animate if necessary local width = w * threat / topthreat - if width == 0 then width = 1 end + if width <= 0 then width = 1 end if dbBar.AnimateBars and self.Anchor.IsMovingOrSizing ~= 2 then bar:AnimateTo(width) else