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

Find nodes good both for offence and defence #8490

Open
1 task done
chx opened this issue Feb 17, 2025 · 0 comments
Open
1 task done

Find nodes good both for offence and defence #8490

chx opened this issue Feb 17, 2025 · 0 comments
Labels
enhancement New feature, calculation, or mod

Comments

@chx
Copy link
Contributor

chx commented Feb 17, 2025

Check for duplicates

  • 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 chx added the enhancement New feature, calculation, or mod label Feb 17, 2025
@chx chx changed the title Make offense/defense search work Find nodes good both for offense and defense Feb 17, 2025
@chx chx changed the title Find nodes good both for offense and defense Find nodes good both for offence and defence Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, calculation, or mod
Projects
None yet
Development

No branches or pull requests

1 participant