@@ -107,12 +107,40 @@ local function setStats(jewel, radiusJewelStats, index, alternate)
107107 radiusJewelStats [index ] = {
108108 isNotable = (line :match (" ^(%S+)" ) == " Notable" ),
109109 toAdd = (line :find (" also% grant" )~= nil ), -- only add mods with the "also grant" text to radiusNodes
110- sd = line :gsub (" .*grant " , " " ):gsub (" %(.-%)" , value )
110+ sdLine = line :gsub (" .*grant " , " " ):gsub (" %(.-%)" , value )
111111 }
112112 if line :lower ():match (" increased effect of small passive skills in radius" ) then
113113 return tonumber (line :match (" %d+" ))
114114 end
115115end
116+ local function mergeStats (node , sd , spec )
117+ -- copy the original tree node so we ignore the mods being added from the jewel
118+ local nodeCopy = copyTable (spec .tree .nodes [node .id ], true )
119+ local nodeNumber = 0
120+ local nodeString = " "
121+ local modToAddNumber = 0
122+ local modToAddString = " "
123+
124+ -- loop the original node mods and compare to the jewel mod we want to add
125+ -- if the strings without the numbers are identical, the mods should be identical
126+ -- if so, update the node's version of the mod and do not add the jewel mods to the list
127+ -- otherwise, add the jewel mod because it's unique/new to the node
128+ for index , nodeSd in ipairs (nodeCopy .sd ) do
129+ nodeString = nodeSd :gsub (" (%d+)" , function (number )
130+ nodeNumber = number
131+ return " "
132+ end )
133+ modToAddString = sd :gsub (" (%d+)" , function (number )
134+ modToAddNumber = number
135+ return " "
136+ end )
137+ if nodeString == modToAddString then
138+ node .sd [index ] = node .sd [index ]:gsub (" (%d+)" , (nodeNumber + modToAddNumber ))
139+ return
140+ end
141+ end
142+ t_insert (node .sd , sd )
143+ end
116144-- grab the stat lines from the selected variants on the jewel to add to the nodes
117145-- e.g. Against the Darkness or Time-Lost jewels
118146local function setRadiusJewelStats (radiusJewel , radiusJewelStats )
@@ -160,9 +188,9 @@ local function addStats(jewel, node, spec)
160188 incEffect = setRadiusJewelStats (jewel , radiusJewelStats )
161189 for _ , stat in ipairs (radiusJewelStats ) do
162190 -- the node and stat types match, add sd to node if it's not already there and it's an 'also grant' mod
163- if not isValueInTable (node .sd , stat .sd ) and ((node .type == " Notable" and stat .isNotable ) or (node .type == " Normal" and not stat .isNotable ))
191+ if not isValueInTable (node .sd , stat .sdLine ) and ((node .type == " Notable" and stat .isNotable ) or (node .type == " Normal" and not stat .isNotable ))
164192 and stat .toAdd then
165- t_insert (node . sd , stat .sd )
193+ mergeStats (node , stat .sdLine , spec )
166194 end
167195 end
168196 -- if there's an incEffect of Small Passives mod on the jewel and the node is small, scale all numbers
@@ -184,7 +212,7 @@ local function addStatsFromJewelToNode(jewel, node, spec)
184212 -- if the Time-Lost jewel is socketed, add the stat
185213 if itemsTab .activeSocketList then
186214 for _ , nodeId in pairs (itemsTab .activeSocketList ) do
187- local socketIndex , socketedJewel = itemsTab :GetSocketAndJewelForNodeID (nodeId )
215+ local _ , socketedJewel = itemsTab :GetSocketAndJewelForNodeID (nodeId )
188216 if socketedJewel and socketedJewel .baseName :find (" Time%-Lost" ) == 1 then
189217 addStats (jewel , node , spec )
190218 end
@@ -282,7 +310,7 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
282310 table.insert (mod , { type = " Condition" , var = " WeaponSet" .. node .allocMode })
283311 end
284312 end
285-
313+
286314 -- Apply Inc Node scaling from Hulking Form
287315 if incSmallPassiveSkill > 0 and node .type == " Normal" and not node .isAttribute and not node .ascendancyName then
288316 local scale = 1 + incSmallPassiveSkill / 100
@@ -329,7 +357,9 @@ function calcs.buildModListForNodeList(env, nodeList, finishJewels)
329357
330358 -- Finalise radius jewels
331359 for _ , rad in pairs (env .radiusJewelList ) do
332- rad .func (nil , modList , rad .data )
360+ if rad .item .baseName :find (" Time%-Lost" ) == nil then
361+ rad .func (nil , modList , rad .data )
362+ end
333363 if env .mode == " MAIN" then
334364 if not rad .item .jewelRadiusData then
335365 rad .item .jewelRadiusData = { }
0 commit comments