@@ -111,6 +111,53 @@ function calcs.initModDB(env, modDB)
111111 modDB .conditions [" Effective" ] = env .mode_effective
112112end
113113
114+ local function getCorruptedJewelEffect (env , item , node )
115+ if not item or item .type ~= " Jewel" or not item .corrupted or not node or node .containJewelSocket or node .sinister or item .base .subType == " Charm" then
116+ return 0
117+ end
118+ local rarity = item .rarity :gsub (" (%a)(%u*)" , function (a , b ) return a .. string.lower (b ) end )
119+ return env .modDB .multipliers [" Corrupted" .. rarity .. " JewelEffect" ] or 0
120+ end
121+
122+ local function runRadiusJewelFunc (rad , node , out , data )
123+ local scale = rad .effectScale
124+ if not scale or scale == 1 then
125+ rad .func (node , out , data )
126+ return
127+ end
128+
129+ local start = # out
130+ rad .func (node , out , data )
131+ if # out == start then
132+ return
133+ end
134+
135+ local scaledList = new (" ModList" )
136+ for i = start + 1 , # out do
137+ scaledList :AddMod (out [i ])
138+ end
139+ for i = # out , start + 1 , - 1 do
140+ t_remove (out , i )
141+ end
142+ out :ScaleAddList (scaledList , scale )
143+
144+ for i = start + 1 , # out do
145+ local mod = out [i ]
146+ if mod .parsedLine then
147+ local value = mod .value
148+ while type (value ) == " table" and value .mod do
149+ value = value .mod .value
150+ end
151+ if type (value ) == " table" then
152+ value = value .value
153+ end
154+ if type (value ) == " number" then
155+ mod .parsedLine = mod .parsedLine :gsub (" %d*%.?%d+" , math.abs (value ), 1 )
156+ end
157+ end
158+ end
159+ end
160+
114161local function refreshJewelStatCache (env )
115162 local normalNode = { type = " Normal" }
116163 local attributeNode = { type = " Normal" , isAttribute = true }
@@ -125,9 +172,9 @@ local function refreshJewelStatCache(env)
125172 GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].attributeModList = new (" ModList" )
126173 GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].notableModList = new (" ModList" )
127174 end
128- rad . func ( normalNode , GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].smallModList , rad .data )
129- rad . func ( attributeNode , GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].attributeModList , rad .data )
130- rad . func ( notableNode , GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].notableModList , rad .data )
175+ runRadiusJewelFunc ( rad , normalNode , GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].smallModList , rad .data )
176+ runRadiusJewelFunc ( rad , attributeNode , GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].attributeModList , rad .data )
177+ runRadiusJewelFunc ( rad , notableNode , GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ].notableModList , rad .data )
131178 end
132179end
133180
@@ -153,7 +200,7 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill, includeKeyst
153200 for _ , rad in pairs (env .radiusJewelList ) do
154201 if rad .type == " Other" and rad .nodes [node .id ] and rad .nodes [node .id ].type ~= " Mastery" then
155202 if rad .item .baseName :find (" Time%-Lost" ) == nil and rad .item .baseName :find (" Timeless Jewel" ) == nil then
156- rad . func ( node , modList , rad .data )
203+ runRadiusJewelFunc ( rad , node , modList , rad .data )
157204 elseif node .type == " Normal" or node .type == " Notable" then
158205 local cache = GlobalCache .cachedData [env .mode ].radiusJewelData [rad .nodeId ]
159206 if not cache or (cache .hash ~= rad .jewelHash ) then
@@ -186,7 +233,7 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill, includeKeyst
186233 -- Run second pass radius jewels
187234 for _ , rad in pairs (env .radiusJewelList ) do
188235 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
189- rad . func ( node , modList , rad .data )
236+ runRadiusJewelFunc ( rad , node , modList , rad .data )
190237 end
191238 end
192239
@@ -319,7 +366,7 @@ function calcs.buildModListForNodeList(env, nodeList, finishJewels, includeKeyst
319366
320367 -- Finalise radius jewels
321368 for _ , rad in pairs (env .radiusJewelList ) do
322- rad . func ( nil , modList , rad .data )
369+ runRadiusJewelFunc ( rad , nil , modList , rad .data )
323370 if env .mode == " MAIN" then
324371 if not rad .item .jewelRadiusData then
325372 rad .item .jewelRadiusData = { }
@@ -978,6 +1025,14 @@ function calcs.initEnv(build, mode, override, specEnv)
9781025 :: continue::
9791026 end
9801027
1028+ for _ , rad in ipairs (env .radiusJewelList ) do
1029+ local effect = getCorruptedJewelEffect (env , rad .item , env .spec .nodes [rad .nodeId ])
1030+ if effect ~= 0 then
1031+ rad .effectScale = 1 + effect
1032+ rad .jewelHash = tostring (rad .jewelHash or getHashFromString (rad .item .modSource .. rad .item .raw )) .. " :" .. rad .effectScale
1033+ end
1034+ end
1035+
9811036 if not env .configInput .ignoreItemDisablers then
9821037 local itemDisabled = {}
9831038 local itemDisablers = {}
@@ -1035,6 +1090,7 @@ function calcs.initEnv(build, mode, override, specEnv)
10351090 for _ , slot in pairs (build .itemsTab .orderedSlots ) do
10361091 local slotName = slot .slotName
10371092 local item = items [slotName ]
1093+ local node = slot .nodeId and env .spec .nodes [slot .nodeId ]
10381094 if item and item .type == " Flask" then
10391095 if slot .active then
10401096 env .flasks [item ] = true
@@ -1084,6 +1140,7 @@ function calcs.initEnv(build, mode, override, specEnv)
10841140 env .player .itemList [slotName ] = item
10851141 -- Merge mods for this item
10861142 local srcList = item .modList or (item .slotModList and item .slotModList [slot .slotNum ]) or {}
1143+ local corruptedJewelEffect = slot .nodeId and getCorruptedJewelEffect (env , item , node ) or 0
10871144
10881145 -- Remove Spirit Base if CannotGainSpiritFromEquipment flag is true
10891146 if nodesModsList :Flag (nil , " CannotGainSpiritFromEquipment" ) then
@@ -1281,8 +1338,8 @@ function calcs.initEnv(build, mode, override, specEnv)
12811338 env .itemModDB :ScaleAddMod (mod , scale )
12821339 end
12831340 end
1284- elseif env . modDB . multipliers [ " Corrupted " .. item . rarity : gsub ( " (%a)(%u*) " , function ( a , b ) return a .. string.lower ( b ) end ) .. " JewelEffect " ] and item . type == " Jewel " and item . corrupted and slot . nodeId and item . base . subType ~= " Charm " and node and not node . containJewelSocket and not node . sinister then
1285- scale = scale + env . modDB . multipliers [ " Corrupted " .. item . rarity : gsub ( " (%a)(%u*) " , function ( a , b ) return a .. string.lower ( b ) end ) .. " JewelEffect " ]
1341+ elseif corruptedJewelEffect ~= 0 then
1342+ scale = scale + corruptedJewelEffect
12861343 local combinedList = new (" ModList" )
12871344 for _ , mod in ipairs (srcList ) do
12881345 combinedList :MergeMod (mod )
0 commit comments