Skip to content

Commit 860d03e

Browse files
github-actions[bot]LocalIdentityLocalIdentity
authored
[pob1-port] Fix insufficient skill cost warning applying to other skills (#1586)
* Apply changes from PathOfBuildingCommunity/PathOfBuilding#9172 * Fix conflict --------- Co-authored-by: LocalIdentity <LocalIdentity@users.noreply.github.com> Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 3567300 commit 860d03e

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/Modules/Build.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ function buildMode:AddDisplayStatList(statList, actor)
19611961
end
19621962
end
19631963
end
1964-
for pool, warningFlag in pairs({["Life"] = "LifeCostWarning", ["Mana"] = "ManaCostWarning", ["Rage"] = "RageCostWarning", ["Energy Shield"] = "ESCostWarning"}) do
1964+
for pool, warningFlag in pairs({["Life"] = "LifeCostWarningList", ["Mana"] = "ManaCostWarningList", ["Rage"] = "RageCostWarningList", ["Energy Shield"] = "ESCostWarningList"}) do
19651965
if actor.output[warningFlag] then
19661966
local line = "You do not have enough "..(actor.output.EnergyShieldProtectsMana and pool == "Mana" and "Energy Shield and Mana" or pool).." to use: "
19671967
for _, skill in ipairs(actor.output[warningFlag]) do
@@ -1971,7 +1971,7 @@ function buildMode:AddDisplayStatList(statList, actor)
19711971
InsertIfNew(self.controls.warnings.lines, line)
19721972
end
19731973
end
1974-
for pool, warningFlag in pairs({["Unreserved life"] = "LifePercentCostPercentCostWarning", ["Unreserved Mana"] = "ManaPercentCostPercentCostWarning"}) do
1974+
for pool, warningFlag in pairs({["Unreserved life"] = "LifePercentCostPercentCostWarningList", ["Unreserved Mana"] = "ManaPercentCostPercentCostWarningList"}) do
19751975
if actor.output[warningFlag] then
19761976
local line = "You do not have enough ".. pool .."% to use: "
19771977
for _, skill in ipairs(actor.output[warningFlag]) do

src/Modules/Calcs.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,11 @@ function calcs.buildOutput(build, mode)
425425
local reservation = GlobalCache.cachedData[mode][uuid].Env.player.mainSkill and GlobalCache.cachedData[mode][uuid].Env.player.mainSkill.skillData[rawPool .. "ReservedPercent"]
426426
-- Skill has both cost and reservation check if there's available pool for raw cost before reservation
427427
if not reservation or (reservation and (totalPool + m_ceil((output[rawPool] or 0) * reservation / 100)) < cachedCost) then
428-
output[costResource.."Warning"] = output[costResource.."Warning"] or {}
429-
t_insert(output[costResource.."Warning"], skill.activeEffect.grantedEffect.name)
428+
if env.player.mainSkill and env.player.mainSkill.activeEffect.grantedEffect.name == skill.activeEffect.grantedEffect.name then
429+
output[costResource.."Warning"] = true
430+
end
431+
output[costResource.."WarningList"] = output[costResource.."WarningList"] or {}
432+
t_insert(output[costResource.."WarningList"], skill.activeEffect.grantedEffect.name)
430433
end
431434
end
432435
output.EternalLifeWarning = output.EternalLifeWarning or env.modDB:Flag(nil, "EternalLife") and costResource == "LifeCost" and cachedCost > 0 and output.EnergyShieldRecoveryCap > 0
@@ -436,8 +439,8 @@ function calcs.buildOutput(build, mode)
436439
local cachedCost = GlobalCache.cachedData[mode][uuid].Env.player.output[costResource]
437440
if cachedCost then
438441
if (output[pool] or 0) < cachedCost then
439-
output[costResource.."PercentCostWarning"] = output[costResource.."PercentCostWarning"] or {}
440-
t_insert(output[costResource.."PercentCostWarning"], skill.activeEffect.grantedEffect.name)
442+
output[costResource.."PercentCostWarningList"] = output[costResource.."PercentCostWarningList"] or {}
443+
t_insert(output[costResource.."PercentCostWarningList"], skill.activeEffect.grantedEffect.name)
441444
end
442445
end
443446
end

0 commit comments

Comments
 (0)