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

fix: dps scoring bug fixes #692

Draft
wants to merge 2 commits into
base: beta
Choose a base branch
from
Draft
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
54 changes: 33 additions & 21 deletions src/lib/characterScorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,30 +514,42 @@ function simulateMaximumBuild(
// Spheres with DMG % are unique because they can alter a build due to DMG % not being a substat.
// Permute the sphere options to find the best
for (const sphereMainStat of metadata.parts[Parts.PlanarSphere]) {
const bestSimClone: Simulation = TsUtils.clone(bestSim)
bestSimClone.request.simPlanarSphere = sphereMainStat
for (const feetMainStat of metadata.parts[Parts.Feet]) {
const bestSimClone: Simulation = TsUtils.clone(bestSim)
bestSimClone.request.simPlanarSphere = sphereMainStat
bestSimClone.request.simFeet = feetMainStat

const partialSimulationWrapper: PartialSimulationWrapper = {
simulation: bestSimClone,
finalSpeed: 0, // not needed
speedRollsDeduction: spdRolls,
}
let spdRolls = TsUtils.precisionRound(bestSim.request.stats[Stats.SPD] * benchmarkScoringParams.speedRollValue / maximumScoringParams.speedRollValue, 3)

const minSubstatRollCounts = calculateMinSubstatRollCounts(partialSimulationWrapper, maximumScoringParams)
const maxSubstatRollCounts = calculateMaxSubstatRollCounts(partialSimulationWrapper, metadata, maximumScoringParams, baselineSimResult, simulationFlags)
Object.values(SubStats).map((x) => partialSimulationWrapper.simulation.request.stats[x] = maxSubstatRollCounts[x])
const maxSim = computeOptimalSimulation(
partialSimulationWrapper,
minSubstatRollCounts,
maxSubstatRollCounts,
simulationForm,
context,
applyScoringFunction,
metadata,
maximumScoringParams,
)
if (feetMainStat == Stats.SPD && bestSim.request.simFeet != Stats.SPD) {
spdRolls = TsUtils.precisionRound((bestSim.request.stats[Stats.SPD] * benchmarkScoringParams.speedRollValue - 25.032) / maximumScoringParams.speedRollValue, 3)
}
if (feetMainStat != Stats.SPD && bestSim.request.simFeet == Stats.SPD) {
spdRolls = TsUtils.precisionRound((bestSim.request.stats[Stats.SPD] * benchmarkScoringParams.speedRollValue + 25.032) / maximumScoringParams.speedRollValue, 3)
}

maximumSimulations.push(maxSim)
const partialSimulationWrapper: PartialSimulationWrapper = {
simulation: bestSimClone,
finalSpeed: 0, // not needed
speedRollsDeduction: spdRolls,
}

const minSubstatRollCounts = calculateMinSubstatRollCounts(partialSimulationWrapper, maximumScoringParams)
const maxSubstatRollCounts = calculateMaxSubstatRollCounts(partialSimulationWrapper, metadata, maximumScoringParams, baselineSimResult, simulationFlags)
Object.values(SubStats).map((x) => partialSimulationWrapper.simulation.request.stats[x] = maxSubstatRollCounts[x])
const maxSim = computeOptimalSimulation(
partialSimulationWrapper,
minSubstatRollCounts,
maxSubstatRollCounts,
simulationForm,
context,
applyScoringFunction,
metadata,
maximumScoringParams,
)

maximumSimulations.push(maxSim)
}
}

// Find the highest scoring
Expand Down