Skip to content

Commit 40d7761

Browse files
author
LocalIdentity
committed
Original solution
1 parent b439e04 commit 40d7761

1 file changed

Lines changed: 13 additions & 22 deletions

File tree

src/Classes/PassiveSpec.lua

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,9 @@ function PassiveSpecClass:BuildClusterJewelGraphs()
16251625
node.alloc = true
16261626
if not self.allocNodes[nodeId] then
16271627
self.allocNodes[nodeId] = node
1628-
t_insert(self.allocExtendedNodes, nodeId)
1628+
if not isValueInArray(self.allocExtendedNodes, nodeId) then
1629+
t_insert(self.allocExtendedNodes, nodeId)
1630+
end
16291631
end
16301632
end
16311633
end
@@ -1715,6 +1717,10 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
17151717
end
17161718

17171719
local function addToAllocatedSubgraphNodes(node)
1720+
-- Don't add to allocSubgraphNodes if node already exists
1721+
if isValueInArray(self.allocSubgraphNodes, node.id) then
1722+
return false
1723+
end
17181724
local proxyGroup = matchGroup(expansionJewel.proxy)
17191725
if proxyGroup then
17201726
for id, data in pairs(importedNodes) do
@@ -1761,7 +1767,6 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
17611767
self.nodes[node.id] = node
17621768
if addToAllocatedSubgraphNodes(node) then
17631769
t_insert(self.allocSubgraphNodes, node.id)
1764-
t_insert(self.allocExtendedNodes, node.id)
17651770
end
17661771
return
17671772
end
@@ -1776,21 +1781,6 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
17761781
end
17771782
end
17781783

1779-
-- Check if we need to downsize the group
1780-
local groupSize = expansionJewel.size
1781-
upSize = upSize or 0
1782-
while clusterJewel.sizeIndex < groupSize do
1783-
-- Look for the socket with index 1 first (middle socket of large groups), then index 0
1784-
local socket = findSocket(proxyGroup, 1) or findSocket(proxyGroup, 0)
1785-
assert(socket, "Downsizing socket not found")
1786-
1787-
-- Grab the proxy node/group from the socket
1788-
proxyNode = self.tree.nodes[tonumber(socket.expansionJewel.proxy)]
1789-
proxyGroup = proxyNode.group
1790-
groupSize = socket.expansionJewel.size
1791-
upSize = upSize + 1
1792-
end
1793-
17941784
-- Initialise orbit flags
17951785
local nodeOrbit = clusterJewel.sizeIndex + 1
17961786
subGraph.group.oo[nodeOrbit] = true
@@ -2002,13 +1992,14 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
20021992
return m_floor(srcOidx * destNodesPerOrbit / srcNodesPerOrbit)
20031993
end
20041994
end
2005-
local proxyNodeSkillsPerOrbit = self.tree.skillsPerOrbit[proxyNode.o+1]
2006-
1995+
1996+
local skillsPerOrbit = self.tree.skillsPerOrbit[clusterJewel.sizeIndex+2]
1997+
local startOidx = data.clusterJewels.orbitOffsets[proxyNode.id][clusterJewel.sizeIndex]
20071998
-- Translate oidx positioning to TreeData-relative values
20081999
for _, node in pairs(indicies) do
2009-
local proxyNodeOidxRelativeToClusterIndicies = translateOidx(proxyNode.oidx, proxyNodeSkillsPerOrbit, clusterJewel.totalIndicies)
2010-
local correctedNodeOidxRelativeToClusterIndicies = (node.oidx + proxyNodeOidxRelativeToClusterIndicies) % clusterJewel.totalIndicies
2011-
local correctedNodeOidxRelativeToTreeSkillsPerOrbit = translateOidx(correctedNodeOidxRelativeToClusterIndicies, clusterJewel.totalIndicies, proxyNodeSkillsPerOrbit)
2000+
local startOidxRelativeToClusterIndicies = translateOidx(startOidx, skillsPerOrbit, clusterJewel.totalIndicies)
2001+
local correctedNodeOidxRelativeToClusterIndicies = (node.oidx + startOidx) % clusterJewel.totalIndicies
2002+
local correctedNodeOidxRelativeToTreeSkillsPerOrbit = translateOidx(correctedNodeOidxRelativeToClusterIndicies, clusterJewel.totalIndicies, skillsPerOrbit)
20122003
node.oidx = correctedNodeOidxRelativeToTreeSkillsPerOrbit
20132004
end
20142005

0 commit comments

Comments
 (0)