Skip to content
Merged
Show file tree
Hide file tree
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
75 changes: 45 additions & 30 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,32 @@
modDB.conditions["Effective"] = env.mode_effective
end

-- 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 line = jewel.explicitModLines[variant].line
local value = 0

line:gsub("%((%d+)%-(%d+)%)",
function(num1, num2)
value = round(num1 + (num2-num1) * range)
end
)
radiusJewelStats[index] = {
isNotable = (line:match("^(%S+)") == "Notable"),
toAdd = (line:find("also% grant")~= nil), -- only add mods with the "also grant" text to radiusNodes
sd = line:gsub(".*grant ", ""):gsub("%(.-%)", value)
}
if line:lower():match("increased effect of small passive skills in radius") then
return tonumber(line:match("%d+"))
end
end
-- grab the stat lines from the selected variants on the jewel to add to the nodes
-- e.g. Against the Darkness or Time-Lost jewels
local function setRadiusJewelStats(radiusJewel, radiusJewelStats)
-- 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 line = jewel.explicitModLines[variant].line
local value = 0

line:gsub("%((%d+)%-(%d+)%)",
function(num1, num2)
value = round(num1 + (num2-num1) * range)
end
)
radiusJewelStats[index] = {
isNotable = (line:match("^(%S+)") == "Notable"),
toAdd = (line:find("also% grant")~= nil), -- only add mods with the "also grant" text to radiusNodes
sd = line:gsub(".*grant ", ""):gsub("%(.-%)", value)
}
end

local jewel = radiusJewel.item
local incEffect
if jewel.baseName:find("Time%-Lost") ~= nil then
radiusJewelStats.source = radiusJewel.data.modSource
if jewel.title == "Against the Darkness" then
Expand All @@ -135,13 +138,15 @@
end
end
for modIndex, _ in ipairs(jewelModLines) do
setStats(jewel, radiusJewelStats, modIndex, false)
incEffect = setStats(jewel, radiusJewelStats, modIndex, false) or incEffect
end
end
end
return incEffect
end

local function addStats(jewel, node, spec)
local incEffect
-- short term to avoid running the logic on AddItemTooltip
if not spec.build.treeTab.skipTimeLostJewelProcessing then
-- reset node stats to base or override for attributes
Expand All @@ -152,17 +157,24 @@
end

local radiusJewelStats = { }
setRadiusJewelStats(jewel, radiusJewelStats)
incEffect = setRadiusJewelStats(jewel, radiusJewelStats)
for _, stat in ipairs(radiusJewelStats) do
-- the node and stat types match, add sd to node if it's not already there and it's an 'also grant' mod
if not isValueInTable(node.sd, stat.sd) and ((node.type == "Notable" and stat.isNotable) or (node.type == "Normal" and not stat.isNotable))
and stat.toAdd then
t_insert(node.sd, stat.sd)
end
end
spec.tree:ProcessStats(node)
-- if there's an incEffect of Small Passives mod on the jewel and the node is small, scale all numbers
-- we've already checked this isn't an attribute node
if incEffect and node.type == "Normal" then
for index, sd in ipairs(node.sd) do
node.sd[index] = sd:gsub("(%d+)", function(num)
return tostring(round(tonumber(num) * (1 + incEffect/100)))
end)
end
end
end
return node.modList
end

local function addStatsFromJewelToNode(jewel, node, spec)
Expand All @@ -174,15 +186,16 @@
for _, nodeId in pairs(itemsTab.activeSocketList) do
local socketIndex, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId)
if socketedJewel and socketedJewel.baseName:find("Time%-Lost") == 1 then
return addStats(jewel, node, spec)
addStats(jewel, node, spec)
end
end
-- activeSocketList isn't init on Load, need to run once
elseif itemsTab.initSockets then
return addStats(jewel, node, spec)
addStats(jewel, node, spec)
end
end
end

function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
local modList = new("ModList")
if node.type == "Keystone" then
Expand All @@ -197,8 +210,9 @@
if rad.item.baseName:find("Time%-Lost") == nil then
rad.func(node, modList, rad.data)
else
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)
if nodeList then modList = nodeList end
addStatsFromJewelToNode(rad, node, env.build.spec)
env.build.spec.tree:ProcessStats(node)
modList = node.modList
end
end
end
Expand All @@ -221,8 +235,9 @@
if rad.item.baseName:find("Time%-Lost") == nil then
rad.func(node, modList, rad.data)
else
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)
if nodeList then modList = nodeList end
addStatsFromJewelToNode(rad, node, env.build.spec)
env.build.spec.tree:ProcessStats(node)
modList = node.modList
end
end
end
Expand Down Expand Up @@ -266,7 +281,7 @@
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 @@ -748,7 +763,7 @@
modDB:NewMod("Multiplier:AllocatedLifeMastery", "BASE", allocatedMasteryTypes["Life Mastery"])
end

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

Check warning on line 766 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
1 change: 1 addition & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5206,6 +5206,7 @@ local specialModList = {
["nearby allies have (%d+)%% chance to block attack damage per (%d+) strength you have"] = function(block, _, str) return {
mod("ExtraAura", "LIST", { onlyAllies = true, mod = mod("BlockChance", "BASE", block) }, { type = "PerStat", stat = "Str", div = tonumber(str) }),
} end,
["(%d+)%% increased effect of small passive skills in radius"] = { },
}
for _, name in pairs(data.keystones) do
specialModList[name:lower()] = { mod("Keystone", "LIST", name) }
Expand Down
Loading