Skip to content

Commit b8adac5

Browse files
LocalIdentityLocalIdentity
andauthored
Fix insufficient skill cost warning applying to other skills (#9172)
When checking to see if we should apply the red text to a skills resource cost value we were checking the list of all skills that had a warning for that cost type instead of just the active skill in the sidebar Decided to change the variable name for the list so that we can still use other `statData.stat.."Warning"` for other stats if we want Co-authored-by: LocalIdentity <[email protected]>
1 parent 8a397e0 commit b8adac5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/Modules/Build.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ function buildMode:AddDisplayStatList(statList, actor)
16251625
end
16261626
end
16271627
end
1628-
for pool, warningFlag in pairs({["Life"] = "LifeCostWarning", ["Mana"] = "ManaCostWarning", ["Rage"] = "RageCostWarning", ["Energy Shield"] = "ESCostWarning"}) do
1628+
for pool, warningFlag in pairs({["Life"] = "LifeCostWarningList", ["Mana"] = "ManaCostWarningList", ["Rage"] = "RageCostWarningList", ["Energy Shield"] = "ESCostWarningList"}) do
16291629
if actor.output[warningFlag] then
16301630
local line = "You do not have enough "..(actor.output.EnergyShieldProtectsMana and pool == "Mana" and "Energy Shield and Mana" or pool).." to use: "
16311631
for _, skill in ipairs(actor.output[warningFlag]) do
@@ -1635,7 +1635,7 @@ function buildMode:AddDisplayStatList(statList, actor)
16351635
InsertIfNew(self.controls.warnings.lines, line)
16361636
end
16371637
end
1638-
for pool, warningFlag in pairs({["Unreserved life"] = "LifePercentCostPercentCostWarning", ["Unreserved Mana"] = "ManaPercentCostPercentCostWarning"}) do
1638+
for pool, warningFlag in pairs({["Unreserved life"] = "LifePercentCostPercentCostWarningList", ["Unreserved Mana"] = "ManaPercentCostPercentCostWarningList"}) do
16391639
if actor.output[warningFlag] then
16401640
local line = "You do not have enough ".. pool .."% to use: "
16411641
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
@@ -445,8 +445,11 @@ function calcs.buildOutput(build, mode)
445445
local reservation = GlobalCache.cachedData[mode][uuid].Env.player.mainSkill and GlobalCache.cachedData[mode][uuid].Env.player.mainSkill.skillData[rawPool .. "ReservedPercent"]
446446
-- Skill has both cost and reservation check if there's available pool for raw cost before reservation
447447
if not reservation or (reservation and (totalPool + m_ceil((output[rawPool] or 0) * reservation / 100)) < cachedCost) then
448-
output[costResource.."Warning"] = output[costResource.."Warning"] or {}
449-
t_insert(output[costResource.."Warning"], skill.activeEffect.grantedEffect.name)
448+
if env.player.mainSkill and env.player.mainSkill.activeEffect.grantedEffect.name == skill.activeEffect.grantedEffect.name then
449+
output[costResource.."Warning"] = true
450+
end
451+
output[costResource.."WarningList"] = output[costResource.."WarningList"] or {}
452+
t_insert(output[costResource.."WarningList"], skill.activeEffect.grantedEffect.name)
450453
end
451454
end
452455
end
@@ -455,8 +458,8 @@ function calcs.buildOutput(build, mode)
455458
local cachedCost = GlobalCache.cachedData[mode][uuid].Env.player.output[costResource]
456459
if cachedCost then
457460
if (output[pool] or 0) < cachedCost then
458-
output[costResource.."PercentCostWarning"] = output[costResource.."PercentCostWarning"] or {}
459-
t_insert(output[costResource.."PercentCostWarning"], skill.activeEffect.grantedEffect.name)
461+
output[costResource.."PercentCostWarningList"] = output[costResource.."PercentCostWarningList"] or {}
462+
t_insert(output[costResource.."PercentCostWarningList"], skill.activeEffect.grantedEffect.name)
460463
end
461464
end
462465
end

0 commit comments

Comments
 (0)