Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count secondary ascendancy nodes used #6958

Merged
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
12 changes: 7 additions & 5 deletions src/Classes/PassiveSpec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,13 @@ end

-- Count the number of allocated nodes and allocated ascendancy nodes
function PassiveSpecClass:CountAllocNodes()
local used, ascUsed, sockets = 0, 0, 0
local used, ascUsed, secondaryAscUsed, sockets = 0, 0, 0, 0
for _, node in pairs(self.allocNodes) do
if node.type ~= "ClassStart" and node.type ~= "AscendClassStart" and not (node.ascendancyName and (node.ascendancyName == "Warden" or node.ascendancyName == "Warlock" or node.ascendancyName == "Primalist")) then
if node.ascendancyName then
if not node.isMultipleChoiceOption then
if node.type ~= "ClassStart" and node.type ~= "AscendClassStart" then
if node.ascendancyName and not node.isMultipleChoiceOption then
if self.tree.secondaryAscendNameMap and self.tree.secondaryAscendNameMap[node.ascendancyName] then
secondaryAscUsed = secondaryAscUsed + 1
else
ascUsed = ascUsed + 1
end
else
Expand All @@ -700,7 +702,7 @@ function PassiveSpecClass:CountAllocNodes()
end
end
end
return used, ascUsed, sockets
return used, ascUsed, secondaryAscUsed, sockets
end

-- Attempt to find a class start node starting from the given node
Expand Down
2 changes: 2 additions & 0 deletions src/Classes/PassiveTree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
end

if self.alternate_ascendancies then
self.secondaryAscendNameMap = { }
local alternate_ascendancies_class = {
["name"]= "alternate_ascendancies",
["classes"]= self.alternate_ascendancies
Expand All @@ -133,6 +134,7 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
ascendClassId = ascendClassId,
ascendClass = ascendClass
}
self.secondaryAscendNameMap[ascendClass.id] = self.ascendNameMap[ascendClass.id]
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/Classes/PassiveTreeView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
overlay = isAlloc and node.startArt or "PSStartNodeBackgroundInactive"
elseif node.type == "AscendClassStart" then
overlay = treeVersions[tree.treeVersion].num >= 3.10 and "AscendancyMiddle" or "PassiveSkillScreenAscendancyMiddle"
if node.ascendancyName and (node.ascendancyName == "Warden" or node.ascendancyName == "Warlock" or node.ascendancyName == "Primalist") then
if node.ascendancyName and tree.secondaryAscendNameMap and tree.secondaryAscendNameMap[node.ascendancyName] then
overlay = "Azmiri"..overlay
end
else
Expand Down Expand Up @@ -541,7 +541,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
end
base = node.sprites[node.type:lower()..(isAlloc and "Active" or "Inactive")]
overlay = node.overlay[state .. (node.ascendancyName and "Ascend" or "") .. (node.isBlighted and "Blighted" or "")]
if node.ascendancyName and (node.ascendancyName == "Warden" or node.ascendancyName == "Warlock" or node.ascendancyName == "Primalist") then
if node.ascendancyName and tree.secondaryAscendNameMap and tree.secondaryAscendNameMap[node.ascendancyName] then
overlay = "Azmiri"..overlay
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/TreeTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
if mode ~= "OUT" then
local spec = self.specList[selIndex]
if spec then
local used, ascUsed, sockets = spec:CountAllocNodes()
local used, ascUsed, secondaryAscUsed, sockets = spec:CountAllocNodes()
tooltip:AddLine(16, "Class: "..spec.curClassName)
tooltip:AddLine(16, "Ascendancy: "..spec.curAscendClassName)
tooltip:AddLine(16, "Points used: "..used)
Expand Down
5 changes: 3 additions & 2 deletions src/Modules/Build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,9 @@ local function actExtra(act, extra)
end

function buildMode:EstimatePlayerProgress()
local PointsUsed, AscUsed = self.spec:CountAllocNodes()
local PointsUsed, AscUsed, SecondaryAscUsed = self.spec:CountAllocNodes()
local extra = self.calcsTab.mainOutput and self.calcsTab.mainOutput.ExtraPoints or 0
local usedMax, ascMax, level, act = 99 + 22 + extra, 8, 1, 0
local usedMax, ascMax, secondaryAscMax, level, act = 99 + 22 + extra, 8, 8, 1, 0

-- Find estimated act and level based on points used
repeat
Expand All @@ -782,6 +782,7 @@ function buildMode:EstimatePlayerProgress()

if PointsUsed > usedMax then InsertIfNew(self.controls.warnings.lines, "You have too many passive points allocated") end
if AscUsed > ascMax then InsertIfNew(self.controls.warnings.lines, "You have too many ascendancy points allocated") end
if SecondaryAscUsed > secondaryAscMax then InsertIfNew(self.controls.warnings.lines, "You have too many secondary ascendancy points allocated") end
self.Act = level < 90 and act <= 10 and act or "Endgame"

return string.format("%s%3d / %3d %s%d / %d", PointsUsed > usedMax and colorCodes.NEGATIVE or "^7", PointsUsed, usedMax, AscUsed > ascMax and colorCodes.NEGATIVE or "^7", AscUsed, ascMax),
Expand Down