@@ -778,11 +778,14 @@ function PassiveSpecClass:AllocNode(node, altPath)
778778 end
779779
780780 -- Allocate all nodes along the path
781+ local rebuildClusterJewelGraphs = false
781782 if # node .intuitiveLeapLikesAffecting > 0 then
783+ rebuildClusterJewelGraphs = not node .alloc and node .expansionJewel ~= nil
782784 node .alloc = true
783785 self .allocNodes [node .id ] = node
784786 else
785787 for _ , pathNode in ipairs (altPath or node .path ) do
788+ rebuildClusterJewelGraphs = rebuildClusterJewelGraphs or not pathNode .alloc and pathNode .expansionJewel ~= nil
786789 pathNode .alloc = true
787790 self .allocNodes [pathNode .id ] = pathNode
788791 end
@@ -799,8 +802,12 @@ function PassiveSpecClass:AllocNode(node, altPath)
799802 end
800803 end
801804
802- -- Rebuild all dependencies and paths for all allocated nodes
803- self :BuildAllDependsAndPaths ()
805+ if rebuildClusterJewelGraphs then
806+ self :BuildClusterJewelGraphs ()
807+ else
808+ -- Rebuild all dependencies and paths for all allocated nodes
809+ self :BuildAllDependsAndPaths ()
810+ end
804811end
805812
806813function PassiveSpecClass :DeallocSingleNode (node )
@@ -814,12 +821,18 @@ end
814821
815822-- Deallocate the given node, and all nodes which depend on it (i.e. which are only connected to the tree through this node)
816823function PassiveSpecClass :DeallocNode (node )
824+ local rebuildClusterJewelGraphs = false
817825 for _ , depNode in ipairs (node .depends ) do
826+ rebuildClusterJewelGraphs = rebuildClusterJewelGraphs or depNode .alloc and depNode .expansionJewel ~= nil
818827 self :DeallocSingleNode (depNode )
819828 end
820829
821- -- Rebuild all paths and dependencies for all allocated nodes
822- self :BuildAllDependsAndPaths ()
830+ if rebuildClusterJewelGraphs then
831+ self :BuildClusterJewelGraphs ()
832+ else
833+ -- Rebuild all paths and dependencies for all allocated nodes
834+ self :BuildAllDependsAndPaths ()
835+ end
823836end
824837
825838-- Count the number of allocated nodes and allocated ascendancy nodes
@@ -1765,7 +1778,7 @@ function PassiveSpecClass:BuildClusterJewelGraphs()
17651778 for nodeId in pairs (self .tree .sockets ) do
17661779 local node = self .tree .nodes [nodeId ]
17671780 local jewel = self :GetSocketedJewel (nodeId )
1768- if node and node .expansionJewel and node .expansionJewel .size == 2 and jewel and jewel .jewelData .clusterJewelValid then
1781+ if node and self . allocNodes [ node . id ] and node .expansionJewel and node .expansionJewel .size == 2 and jewel and jewel .jewelData .clusterJewelValid then
17691782 -- This is a Large Jewel Socket, and it has a cluster jewel in it
17701783 self :BuildSubgraph (jewel , self .nodes [nodeId ], nil , nil , importedNodes , importedGroups )
17711784 end
@@ -1971,7 +1984,9 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
19711984 if proxyGroup then
19721985 for id , data in pairs (importedNodes ) do
19731986 if proxyGroup == data .group then
1974- if node .oidx == data .orbitIndex and not data .isMastery then
1987+ local matches = node .type == " Keystone" and data .isKeystone
1988+ or (node .oidx == data .orbitIndex and not data .isMastery )
1989+ if matches then
19751990 for _ , extendedId in ipairs (importedGroups [proxyGroup ].nodes ) do
19761991 if id == extendedId and inExtendedHashes (tonumber (id )) then
19771992 return true
@@ -2265,7 +2280,8 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
22652280 if node .type == " Socket" then
22662281 -- Recurse to smaller jewels
22672282 local jewel = self :GetSocketedJewel (node .id )
2268- if jewel and jewel .jewelData .clusterJewelValid then
2283+ -- Allocated subgraph nodes are temporarily preserved outside allocNodes while rebuilding.
2284+ if (self .allocNodes [node .id ] or isValueInArray (self .allocSubgraphNodes , node .id )) and jewel and jewel .jewelData .clusterJewelValid then
22692285 self :BuildSubgraph (jewel , node , id , upSize , importedNodes , importedGroups )
22702286 end
22712287 end
0 commit comments