Skip to content

Commit 3d19ef7

Browse files
justjuanguijustjuanguiLocalIdentity
authored
Add 0.4 Passive Tree (#1549)
* 0.4 Passive tree enable * Add connectionArt and nodeOverlay definitions to tree data files * Add unlock constraint validation to pathfinding logic * Add special modifier for Druid - "walk the paths not taken" * Add support for bonded modifiers in item parsing and modifier tags * Add ignoreSourceinCheckConditions flag to modifier configuration * Update comment --------- Co-authored-by: justjuangui <[email protected]> Co-authored-by: LocalIdentity <[email protected]>
1 parent a62f8b9 commit 3d19ef7

File tree

135 files changed

+126791
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+126791
-123
lines changed

src/Classes/CalcBreakdownControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ function CalcBreakdownClass:AddModSection(sectionData, modList)
274274
-- Build list of modifiers to display
275275
local cfg = (sectionData.cfg and actor.mainSkill[sectionData.cfg.."Cfg"] and copyTable(actor.mainSkill[sectionData.cfg.."Cfg"], true)) or { }
276276
cfg.source = sectionData.modSource
277+
cfg.ignoreSourceinCheckConditions = true
277278
cfg.actor = sectionData.actor
278279
local rowList
279280
local modStore = (sectionData.enemy and actor.enemy.modDB) or (sectionData.cfg and actor.mainSkill.skillModList) or actor.modDB

src/Classes/CalcSectionControl.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ function CalcSectionClass:FormatStr(str, actor, colData)
190190
local modCfg = (sectionData.cfg and actor.mainSkill[sectionData.cfg.."Cfg"]) or { }
191191
if sectionData.modSource then
192192
modCfg.source = sectionData.modSource
193+
modCfg.ignoreSourceinCheckConditions = true
193194
end
194195
if sectionData.actor then
195196
modCfg.actor = sectionData.actor

src/Classes/Item.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,12 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
628628
end
629629
return ""
630630
end)
631+
632+
-- Used to flag Bonded soul core mods
633+
if line:find("Bonded:") then
634+
modLine.bonded = true
635+
end
636+
631637
if modLine.rune then
632638
modLine.enchant = true
633639
end

src/Classes/ModDB.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ function ModDBClass:FlagInternal(context, cfg, flags, keywordFlags, source, ...)
158158
if modList then
159159
for i = 1, #modList do
160160
local mod = modList[i]
161-
if mod.type == "FLAG" and band(flags, mod.flags) == mod.flags and MatchKeywordFlags(keywordFlags, mod.keywordFlags) and (not source or mod.source:match("[^:]+") == source) then
161+
local checkSource = not cfg or not cfg.ignoreSourceinCheckConditions
162+
if mod.type == "FLAG" and band(flags, mod.flags) == mod.flags and MatchKeywordFlags(keywordFlags, mod.keywordFlags) and (not checkSource or not source or mod.source:match("[^:]+") == source) then
162163
if mod[1] then
163164
if context:EvalMod(mod, cfg) then
164165
return true

src/Classes/PassiveSpec.lua

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,14 @@ function PassiveSpecClass:BuildPathFromNode(root)
836836
-- All nodes that are 1 node away from the root will be processed first, then all nodes that are 2 nodes away, etc
837837
local node = queue[o]
838838
o = o + 1
839+
840+
if node.unlockConstraint then
841+
for _, nodeId in ipairs(node.unlockConstraint.nodes) do
842+
if not self.nodes[nodeId].alloc then
843+
goto continue
844+
end
845+
end
846+
end
839847
local curDist = node.pathDist
840848
-- Iterate through all nodes that are connected to this one
841849
for _, other in ipairs(node.linked) do
@@ -845,10 +853,23 @@ function PassiveSpecClass:BuildPathFromNode(root)
845853
-- The one exception to that rule is that a path may start from an ascendancy node and pass into the main tree
846854
-- This permits pathing from the Ascendant 'Path of the X' nodes into the respective class start areas
847855
-- 3. They must not pass away from mastery nodes
856+
-- 4. Unlock constraints must be satisfied
857+
858+
-- validate if the other node have unlockConstraints met
859+
local canPath = true
860+
if other.unlockConstraint then
861+
for _, nodeId in ipairs(other.unlockConstraint.nodes) do
862+
if not self.nodes[nodeId].alloc then
863+
canPath = false
864+
break
865+
end
866+
end
867+
end
868+
848869
if not other.pathDist then
849870
ConPrintTable(other, true)
850871
end
851-
if node.type ~= "Mastery" and other.type ~= "ClassStart" and other.type ~= "AscendClassStart" and other.pathDist > curDist and (node.ascendancyName == other.ascendancyName or (curDist == 0 and not other.ascendancyName)) then
872+
if node.type ~= "Mastery" and other.type ~= "ClassStart" and other.type ~= "AscendClassStart" and other.pathDist > curDist and (node.ascendancyName == other.ascendancyName or (curDist == 0 and not other.ascendancyName)) and canPath then
852873
-- The shortest path to the other node is through the current node
853874
other.pathDist = curDist
854875
if not other.alloc then
@@ -864,6 +885,7 @@ function PassiveSpecClass:BuildPathFromNode(root)
864885
i = i + 1
865886
end
866887
end
888+
::continue::
867889
end
868890
end
869891

@@ -1021,6 +1043,16 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
10211043
end
10221044

10231045
for _, node in pairs(self.nodes) do
1046+
-- if the node have unlockConstraints, add this node as dependent to the constraint nodes
1047+
-- we are running here after wiping all depends above
1048+
if node.unlockConstraint then
1049+
for _, nodeId in ipairs(node.unlockConstraint.nodes) do
1050+
if self.nodes[nodeId] then
1051+
t_insert(self.nodes[nodeId].depends, node)
1052+
end
1053+
end
1054+
end
1055+
10241056
-- set attribute nodes
10251057
if self.hashOverrides[node.id] then
10261058
self:ReplaceNode(node, self.hashOverrides[node.id])

src/Classes/PassiveTree.lua

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -137,47 +137,6 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
137137
end
138138
end
139139

140-
self.nodeOverlay = {
141-
Normal = {
142-
artWidth = 70,
143-
alloc = "PSSkillFrameActive",
144-
path = "PSSkillFrameHighlighted",
145-
unalloc = "PSSkillFrame",
146-
allocAscend = "AscendancyFrameSmallAllocated",
147-
pathAscend = "AscendancyFrameSmallCanAllocate",
148-
unallocAscend = "AscendancyFrameSmallNormal"
149-
},
150-
Notable = {
151-
artWidth = 100,
152-
alloc = "NotableFrameAllocated",
153-
path = "NotableFrameCanAllocate",
154-
unalloc = "NotableFrameUnallocated",
155-
allocAscend = "AscendancyFrameLargeAllocated",
156-
pathAscend = "AscendancyFrameLargeCanAllocate",
157-
unallocAscend = "AscendancyFrameLargeNormal",
158-
allocBlighted = "BlightedNotableFrameAllocated",
159-
pathBlighted = "BlightedNotableFrameCanAllocate",
160-
unallocBlighted = "BlightedNotableFrameUnallocated",
161-
},
162-
Keystone = {
163-
artWidth = 138,
164-
alloc = "KeystoneFrameAllocated",
165-
path = "KeystoneFrameCanAllocate",
166-
unalloc = "KeystoneFrameUnallocated",
167-
allocBlighted = "KeystoneFrameAllocated",
168-
pathBlighted = "KeystoneFrameCanAllocate",
169-
unallocBlighted = "KeystoneFrameUnallocated",
170-
},
171-
Socket = {
172-
artWidth = 100,
173-
alloc = "JewelFrameAllocated",
174-
path = "JewelFrameCanAllocate",
175-
unalloc = "JewelFrameUnallocated",
176-
allocAlt = "JewelSocketAltActive",
177-
pathAlt = "JewelSocketAltCanAllocate",
178-
unallocAlt = "JewelSocketAltNormal",
179-
},
180-
}
181140
for type, data in pairs(self.nodeOverlay) do
182141
local asset = self:GetAssetByName(data.alloc)
183142
local artWidth = asset.width * self.scaleImage
@@ -518,7 +477,21 @@ end
518477
-- Common processing code for nodes (used for both real tree nodes and subgraph nodes)
519478
function PassiveTreeClass:ProcessNode(node)
520479
node.targetSize = self:GetNodeTargetSize(node)
521-
node.overlay = node.containJewelSocket and node.jewelOverlay or self.nodeOverlay[node.type]
480+
local overlayData
481+
if node.nodeOverlay then
482+
overlayData = { }
483+
for type, data in pairs(node.nodeOverlay) do
484+
overlayData[type] = data
485+
end
486+
local asset = self:GetAssetByName(overlayData.alloc)
487+
local artWidth = asset.width * self.scaleImage
488+
overlayData.artWidth = artWidth
489+
overlayData.size = artWidth
490+
overlayData.rsq = overlayData.size * overlayData.size
491+
else
492+
overlayData = self.nodeOverlay[node.type]
493+
end
494+
node.overlay = overlayData
522495
if node.overlay then
523496
local size = node.targetSize["overlay"] and node.targetSize["overlay"].width or node.targetSize.width
524497
node.rsq = size * size
@@ -588,6 +561,7 @@ end
588561
function PassiveTreeClass:BuildConnector(node1, node2, connection)
589562
local connector = {
590563
ascendancyName = node1.ascendancyName,
564+
connectionArt = node1.connectionArt or node2.connectionArt or self.connectionArt[node1.ascendancyName and "ascendancy" or "default"],
591565
nodeId1 = node1.id,
592566
nodeId2 = node2.id,
593567
c = { } -- This array will contain the quad's data: 1-8 are the vertex coordinates, 9-16 are the texture coordinates
@@ -682,7 +656,7 @@ function PassiveTreeClass:BuildConnector(node1, node2, connection)
682656

683657
-- Generate a straight line
684658
connector.type = "LineConnector"
685-
local art = self:GetAssetByName("LineConnectorNormal")
659+
local art = self:GetAssetByName(connector.connectionArt .. "LineConnectorNormal")
686660
local vX, vY = node2.x - node1.x, node2.y - node1.y
687661
local dist = m_sqrt(vX * vX + vY * vY)
688662
local scale = art.height * 0.5 * self.scaleImage / dist
@@ -718,7 +692,7 @@ function PassiveTreeClass:BuildArc(arcAngle, orbit, xScale, yScale, angle, conne
718692
connector.vert = { }
719693
for _, state in pairs({ "Normal", "Intermediate", "Active" }) do
720694
-- The different line states have differently-sized artwork, so the vertex coords must be calculated separately for each one
721-
local art = self:GetAssetByName(connector.type .. state)
695+
local art = self:GetAssetByName( connector.connectionArt .. connector.type .. state)
722696
local size = art.width * self.scaleImage --self.orbitRadii[orbit + 1] * self.scaleImage
723697
local oX, oY = size * m_sqrt(2) * m_sin(angle + m_pi / 4), size * m_sqrt(2) * -m_cos(angle + m_pi / 4)
724698
local cX, cY = xScale + oX, yScale + oY

src/Classes/PassiveTreeView.lua

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
528528
setConnectorColor(0.75, 0.75, 0.75)
529529
end
530530
SetDrawColor(unpack(connectorColor))
531-
handle = tree:GetAssetByName(connector.type..state).handle
531+
handle = tree:GetAssetByName(connector.connectionArt .. connector.type..state).handle
532532
DrawImageQuad(handle, unpack(connector.c))
533533
end
534534

@@ -671,11 +671,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
671671

672672
base = tree:GetAssetByName(node.icon)
673673

674-
overlay = node.overlay[state .. (node.ascendancyName and "Ascend" or "") .. (node.isBlighted and "Blighted" or "")]
675-
676-
if node.ascendancyName and tree.secondaryAscendNameMap and tree.secondaryAscendNameMap[node.ascendancyName] then
677-
overlay = "Azmeri"..overlay
678-
end
674+
overlay = node.overlay[state]
679675
end
680676
end
681677

@@ -1119,6 +1115,15 @@ function PassiveTreeViewClass:DoesNodeMatchSearchParams(node)
11191115
if #needMatches == 0 then
11201116
return true
11211117
end
1118+
1119+
-- Check unlock ascendancy
1120+
if node.unlockConstraint then
1121+
err, needMatches = PCall(search, node.unlockConstraint.ascendancy:lower(), needMatches)
1122+
if err then return false end
1123+
if #needMatches == 0 then
1124+
return true
1125+
end
1126+
end
11221127

11231128
-- Check node id for devs
11241129
if launch.devMode then

0 commit comments

Comments
 (0)