Adding top stat and per point for single stat heatmap

This commit is contained in:
Trevor Lund
2020-07-06 17:31:13 -05:00
parent e2b9fa0508
commit 9c1f5c8a05
3 changed files with 26 additions and 1 deletions

View File

@@ -453,8 +453,11 @@ function CalcsTabClass:PowerBuilder()
local cache = { }
local newPowerMax = {
singleStat = 0,
singleStatPerPoint = 0,
offence = 0,
defence = 0
offencePerPoint = 0,
defence = 0,
defencePerPoint = 0
}
if not self.powerMax then
self.powerMax = newPowerMax
@@ -474,6 +477,7 @@ function CalcsTabClass:PowerBuilder()
node.power.singleStat = self:CalculatePowerStat(self.powerStat, output, calcBase)
if node.path then
newPowerMax.singleStat = m_max(newPowerMax.singleStat, node.power.singleStat)
newPowerMax.singleStatPerPoint = m_max(node.power.singleStat / #node.path, newPowerMax.singleStatPerPoint)
end
else
if calcBase.Minion then
@@ -490,6 +494,9 @@ function CalcsTabClass:PowerBuilder()
if node.path then
newPowerMax.offence = m_max(newPowerMax.offence, node.power.offence)
newPowerMax.defence = m_max(newPowerMax.defence, node.power.defence)
newPowerMax.offencePerPoint = m_max(newPowerMax.offencePerPoint, node.power.offence / #node.path)
newPowerMax.defencePerPoint = m_max(newPowerMax.defencePerPoint, node.power.defence / #node.path)
end
end
end

View File

@@ -470,6 +470,14 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
-- Calculate color based on a single stat
local stat = m_max(node.power.singleStat or 0, 0)
local statCol = (stat / build.calcsTab.powerMax.singleStat * 1.5) ^ 0.5
local path = (node.alloc and node.depends) or self.tracePath or node.path or { }
if(self.heatMapStatPerPoint and self.heatMapTopPick) then
statCol = stat / #path == build.calcsTab.powerMax.singleStatPerPoint and 1.5 ^ 0.5 or 0
elseif self.heatMapStatPerPoint then
statCol = statCol / #path * 4
elseif self.heatMapTopPick then
statCol = stat == build.calcsTab.powerMax.singleStat and 1.5 ^ 0.5 or 0
end
if main.nodePowerTheme == "RED/BLUE" then
SetDrawColor(statCol, 0, 0)
elseif main.nodePowerTheme == "RED/GREEN" then

View File

@@ -83,6 +83,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
end)
self.controls.treeHeatMap = new("CheckBoxControl", {"LEFT",self.controls.treeSearch,"RIGHT"}, 130, 0, 20, "Show Node Power:", function(state)
self.viewer.showHeatMap = state
self.controls.treeHeatMapStatSelect.shown = state
end)
self.controls.treeHeatMapStatSelect = new("DropDownControl", {"LEFT",self.controls.treeHeatMap,"RIGHT"}, 8, 0, 150, 20, nil, function(index, value)
self:SetPowerCalc(value)
@@ -98,6 +99,15 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
t_insert(self.powerStatList, stat)
end
end
self.controls.treeHeatMapTopStat = new("CheckBoxControl", {"LEFT", self.controls.treeHeatMapStatSelect,"RIGHT"}, 130, 0, 20, "Show only top stat:", function(state)
self.viewer.heatMapTopPick = state
end )
self.controls.treeHeatMapStatPerPoint = new("CheckBoxControl", {"LEFT", self.controls.treeHeatMapTopStat,"RIGHT"}, 75, 0, 20, "Per point?", function(state)
self.viewer.heatMapStatPerPoint = state
end )
self.controls.specConvertText = new("LabelControl", {"BOTTOMLEFT",self.controls.specSelect,"TOPLEFT"}, 0, -14, 0, 16, "^7This is an older tree version, which may not be fully compatible with the current game version.")
self.controls.specConvertText.shown = function()
return self.showConvert