Skip to content
Open
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
26 changes: 20 additions & 6 deletions src/Classes/CalcsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,18 @@ function CalcsTabClass:BuildPower()
end
end

-- Nodes with the same modKey can still calculate differently: radius jewels only apply to the nodes in their radius,
-- and tattoos are counted by type and boosted by jewels such as Warrior's Tale
local function powerCacheKey(env, node)
local key = node.modKey .. "|" .. node.type .. (node.isTattoo and "|" .. tostring(node.overrideType) or "")
for index, rad in ipairs(env.radiusJewelList) do
if rad.nodes[node.id] then
key = key .. "|" .. index
end
end
return key
end

-- Estimate the offensive and defensive power of all unallocated nodes
function CalcsTabClass:PowerBuilder()
-- local timer_start = GetTime()
Expand Down Expand Up @@ -610,10 +622,11 @@ function CalcsTabClass:PowerBuilder()
end
for nodeId, node in pairs(nodes) do
if not node.alloc and node.modKey ~= "" and not self.mainEnv.grantedPassives[nodeId] then
if not cache[node.modKey] then
cache[node.modKey] = calcFunc({ addNodes = { [node] = true } }, useFullDPS)
local key = powerCacheKey(self.mainEnv, node)
if not cache[key] then
cache[key] = calcFunc({ addNodes = { [node] = true } }, useFullDPS)
end
local output = cache[node.modKey]
local output = cache[key]
calculateAddNodePower(node.power, distance, node, output, function()
local pathNodes = { }
for _, pathNode in pairs(node.path) do
Expand All @@ -622,10 +635,11 @@ function CalcsTabClass:PowerBuilder()
return pathNodes
end)
elseif node.alloc and node.modKey ~= "" and not self.mainEnv.grantedPassives[nodeId] then
if not cache[node.modKey.."_remove"] then
cache[node.modKey.."_remove"] = calcFunc({ removeNodes = { [node] = true } }, useFullDPS)
local key = powerCacheKey(self.mainEnv, node).."_remove"
if not cache[key] then
cache[key] = calcFunc({ removeNodes = { [node] = true } }, useFullDPS)
end
local output = cache[node.modKey.."_remove"]
local output = cache[key]
if self.powerStat and self.powerStat.stat and not self.powerStat.ignoreForNodes then
node.power.singleStat = self:CalculatePowerStat(self.powerStat, output, calcBase)
if node.depends and not node.ascendancyName then
Expand Down