Skip to content

Commit aa2e750

Browse files
FIX: incorrect warnings when using eb and drop support for per second costs. (#5247)
* FEAT: Stop disabling aura effects when unreserved mana is negative. Add a warning for when LifeCost or ManaCost is higher than avilable pool. * FEAT: Make mana cost warnings show for all enabled active skill gems not just mainSkill. * FIX: generalize match condition for cost coloring. * FIX: Add support for mana cost warning for triggered skills. * FIX: fix copy paste typo. * FEAT: implement warnings for energy shield and rage cost. Minor tweaks. * Apply suggestions from code review Co-authored-by: QuickStick <31533893+QuickStick123@users.noreply.github.com> * FIX: Add better handling for eldrich battery. Minor tweaks. * FIX: fix other costs missing from top level cache table. * FIX: add compatibility with #5199 * FIX: mana warnings showing up when using EB * FIX: remove per second cost warning Per second cost warnings are hard to make accurate to due the amount of recovery sources avilable both in poe and in pob. Co-authored-by: QuickStick <31533893+QuickStick123@users.noreply.github.com>
1 parent 5146427 commit aa2e750

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

src/Modules/Build.lua

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ function buildMode:AddDisplayStatList(statList, actor)
13391339
local output = actor.output
13401340
local poolVal = output[statData.pool]
13411341
local colorOverride = nil
1342-
if statData.stat:match("Cost$") and statVal and poolVal then
1342+
if statData.stat:match("Cost$") and not statData.stat:match("PerSecondCost$") and statVal and poolVal then
13431343
if statData.stat == "ManaCost" and output.EnergyShieldProtectsMana then
13441344
if statVal > output.ManaUnreserved + output.EnergyShield then
13451345
colorOverride = colorCodes.NEGATIVE
@@ -1376,13 +1376,7 @@ function buildMode:AddDisplayStatList(statList, actor)
13761376
InsertIfNew(self.controls.warnings.lines, line)
13771377
end
13781378
end
1379-
for pool, warningFlag in pairs({["Life"] = "LifePerSecondCostPerSecondWarning", ["Mana"] = "ManaPerSecondCostPerSecondWarning", ["Rage"] = "RagePerSecondCostPerSecondWarning", ["EnergyShield"] = "ESPerSecondCostPerSecondWarning"}) do
1380-
if actor.output[warningFlag] then
1381-
local line = "You do not have enough ".. pool .." to use a Selected Skill for a second"
1382-
InsertIfNew(self.controls.warnings.lines, line)
1383-
end
1384-
end
1385-
for pool, warningFlag in pairs({["Unreserved life"] = "LifePercentCostPercentPerSecondWarning", ["Unreserved life"] = "LifePercentPerSecondCostPercentPerSecondWarning", ["Unreserved Mana"] = "ManaPercentPerSecondCostPercentPerSecondWarning", ["Unreserved Mana"] = "ManaPercentCostPercentPerSecondWarning", ["EnergyShield"] = "ESPercentPerSecondCostPercentPerSecondWarning"}) do
1379+
for pool, warningFlag in pairs({["Unreserved life"] = "LifePercentCostPercentCostWarning", ["Unreserved Mana"] = "ManaPercentCostPercentCostWarning"}) do
13861380
if actor.output[warningFlag] then
13871381
local line = "You do not have enough ".. pool .."% to use a Selected Skill"
13881382
InsertIfNew(self.controls.warnings.lines, line)

src/Modules/Calcs.lua

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -416,34 +416,18 @@ function calcs.buildOutput(build, mode)
416416
for pool, costResource in pairs({["LifeUnreserved"] = "LifeCost", ["ManaUnreserved"] = "ManaCost", ["Rage"] = "RageCost", ["EnergyShield"] = "ESCost"}) do
417417
local cachedCost = GlobalCache.cachedData["CACHE"][uuid].Env.player.output[costResource]
418418
if cachedCost then
419-
if EB and costResource == "Mana" then --Handling for mana cost warnings with EB allocated
419+
if EB and costResource == "ManaCost" then --Handling for mana cost warnings with EB allocated
420420
output.EnergyShieldProtectsMana = true
421421
output[costResource.."Warning"] = output[costResource.."Warning"] or (((output[pool] or 0) + (output["EnergyShield"] or 0)) < cachedCost)
422422
else
423423
output[costResource.."Warning"] = output[costResource.."Warning"] or ((output[pool] or 0) < cachedCost) -- defaulting to 0 to avoid crashing
424424
end
425425
end
426426
end
427-
for pool, costResource in pairs({["LifeUnreserved"] = "LifePerSecondCost", ["ManaUnreserved"] = "ManaPerSecondCost", ["Rage"] = "RagePerSecondCost", ["EnergyShield"] = "ESPerSecondCost"}) do
427+
for pool, costResource in pairs({["LifeUnreservedPercent"] = "LifePercentCost", ["ManaUnreservedPercent"] = "ManaPercentCost"}) do
428428
local cachedCost = GlobalCache.cachedData["CACHE"][uuid].Env.player.output[costResource]
429429
if cachedCost then
430-
if EB and costResource == "Mana" then
431-
output.EnergyShieldProtectsMana = true
432-
output[costResource.."PerSecondWarning"] = output[costResource.."PerSecondWarning"] or (((output[pool] or 0) + (output["EnergyShield"] or 0)) < cachedCost)
433-
else
434-
output[costResource.."PerSecondWarning"] = output[costResource.."PerSecondWarning"] or ((output[pool] or 0) < cachedCost)
435-
ConPrintf(costResource.."PerSecondWarning".." "..(output[costResource.."PerSecondWarning"] and "true" or "false"))
436-
end
437-
end
438-
end
439-
for pool, costResource in pairs({["LifeUnreservedPercent"] = "LifePercentCost", ["LifeUnreservedPercent"] = "LifePercentPerSecondCost", ["ManaUnreservedPercent"] = "ManaPercentPerSecondCost", ["ManaUnreservedPercent"] = "ManaPercentCost", ["ESPercentPerSecondCost"] = "ESPercentPerSecondCost"}) do
440-
local cachedCost = GlobalCache.cachedData["CACHE"][uuid].Env.player.output[costResource]
441-
if cachedCost then
442-
if costResource == "ESPercentPerSecondCost" then --Assuming 100% of Es is always available
443-
output["ESPercentPerSecondCostPercentPerSecondWarning"] = output["ESPercentPerSecondCostPercentPerSecondWarning"] or ((output["EnergyShield"] or 0) < cachedCost)
444-
else
445-
output[costResource.."PercentPerSecondWarning"] = output[costResource.."PercentPerSecondWarning"] or ((output[pool] or 0) < cachedCost)
446-
end
430+
output[costResource.."PercentCostWarning"] = output[costResource.."PercentCostWarning"] or ((output[pool] or 0) < cachedCost)
447431
end
448432
end
449433
end

0 commit comments

Comments
 (0)