Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit eab5e06

Browse files
committed
update ATD processStats logic to apply to all Time-Lost jewels
1 parent d2b768c commit eab5e06

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

src/Modules/CalcSetup.lua

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -93,37 +93,35 @@ function calcs.initModDB(env, modDB)
9393
end
9494

9595
-- grab the stat lines from the selected variants on the jewel to add to the nodes
96-
-- e.g. Against the Darkness
96+
-- e.g. Against the Darkness or Time-Lost jewels
9797
local function setRadiusJewelStats(radiusJewel, radiusJewelStats)
98-
local jewel = radiusJewel.item
99-
if jewel.title == "Against the Darkness" then
100-
radiusJewelStats.source = radiusJewel.data.modSource
101-
102-
local variant = jewel.variant or 1
98+
-- ATD has a special case with variant/variantAlt but other jewels have a fairly simple iterative list
99+
local function setStats(jewel, radiusJewelStats, index, alternate)
100+
local variant = (alternate and jewel.variantAlt or jewel.variant) or index
103101
local range = jewel.explicitModLines[variant].range
104102
local value = 0
105103
jewel.explicitModLines[variant].line:gsub("%((%d+)%-(%d+)%)",
106104
function(num1, num2)
107105
value = round(num1 + (num2-num1) * range)
108106
end
109107
)
110-
radiusJewelStats[1] = {
108+
radiusJewelStats[index] = {
111109
isNotable = (jewel.explicitModLines[variant].line:match("^(%S+)") == "Notable"),
112110
sd = jewel.explicitModLines[variant].line:gsub(".*grant ", ""):gsub("%(.-%)", value)
113111
}
114-
115-
local variantAlt = jewel.variantAlt or 2
116-
local rangeAlt = jewel.explicitModLines[variantAlt].range
117-
local valueAlt = 0
118-
jewel.explicitModLines[variantAlt].line:gsub("%((%d+)%-(%d+)%)",
119-
function(num1, num2)
120-
valueAlt = round(num1 + (num2-num1) * rangeAlt)
112+
end
113+
114+
local jewel = radiusJewel.item
115+
if jewel.baseName:find("Time%-Lost") == 1 then
116+
radiusJewelStats.source = radiusJewel.data.modSource
117+
if jewel.title == "Against the Darkness" then
118+
setStats(jewel, radiusJewelStats, 1, false)
119+
setStats(jewel, radiusJewelStats, 2, true)
120+
else
121+
for modIndex, _ in ipairs(jewel.explicitModLines) do
122+
setStats(jewel, radiusJewelStats, modIndex, false)
121123
end
122-
)
123-
radiusJewelStats[2] = {
124-
isNotable = (jewel.explicitModLines[variantAlt].line:match("^(%S+)") == "Notable"),
125-
sd = jewel.explicitModLines[variantAlt].line:gsub(".*grant ", ""):gsub("%(.-%)", valueAlt)
126-
}
124+
end
127125
end
128126
end
129127

@@ -155,11 +153,11 @@ local function addStatsFromJewelToNode(jewel, node, spec)
155153
if itemsTab.activeSocketList then
156154
for _, nodeId in pairs(itemsTab.activeSocketList) do
157155
local _, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId)
158-
if socketedJewel and socketedJewel.title == "Against the Darkness" then
156+
if socketedJewel and socketedJewel.baseName:find("Time%-Lost") == 1 then
159157
return addStats(jewel, node, spec)
160158
end
161159
end
162-
-- activeSocketList isn't init on Load, need to run once
160+
-- activeSocketList isn't init on Load, need to run once
163161
elseif itemsTab.initSockets then
164162
return addStats(jewel, node, spec)
165163
end
@@ -193,7 +191,7 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
193191
-- Run first pass radius jewels
194192
for _, rad in pairs(env.radiusJewelList) do
195193
if rad.type == "Other" and rad.nodes[node.id] and rad.nodes[node.id].type ~= "Mastery" then
196-
if rad.item.title ~= "Against the Darkness" then
194+
if rad.item.baseName:find("Time%-Lost") ~= 1 then
197195
rad.func(node, modList, rad.data)
198196
else
199197
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)
@@ -217,7 +215,7 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
217215
-- Run second pass radius jewels
218216
for _, rad in pairs(env.radiusJewelList) do
219217
if rad.nodes[node.id] and rad.nodes[node.id].type ~= "Mastery" and (rad.type == "Threshold" or (rad.type == "Self" and env.allocNodes[node.id]) or (rad.type == "SelfUnalloc" and not env.allocNodes[node.id])) then
220-
if rad.item.title ~= "Against the Darkness" then
218+
if rad.item.baseName:find("Time%-Lost") ~= 1 then
221219
rad.func(node, modList, rad.data)
222220
else
223221
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)

0 commit comments

Comments
 (0)