Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 38 additions & 40 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,37 +93,35 @@
end

-- grab the stat lines from the selected variants on the jewel to add to the nodes
-- e.g. Against the Darkness
-- e.g. Against the Darkness or Time-Lost jewels
local function setRadiusJewelStats(radiusJewel, radiusJewelStats)
local jewel = radiusJewel.item
if jewel.title == "Against the Darkness" then
radiusJewelStats.source = radiusJewel.data.modSource

local variant = jewel.variant or 1
-- ATD has a special case with variant/variantAlt but other jewels have a fairly simple iterative list
local function setStats(jewel, radiusJewelStats, index, alternate)
local variant = (alternate and jewel.variantAlt or jewel.variant) or index
local range = jewel.explicitModLines[variant].range
local value = 0
jewel.explicitModLines[variant].line:gsub("%((%d+)%-(%d+)%)",
function(num1, num2)
value = round(num1 + (num2-num1) * range)
end
)
radiusJewelStats[1] = {
radiusJewelStats[index] = {
isNotable = (jewel.explicitModLines[variant].line:match("^(%S+)") == "Notable"),
sd = jewel.explicitModLines[variant].line:gsub(".*grant ", ""):gsub("%(.-%)", value)
}

local variantAlt = jewel.variantAlt or 2
local rangeAlt = jewel.explicitModLines[variantAlt].range
local valueAlt = 0
jewel.explicitModLines[variantAlt].line:gsub("%((%d+)%-(%d+)%)",
function(num1, num2)
valueAlt = round(num1 + (num2-num1) * rangeAlt)
end

local jewel = radiusJewel.item
if jewel.baseName:find("Time%-Lost") == 1 then
radiusJewelStats.source = radiusJewel.data.modSource
if jewel.title == "Against the Darkness" then
setStats(jewel, radiusJewelStats, 1, false)
setStats(jewel, radiusJewelStats, 2, true)
else
for modIndex, _ in ipairs(jewel.explicitModLines) do
setStats(jewel, radiusJewelStats, modIndex, false)
end
)
radiusJewelStats[2] = {
isNotable = (jewel.explicitModLines[variantAlt].line:match("^(%S+)") == "Notable"),
sd = jewel.explicitModLines[variantAlt].line:gsub(".*grant ", ""):gsub("%(.-%)", valueAlt)
}
end
end
end

Expand Down Expand Up @@ -155,11 +153,11 @@
if itemsTab.activeSocketList then
for _, nodeId in pairs(itemsTab.activeSocketList) do
local _, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId)
if socketedJewel and socketedJewel.title == "Against the Darkness" then
if socketedJewel and socketedJewel.baseName:find("Time%-Lost") == 1 then
return addStats(jewel, node, spec)
end
end
-- activeSocketList isn't init on Load, need to run once
-- activeSocketList isn't init on Load, need to run once
elseif itemsTab.initSockets then
return addStats(jewel, node, spec)
end
Expand All @@ -173,27 +171,10 @@
modList:AddList(node.modList)
end

if node.allocMode and node.allocMode ~= 0 then
for i, mod in ipairs(modList) do
local added = false
for j, extra in ipairs(mod) do
-- if type conditional and start with WeaponSet then update the var to the current weapon set
if extra.type == "Condition" and extra.var and extra.var:match("^WeaponSet") then
mod[j].var = "WeaponSet".. node.allocMode
added = true
break
end
end
if not added then
table.insert(mod, { type = "Condition", var = "WeaponSet".. node.allocMode })
end
end
end

-- Run first pass radius jewels
for _, rad in pairs(env.radiusJewelList) do
if rad.type == "Other" and rad.nodes[node.id] and rad.nodes[node.id].type ~= "Mastery" then
if rad.item.title ~= "Against the Darkness" then
if rad.item.baseName:find("Time%-Lost") ~= 1 then
rad.func(node, modList, rad.data)
else
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)
Expand All @@ -217,7 +198,7 @@
-- Run second pass radius jewels
for _, rad in pairs(env.radiusJewelList) do
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
if rad.item.title ~= "Against the Darkness" then
if rad.item.baseName:find("Time%-Lost") ~= 1 then
rad.func(node, modList, rad.data)
else
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)
Expand Down Expand Up @@ -249,6 +230,23 @@
t_insert(env.explodeSources, node)
end

if node.allocMode and node.allocMode ~= 0 then
for i, mod in ipairs(modList) do
local added = false
for j, extra in ipairs(mod) do
-- if type conditional and start with WeaponSet then update the var to the current weapon set
if extra.type == "Condition" and extra.var and extra.var:match("^WeaponSet") then
mod[j].var = "WeaponSet".. node.allocMode
added = true
break
end
end
if not added then
table.insert(mod, { type = "Condition", var = "WeaponSet".. node.allocMode })
end
end
end

-- Apply Inc Node scaling from Hulking Form
if incSmallPassiveSkill > 0 and node.type == "Normal" and not node.isAttribute and not node.ascendancyName then
local scale = 1 + incSmallPassiveSkill / 100
Expand Down Expand Up @@ -730,7 +728,7 @@
modDB:NewMod("Multiplier:AllocatedLifeMastery", "BASE", allocatedMasteryTypes["Life Mastery"])
end

-- add Conditional WeaponnSet# base on weapon set from item

Check warning on line 731 in src/Modules/CalcSetup.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Weaponn)
modDB:NewMod("Condition:WeaponSet" .. (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1) , "FLAG", true, "Weapon Set")

-- Build and merge item modifiers, and create list of radius jewels
Expand Down
Loading