Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 369x 369x 369x 369x 666x 136x 9294x 1x 9293x 9293x 9156x 91x 9065x 9065x 6012x 5778x 5337x 4494x 3002x 2390x 2177x 9046x 9046x 49x 8997x 48922x 48922x 48922x 369x | /**
* The score vocabulary: the judgment counts and scores of a play, its score rate, its DJ Rank and LR2's money score.
* Every judge ruleset scores with it, and hosts, skins and the Leaderboard read a result with it
* (`@be-music/player-engine/ruleset`). The engine's running combo and the trackers that fill a summary stay in `core/scoring`.
*/
export type JudgmentKind = 'PERFECT' | 'GREAT' | 'GOOD' | 'BAD' | 'POOR';
export interface ScoreSummary {
/** Final combo eligibility when empty POOR can break combo; absent in legacy/count-only results. */
fullCombo?: boolean;
total: number;
perfect: number;
great: number;
good: number;
bad: number;
poor: number;
/** Empty POOR (空POOR) count — see `PlayerSummary.emptyPoor`. Never a note judgment, so `applyJudgeToSummary`
* does not touch it; the engine increments it on the empty-POOR path. */
emptyPoor: number;
/** LR2 mine hits already included in `poor`; not judgment notes and never a combo break. */
minePoor?: number;
exScore: number;
score: number;
}
export const _____EX_SCORE_PER_PGREAT = 2;
export const _____EX_SCORE_PER_GREAT = 1;
/** LR2's money-score ceiling: `(4 × PGREAT) × 50000 / notes` reaches exactly this on a full PGREAT clear. */
export const LR2_MONEY_SCORE_MAX = 200000;
const LR2_MONEY_SCORE_UNIT = 50000;
export function createEmptyScore(total: number): ScoreSummary {
return { total, perfect: 0, great: 0, good: 0, bad: 0, poor: 0, emptyPoor: 0, exScore: 0, score: 0 };
}
/**
* The POOR figure a ruleset's own result screen shows. LR2 folds empty POORs into it (OpenLR2 `ApplyJudgeNote`
* increments `playerstat.poor` for the empty-POOR branch, and LR2 exposes no separate stat), so a run judged under
* LR2 must display the sum to match the real thing. Rulesets that report them apart pass `false`.
*/
export function resolveDisplayedPoor(
score: Pick<ScoreSummary, 'poor' | 'emptyPoor'>,
emptyPoorCountsInPoor: boolean,
): number {
return emptyPoorCountsInPoor ? score.poor + score.emptyPoor : score.poor;
}
export function computeScoreRate(score: Pick<ScoreSummary, 'total' | 'exScore'>): number {
if (score.total <= 0) {
return 0;
}
const max = score.total * _____EX_SCORE_PER_PGREAT;
return Math.max(0, Math.min(1, score.exScore / max));
}
export function resolve____RankIndexFromScore(score: Pick<ScoreSummary, 'total' | 'exScore'>): number | undefined {
if (score.total <= 0) {
return undefined;
}
return resolve____RankIndexFromRate(computeScoreRate(score));
}
export function resolve____RankIndexFromRate(rate: number): number {
if (rate >= 8 / 9) return 0;
if (rate >= 7 / 9) return 1;
if (rate >= 6 / 9) return 2;
if (rate >= 5 / 9) return 3;
if (rate >= 4 / 9) return 4;
if (rate >= 3 / 9) return 5;
if (rate >= 2 / 9) return 6;
return 7;
}
export function resolve____RankLabel(exScore: number, total: number): string {
const rankIndex = resolve____RankIndexFromScore({ exScore, total });
if (rankIndex === undefined) {
return '-';
}
return _____RANK_LABELS[rankIndex]!;
}
/**
* LR2's money score: `floor((4×PGREAT + 2×GREAT + GOOD) × 50000 / notes)`, capped at 200000 (OpenLR2
* `LR2_play.cpp`). Purely a function of the judge tally — no combo bonus, unlike the invented curve this replaced.
*/
export function resolveLR2MoneyScore(summary: Pick<ScoreSummary, 'total' | 'perfect' | 'great' | 'good'>): number {
const notes = Math.max(1, summary.total);
const weighted = 4 * summary.perfect + 2 * summary.great + summary.good;
return Math.min(LR2_MONEY_SCORE_MAX, Math.floor((weighted * LR2_MONEY_SCORE_UNIT) / notes));
}
/** The DJ Ranks (DJ LEVEL) on the That-Which-Must-Not-Be-Named ninths, best first: the labels `resolve____RankLabel` returns. */
export const _____RANK_LABELS = ['AAA', 'AA', 'A', 'B', 'C', 'D', 'E', 'F'] as const;
export type ____RankLabel = (typeof _____RANK_LABELS)[number];
|