PathOfBuilding icon indicating copy to clipboard operation
PathOfBuilding copied to clipboard

Find nodes good both for offence and defence

Open chx opened this issue 1 year ago • 0 comments

Check for duplicates

  • [x] I've checked for duplicate open and closed issues by using the search function of the issue tracker

What platform are you running Path of Building on?

Windows

Is your feature request related to a problem?

No , it's not a problem, it's more of an idea.

Describe the solution you'd like

Iterate nodes as normal, calculate both Node Power both for full DPS change and eHP change as normal and record only the one where the percentage change is smaller. This would find nodes which are both good for offense and defense. Without knowing Lua or the codebase I copy-pasted CalcsTabClass:CalculatePowerStat, checked how CalcsTabClass:CalculateCombinedOffDefStat works, looked at Data.lua for names and got this:

function CalcsTabClass:CalculateGoodForOffenceDefenceStat(selection, original, modified)
	local originalFullDPS = original.FullDPS or 0
	local modifiedFullDPS = modified.FullDPS or 0
	if selection.transform then
		originalFullDPS = selection.transform(originalFullDPS)
		modifiedFullDPS = selection.transform(modifiedFullDPS)
	end
	local changeFullDPS = 0
	if originalFullDPS then
	    changeFullDPS = (originalFullDPS - modifiedFullDPS) / originalFullDPS
	end
	local originalTotalEHP = original.TotalEHP or 0
	local modifiedTotalEHP = modified.TotalEHP or 0
	if selection.transform then
		originalTotalEHP = selection.transform(originalTotalEHP)
		modifiedTotalEHP = selection.transform(modifiedTotalEHP)
	end
	local changeTotalEHP = 0
	if originalTotalEHP then
	    changeTotalEHP = (originalTotalEHP - modifiedTotalEHP) / originalTotalEHP
	end

	if changeTotalEHP < changeFullDPS then
	    return changeTotalEHP 
	else
	    return changeFullDPS
        end
end

Describe alternatives you've considered

No response

Additional context

No response

chx avatar Feb 17 '25 15:02 chx