From 48108af701c8f3dcf651fde5be8fb37a809a42e5 Mon Sep 17 00:00:00 2001 From: Paliak <91493239+Paliak@users.noreply.github.com> Date: Sat, 28 Sep 2024 05:01:49 +0200 Subject: [PATCH 1/2] FIX: Blasphemy auras triggering mana cost warning The warning calculations did not consdier the case of a skill having both reservation and mana costs. Mana cost would be checked after applying reservation and not before causing the warning to show up in some cases. This pr adds a check and handling for such cases, as well as using the warnings from output to determine color override for cost labels instead of re-checking pool availability. --- src/Modules/Build.lua | 13 +------------ src/Modules/Calcs.lua | 10 ++++++++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/Modules/Build.lua b/src/Modules/Build.lua index 09fe063e60..983de6b5f8 100644 --- a/src/Modules/Build.lua +++ b/src/Modules/Build.lua @@ -1735,19 +1735,8 @@ function buildMode:AddDisplayStatList(statList, actor) end elseif not (statData.hideStat) then -- Change the color of the stat label to red if cost exceeds pool - local output = actor.output - local poolVal = output[statData.pool] local colorOverride = nil - if statData.stat:match("Cost$") and not statData.stat:match("PerSecondCost$") and statVal and poolVal then - if statData.stat == "ManaCost" and output.EnergyShieldProtectsMana then - if statVal > output.ManaUnreserved + output.EnergyShield then - colorOverride = colorCodes.NEGATIVE - end - elseif statVal > poolVal then - colorOverride = colorCodes.NEGATIVE - end - end - if statData.warnFunc and statData.warnFunc(statVal, actor.output) and statData.warnColor then + if actor.output[statData.stat.."Warning"] or (statData.warnFunc and statData.warnFunc(statVal, actor.output) and statData.warnColor) then colorOverride = colorCodes.NEGATIVE end t_insert(statBoxList, { diff --git a/src/Modules/Calcs.lua b/src/Modules/Calcs.lua index a4b3f6f2af..3141934024 100644 --- a/src/Modules/Calcs.lua +++ b/src/Modules/Calcs.lua @@ -8,6 +8,7 @@ local ipairs = ipairs local t_insert = table.insert local s_format = string.format local m_min = math.min +local m_ceil = math.ceil local calcs = { } calcs.breakdownModule = "Modules/CalcBreakdown" @@ -441,8 +442,13 @@ function calcs.buildOutput(build, mode) if cachedCost then local totalPool = (output.EnergyShieldProtectsMana and costResource == "ManaCost" and output["EnergyShield"] or 0) + (output[pool] or 0) if totalPool < cachedCost then - output[costResource.."Warning"] = output[costResource.."Warning"] or {} - t_insert(output[costResource.."Warning"], skill.activeEffect.grantedEffect.name) + local rawPool = pool:gsub("Unreserved$", "") + local reservation = GlobalCache.cachedData[mode][uuid].Env.player.mainSkill and GlobalCache.cachedData[mode][uuid].Env.player.mainSkill.skillData[rawPool .. "ReservedPercent"] + -- Skill has both cost and reservation check if there's avilable pool for raw cost before reservation + if not reservation or (reservation and (totalPool + m_ceil((output[rawPool] or 0) * reservation / 100)) < cachedCost) then + output[costResource.."Warning"] = output[costResource.."Warning"] or {} + t_insert(output[costResource.."Warning"], skill.activeEffect.grantedEffect.name) + end end end end From 31ea8021f54e744948f1a2daaf97275faf79a573 Mon Sep 17 00:00:00 2001 From: LocalIdentity <31035929+LocalIdentity@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:58:07 +1100 Subject: [PATCH 2/2] Update Calcs.lua --- src/Modules/Calcs.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modules/Calcs.lua b/src/Modules/Calcs.lua index 3141934024..a92162ebd0 100644 --- a/src/Modules/Calcs.lua +++ b/src/Modules/Calcs.lua @@ -444,7 +444,7 @@ function calcs.buildOutput(build, mode) if totalPool < cachedCost then local rawPool = pool:gsub("Unreserved$", "") local reservation = GlobalCache.cachedData[mode][uuid].Env.player.mainSkill and GlobalCache.cachedData[mode][uuid].Env.player.mainSkill.skillData[rawPool .. "ReservedPercent"] - -- Skill has both cost and reservation check if there's avilable pool for raw cost before reservation + -- Skill has both cost and reservation check if there's available pool for raw cost before reservation if not reservation or (reservation and (totalPool + m_ceil((output[rawPool] or 0) * reservation / 100)) < cachedCost) then output[costResource.."Warning"] = output[costResource.."Warning"] or {} t_insert(output[costResource.."Warning"], skill.activeEffect.grantedEffect.name)