Skip to content

Commit

Permalink
feat: disable score validation by judgement for DDR (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyoo authored Aug 18, 2024
1 parent 8a57bc0 commit 4c1651a
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions server/src/game-implementations/games/ddr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,40 @@ const DDR_GOAL_PG_FMT: GPTGoalProgressFormatters<"ddr:DP" | "ddr:SP"> = {
};

export const DDR_SCORE_VALIDATORS: Array<ScoreValidator<"ddr:DP" | "ddr:SP">> = [
(s) => {
const { MARVELOUS, PERFECT, GREAT, GOOD, OK, MISS } = s.scoreData.judgements;

if (
IsNullish(MARVELOUS) ||
IsNullish(PERFECT) ||
IsNullish(GREAT) ||
IsNullish(GOOD) ||
IsNullish(OK) ||
IsNullish(MISS)
) {
return;
}

const stepScore = 1_000_000 / (MARVELOUS + PERFECT + GREAT + GOOD + OK + MISS);
const calculatedScore =
Math.floor(
(stepScore * (MARVELOUS + OK) +
(stepScore - 10) * PERFECT +
((stepScore * 3) / 5 - 10) * GREAT +
(stepScore / 5 - 10) * GOOD) /
10
) * 10;

if (calculatedScore !== s.scoreData.score) {
return `Expected calculated score from judgements of ${calculatedScore} to equal score of ${s.scoreData.score}.`;
}
},
// Score validation with judgements is disabled until we have stepCount + holdCount for every chart.
// Using the sum of all judgements does not work in case of missed holds.
// (s) => {
// if (s.scoreData.lamp === "FAILED") {
// return;
// }
//
// const { MARVELOUS, PERFECT, GREAT, GOOD, OK, MISS } = s.scoreData.judgements;
//
// if (
// IsNullish(MARVELOUS) ||
// IsNullish(PERFECT) ||
// IsNullish(GREAT) ||
// IsNullish(GOOD) ||
// IsNullish(OK) ||
// IsNullish(MISS)
// ) {
// return;
// }
//
// const stepScore = 1_000_000 / (MARVELOUS + PERFECT + GREAT + GOOD + OK + MISS);
// const calculatedScore =
// Math.floor(
// (stepScore * (MARVELOUS + OK) +
// (stepScore - 10) * PERFECT +
// ((stepScore * 3) / 5 - 10) * GREAT +
// (stepScore / 5 - 10) * GOOD) /
// 10
// ) * 10;
//
// if (calculatedScore !== s.scoreData.score) {
// return `Expected calculated score from judgements of ${calculatedScore} to equal score of ${s.scoreData.score}.`;
// }
// },
(s) => {
const { MARVELOUS, PERFECT, GREAT, GOOD, MISS } = s.scoreData.judgements;

Expand Down

0 comments on commit 4c1651a

Please sign in to comment.