mania-judge 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -34
- package/README.zh-CN.md +121 -0
- package/dist/index.d.mts +90 -16
- package/dist/index.mjs +709 -259
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,69 +1,129 @@
|
|
|
1
1
|
# mania-judge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Simulates osu!mania judgements, combo, life and ScoreV1 from `.osu` + `.osr` data.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The design goal is a **faithful reproduction of osu!stable** rather than an approximation:
|
|
6
|
+
judgement is evaluated per column (each column only talks to its own notes and its own
|
|
7
|
+
input), and the whole run is judged first, then combo / life / score are derived from the
|
|
8
|
+
resulting judgement list.
|
|
9
|
+
|
|
10
|
+
- [中文说明](./README.zh-CN.md)
|
|
11
|
+
- [osu!v1 判定逻辑](./doc/osu-v1-mania-judgement.md)(中文)
|
|
12
|
+
- [osu!v1 时间轴逻辑](./doc/osu-v1-timeline.md)(中文)
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install mania-judge
|
|
18
|
+
# or
|
|
19
|
+
pnpm add mania-judge
|
|
20
|
+
# or
|
|
21
|
+
yarn add mania-judge
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
ESM only, with bundled type declarations and no runtime dependencies.
|
|
6
25
|
|
|
7
26
|
## Status
|
|
8
27
|
|
|
9
|
-
|
|
10
|
-
|
|
28
|
+
Work in progress. Numbers below come from 97 replay fixtures (7K–18K mania maps) that are
|
|
29
|
+
compared against the counts / score / combo stored in the `.osr` header.
|
|
30
|
+
|
|
31
|
+
### v1 (osu!stable)
|
|
11
32
|
|
|
12
|
-
|
|
33
|
+
**Judgement** — column-based state machine driven by the replay's raw frame times.
|
|
13
34
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
- 90 / 97 fixtures match the header's six-tier counts exactly.
|
|
36
|
+
- The remaining 7 fixtures differ by 1–5 events out of 1.5k–14k objects (all 7K maps).
|
|
37
|
+
This residual is **not** a deviation of this library from stable: the header stores the
|
|
38
|
+
counts of the original play, while stable re-judges when replaying. On a full-map test
|
|
39
|
+
(Life is Piano 7K, 1473 objects) the game's replay re-judgement gives
|
|
40
|
+
783/508/138/**26**/8/**10** versus the header's 25/11, and matches this library exactly
|
|
41
|
+
(max combo included). See [doc/osu-v1-mania-judgement.md](doc/osu-v1-mania-judgement.md).
|
|
42
|
+
|
|
43
|
+
**Timeline** — combo / life / ScoreV1 derived from the judgement list.
|
|
44
|
+
|
|
45
|
+
| Item | Exact | Note |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| max combo | 73 / 97 | the rest are off by ±1 |
|
|
48
|
+
| ScoreV1 | 43 / 97 | the rest are off by a median of ±50 (≈0.01%), worst 1136 (0.15%) |
|
|
49
|
+
|
|
50
|
+
Judgement and timeline are tested separately (`tests/osu-v1-judgement.test.ts`,
|
|
51
|
+
`tests/osu-v1-timeline.test.ts`), with exact assertions and no tolerance.
|
|
18
52
|
|
|
19
53
|
### lazer
|
|
20
54
|
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
- Hold: validated by accuracy-only tests with average error capped at 0.001 and max error capped at 0.002.
|
|
24
|
-
- Mods fixtures: accuracy-only tests cap average error at 0.0005 and max error at 0.002.
|
|
55
|
+
**tap-only is exact**: 38 / 38 fixtures match the header's six-tier counts, max combo exact on
|
|
56
|
+
37 / 38.
|
|
25
57
|
|
|
26
|
-
|
|
58
|
+
Long notes are implemented (head and tail judged separately, break → repress supported, tail capped
|
|
59
|
+
to Meh when the head was missed or the body broke) but **not exact yet**:
|
|
60
|
+
|
|
61
|
+
| Group | Exact | Total \|Δ\| | Per fixture |
|
|
62
|
+
| --- | --- | --- | --- |
|
|
63
|
+
| hold | 1 / 31 | 726 | ≈ 23 events |
|
|
64
|
+
| mods | 0 / 12 | 348 | ≈ 29 events |
|
|
27
65
|
|
|
28
|
-
|
|
66
|
+
The residual is pure misclassification between Perfect / Great / Good: the number of events and the
|
|
67
|
+
Miss / Meh totals match, and the error is the same size in both directions. It points at the timing
|
|
68
|
+
edge cases of the tail rather than at the event structure.
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
29
71
|
|
|
30
72
|
```ts
|
|
31
73
|
import { v1, calcAccuracy } from 'mania-judge'
|
|
32
74
|
|
|
33
75
|
const judgements = v1.playOsu(osuData)
|
|
34
|
-
const frames = v1.generateFramesOsu(judgements, osuData.hp)
|
|
35
|
-
const
|
|
76
|
+
const frames = v1.generateFramesOsu(judgements, osuData.hp, ['HR'])
|
|
77
|
+
const last = frames.at(-1)!
|
|
78
|
+
|
|
79
|
+
console.log(last.resultCounts, last.maxCombo, last.life, last.score)
|
|
80
|
+
console.log(calcAccuracy(last.resultCounts, v1.accTable))
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The third argument of `generateFramesOsu` is the replay's mod list; it only affects ScoreV1
|
|
84
|
+
(`NF` / `EZ` / `HT` halve the score).
|
|
36
85
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
86
|
+
```ts
|
|
87
|
+
// ScoreV1 on its own
|
|
88
|
+
const score = v1.calculateScoreV1(judgements.flat(), ['DT'])
|
|
41
89
|
```
|
|
42
90
|
|
|
43
|
-
###
|
|
91
|
+
### Loading a replay
|
|
44
92
|
|
|
45
|
-
|
|
93
|
+
This library has no runtime dependencies and does not touch files: it takes plain data, and
|
|
94
|
+
`createOsuData` accepts **any** object shape-compatible with `BeatmapLike` / `ReplayLike`.
|
|
95
|
+
With [`osu-mania-io`](https://github.com/zzzzv/osu-mania-io):
|
|
46
96
|
|
|
47
97
|
```ts
|
|
48
98
|
import { parseBeatmap } from 'osu-mania-io/beatmap'
|
|
49
99
|
import { parseReplay } from 'osu-mania-io/replay'
|
|
50
100
|
import { applyLegacyBeatmapMods } from 'osu-mania-io/mod'
|
|
51
|
-
import {
|
|
101
|
+
import { createOsuData } from 'mania-judge'
|
|
52
102
|
|
|
53
103
|
const beatmap = parseBeatmap(osuContent)
|
|
54
104
|
const replay = parseReplay(osrBuffer, beatmap.difficulty.keyCount)
|
|
55
105
|
|
|
56
|
-
//
|
|
106
|
+
// where mods get applied is up to you; the modded beatmap carries speedMultiplier / hitWindowScale
|
|
57
107
|
const effective = replay.mods !== 0
|
|
58
|
-
? applyLegacyBeatmapMods(beatmap, replay.mods)
|
|
108
|
+
? (applyLegacyBeatmapMods(beatmap, replay.mods) ?? beatmap)
|
|
59
109
|
: beatmap
|
|
60
110
|
|
|
61
|
-
const osuData =
|
|
62
|
-
od: effective.difficulty.overallDifficulty,
|
|
63
|
-
hp: effective.difficulty.hpDrainRate,
|
|
64
|
-
speedRate: 'speedMultiplier' in effective ? effective.speedMultiplier : 1,
|
|
65
|
-
windowScale: 'hitWindowScale' in effective ? effective.hitWindowScale : 1,
|
|
66
|
-
noteColumns: beatmapToNoteColumns(effective),
|
|
67
|
-
actionColumns: replayToActionColumns(replay.frames, beatmap.difficulty.keyCount),
|
|
68
|
-
}
|
|
111
|
+
const osuData = createOsuData(effective, replay)
|
|
69
112
|
```
|
|
113
|
+
|
|
114
|
+
Mod application stays outside the library on purpose: it needs the mod table, not the judging
|
|
115
|
+
engine.
|
|
116
|
+
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
- Copy `.env.example` to `.env` and point `OSU_STABLE_DIR` at your osu! install.
|
|
120
|
+
- Fixtures are generated from that install and are **not** committed:
|
|
121
|
+
`node --env-file=.env --import tsx tests/gen-stable-json.ts <tap-only|hold|mods>`
|
|
122
|
+
(same for `gen-lazer-json.ts`). A fresh clone has to generate them before `pnpm test`.
|
|
123
|
+
- `pnpm test` runs the whole suite. Judgement and timeline tests assert exact equality, so
|
|
124
|
+
the failing cases are the current known gaps and are meant to be read as a to-do list.
|
|
125
|
+
|
|
126
|
+
## Credits
|
|
127
|
+
|
|
128
|
+
Thanks to [uuUlazis/osumania-replay-analyzer](https://github.com/uuUlazis/osumania-replay-analyzer):
|
|
129
|
+
the osu!stable judgement and scoring rules implemented here are ported from that project.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# mania-judge
|
|
2
|
+
|
|
3
|
+
从 `.osu` + `.osr` 数据复现 osu!mania 的判定、连击、血量与 ScoreV1。
|
|
4
|
+
|
|
5
|
+
设计目标是**精确复刻 osu!stable**,而不是近似:判定按列计算(每一列只与自己的物件、
|
|
6
|
+
自己的输入发生关系),并且先完成全部判定,再据此派生连击 / 血量 / 分数。
|
|
7
|
+
|
|
8
|
+
- [English](./README.md)
|
|
9
|
+
- [osu!v1 判定逻辑](./doc/osu-v1-mania-judgement.md)
|
|
10
|
+
- [osu!v1 时间轴逻辑](./doc/osu-v1-timeline.md)
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install mania-judge
|
|
16
|
+
# 或
|
|
17
|
+
pnpm add mania-judge
|
|
18
|
+
# 或
|
|
19
|
+
yarn add mania-judge
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
只有 ESM 产物,自带类型声明,无运行时依赖。
|
|
23
|
+
|
|
24
|
+
## 现状
|
|
25
|
+
|
|
26
|
+
仍在开发中。下面的数字来自 97 张回放样本(7K–18K 的 mania 谱面),对照的是 `.osr`
|
|
27
|
+
文件头里记录的判定计数 / 分数 / 连击。
|
|
28
|
+
|
|
29
|
+
### v1(osu!stable)
|
|
30
|
+
|
|
31
|
+
**判定** —— 按列推进的状态机,驱动时钟来自回放的原始帧时间。
|
|
32
|
+
|
|
33
|
+
- **90 / 97** 张谱的六档判定计数与回放头完全一致。
|
|
34
|
+
- 剩下 7 张各差 1–5 个事件(物件总数 1.5k–14k,全部是 7K 谱)。这批残差**不是本实现对
|
|
35
|
+
stable 的偏差**:回放头记的是当初游玩的判定,而 stable 播放回放时会按当前帧重新判定,
|
|
36
|
+
两者本来就可能不同。整图实测(Life is Piano 7K,1473 物件)里,游戏回放重判为
|
|
37
|
+
783/508/138/**26**/8/**10**,与回放头的 25/11 不同,而与本库完全一致(连 maxCombo 都一致)。
|
|
38
|
+
详见 [doc/osu-v1-mania-judgement.md](doc/osu-v1-mania-judgement.md#已知偏差)。
|
|
39
|
+
|
|
40
|
+
**时间轴** —— 由判定结果派生连击 / 血量 / ScoreV1。
|
|
41
|
+
|
|
42
|
+
| 项目 | 完全一致 | 说明 |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| 最大连击 | 73 / 97 | 其余差 ±1 |
|
|
45
|
+
| ScoreV1 | 43 / 97 | 其余中位偏差 ±50(约 0.01%),最大 1136(0.15%) |
|
|
46
|
+
|
|
47
|
+
判定层与时间轴层的测试是分开的(`tests/osu-v1-judgement.test.ts`、
|
|
48
|
+
`tests/osu-v1-timeline.test.ts`),都使用精确断言、不留容差。
|
|
49
|
+
|
|
50
|
+
### lazer
|
|
51
|
+
|
|
52
|
+
**tap-only 已经是准的**:38 / 38 张谱的六档计数与回放头完全一致,最大连击 37 / 38 张精确。
|
|
53
|
+
|
|
54
|
+
长条已实现(头尾分开判定、支持断条后补按、头 miss 或断条时尾部封顶到 Meh),但**还不精确**:
|
|
55
|
+
|
|
56
|
+
| 分组 | 完全一致 | \|Δ\| 合计 | 每张谱 |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| hold | 1 / 31 | 726 | 约 23 个事件 |
|
|
59
|
+
| mods | 0 / 12 | 348 | 约 29 个事件 |
|
|
60
|
+
|
|
61
|
+
残差是纯粹的「Perfect / Great / Good 之间的错档」:事件总数对得上、Miss 与 Meh 的总数也对得上,
|
|
62
|
+
且两个方向的误差大小相当。这说明问题在尾判的时间边界细节,而不是事件结构。
|
|
63
|
+
|
|
64
|
+
## 用法
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { v1, calcAccuracy } from 'mania-judge'
|
|
68
|
+
|
|
69
|
+
const judgements = v1.playOsu(osuData)
|
|
70
|
+
const frames = v1.generateFramesOsu(judgements, osuData.hp, ['HR'])
|
|
71
|
+
const last = frames.at(-1)!
|
|
72
|
+
|
|
73
|
+
console.log(last.resultCounts, last.maxCombo, last.life, last.score)
|
|
74
|
+
console.log(calcAccuracy(last.resultCounts, v1.accTable))
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`generateFramesOsu` 的第三个参数是回放的 mod 列表,只影响 ScoreV1(`NF` / `EZ` / `HT`
|
|
78
|
+
会把分数减半)。
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
// 单独算 ScoreV1
|
|
82
|
+
const score = v1.calculateScoreV1(judgements.flat(), ['DT'])
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 从文件加载回放
|
|
86
|
+
|
|
87
|
+
本库没有运行时依赖、也不碰文件,只接收普通数据;`createOsuData` 接受任何与
|
|
88
|
+
`BeatmapLike` / `ReplayLike` 结构兼容的对象,不绑定具体解析库。用
|
|
89
|
+
[`osu-mania-io`](https://github.com/zzzzv/osu-mania-io) 的话:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { parseBeatmap } from 'osu-mania-io/beatmap'
|
|
93
|
+
import { parseReplay } from 'osu-mania-io/replay'
|
|
94
|
+
import { applyLegacyBeatmapMods } from 'osu-mania-io/mod'
|
|
95
|
+
import { createOsuData } from 'mania-judge'
|
|
96
|
+
|
|
97
|
+
const beatmap = parseBeatmap(osuContent)
|
|
98
|
+
const replay = parseReplay(osrBuffer, beatmap.difficulty.keyCount)
|
|
99
|
+
|
|
100
|
+
// mod 应用在哪一层由你决定;应用后的谱面会带 speedMultiplier / hitWindowScale
|
|
101
|
+
const effective = replay.mods !== 0
|
|
102
|
+
? (applyLegacyBeatmapMods(beatmap, replay.mods) ?? beatmap)
|
|
103
|
+
: beatmap
|
|
104
|
+
|
|
105
|
+
const osuData = createOsuData(effective, replay)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
mod 计算刻意留在库外:它需要的是 mod 表,不是判定引擎。
|
|
109
|
+
|
|
110
|
+
## 开发
|
|
111
|
+
|
|
112
|
+
- 把 `.env.example` 复制成 `.env`,把 `OSU_STABLE_DIR` 指向本机 osu! 安装目录。
|
|
113
|
+
- 样本由脚本从该目录生成,**不入库**:`node --env-file=.env --import tsx tests/gen-stable-json.ts <tap-only|hold|mods>`
|
|
114
|
+
(lazer 用 `gen-lazer-json.ts`)。新克隆的仓库要先生成样本,`pnpm test` 才有数据。
|
|
115
|
+
- `pnpm test` 跑全量。判定层与时间轴层都是精确断言,**失败用例就是当前的已知差异清单**,
|
|
116
|
+
应当当作待办来读,而不是把断言放宽。
|
|
117
|
+
|
|
118
|
+
## 致谢
|
|
119
|
+
|
|
120
|
+
感谢 [uuUlazis/osumania-replay-analyzer](https://github.com/uuUlazis/osumania-replay-analyzer),
|
|
121
|
+
本项目的 osu!stable 判定与计分规则参考该项目实现。
|
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,13 @@ interface OsuData {
|
|
|
23
23
|
windowScale: number;
|
|
24
24
|
noteColumns: Columns<Note>;
|
|
25
25
|
actionColumns: Columns<Action>;
|
|
26
|
+
/**
|
|
27
|
+
* 回放原始帧时间(毫秒,升序)。
|
|
28
|
+
*
|
|
29
|
+
* 判定是在这些帧上推进的,必须有:每个物件的结算时刻是「不早于边界的第一帧」,
|
|
30
|
+
* 少了帧表就只能按边界本身结算,结果会差档。用 `replayToFrameTimes` 从回放帧里取。
|
|
31
|
+
*/
|
|
32
|
+
frameTimes: readonly number[];
|
|
26
33
|
}
|
|
27
34
|
declare const HIT_RESULTS: {
|
|
28
35
|
readonly Perfect: 0;
|
|
@@ -48,6 +55,8 @@ interface TimeLineFrame {
|
|
|
48
55
|
maxCombo: number;
|
|
49
56
|
resultCounts: HitResultTable<number>;
|
|
50
57
|
life: number;
|
|
58
|
+
/** ScoreV1(0 ~ 1,000,000);只有 osu-v1 时间轴会填 */
|
|
59
|
+
score?: number;
|
|
51
60
|
}
|
|
52
61
|
//#endregion
|
|
53
62
|
//#region src/osu-v1/types.d.ts
|
|
@@ -57,7 +66,10 @@ interface HoldJudgementV1 {
|
|
|
57
66
|
exit: number;
|
|
58
67
|
actions: Action[];
|
|
59
68
|
result: HitResult;
|
|
69
|
+
/** 首次提前松手的时刻(兼容旧字段) */
|
|
60
70
|
breakTime?: number;
|
|
71
|
+
/** 每次提前松手的时刻:重新按下后再次提前松手会再记一次,每次都会重置连击 */
|
|
72
|
+
breakTimes?: number[];
|
|
61
73
|
ticks: number[];
|
|
62
74
|
}
|
|
63
75
|
type JudgementV1 = TapJudgement | HoldJudgementV1;
|
|
@@ -66,19 +78,42 @@ declare function countResults(judgements: JudgementV1[]): HitResultTable<number>
|
|
|
66
78
|
declare const accTable$1: Readonly<HitResultTable<number>>;
|
|
67
79
|
declare function baseWindows$1(od: number): HitWindows;
|
|
68
80
|
//#endregion
|
|
69
|
-
//#region src/osu-v1/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
//#region src/osu-v1/frames.d.ts
|
|
82
|
+
/**
|
|
83
|
+
* 精确模式:按列重演 stable 的 mania 判定状态机。
|
|
84
|
+
*
|
|
85
|
+
* `frameTimes` 是回放原始帧时间(升序)。判定里所有「当前时刻」都取
|
|
86
|
+
* 「不早于边界的第一帧」,这样事件驱动和 stable 的逐帧扫描等价。
|
|
87
|
+
* 不传时退化成用边界本身当时刻(只适合做近似估计)。
|
|
88
|
+
*/
|
|
89
|
+
declare function playColumnFrames(notes: readonly Note[], actions: readonly Action[], windows: HitWindows, frameTimes: readonly number[]): JudgementV1[];
|
|
90
|
+
declare function playFrames(noteColumns: Columns<Note>, actionColumns: Columns<Action>, windows: HitWindows, frameTimes: readonly number[]): Columns<JudgementV1>;
|
|
91
|
+
declare function playOsuFrames(data: OsuData): Columns<JudgementV1>;
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/osu-v1/score.d.ts
|
|
94
|
+
type ScoreEventKind = 'judge' | 'tick' | 'break';
|
|
95
|
+
interface ScoreAccumulator {
|
|
96
|
+
/** 喂入一次事件,必须是判定产出顺序 */
|
|
97
|
+
push: (kind: ScoreEventKind, result: HitResult) => void;
|
|
98
|
+
/** 当前 ScoreV1 原始累加值(未取整) */
|
|
99
|
+
readonly raw: number;
|
|
100
|
+
/** 取整后的分数 */
|
|
101
|
+
readonly score: number;
|
|
102
|
+
readonly combo: number;
|
|
103
|
+
readonly health: number;
|
|
104
|
+
}
|
|
105
|
+
declare function createScoreAccumulator(total: number, mods?: readonly string[]): ScoreAccumulator;
|
|
106
|
+
/** ScoreV1(0 ~ 1,000,000) */
|
|
107
|
+
declare function calculateScoreV1(judgements: readonly JudgementV1[], mods?: readonly string[]): number;
|
|
73
108
|
//#endregion
|
|
74
109
|
//#region src/osu-v1/health.d.ts
|
|
75
110
|
declare function createLifeTable(hp: number, hpMultiplierNormal?: number): HitResultTable<number>;
|
|
76
111
|
//#endregion
|
|
77
112
|
//#region src/osu-v1/timeline.d.ts
|
|
78
|
-
declare function generateFrames$1(judgementColumns: Columns<JudgementV1>, lifeTable: HitResultTable<number
|
|
79
|
-
declare function generateFramesOsu(judgementColumns: Columns<JudgementV1>, hp: number): TimeLineFrame[];
|
|
113
|
+
declare function generateFrames$1(judgementColumns: Columns<JudgementV1>, lifeTable: HitResultTable<number>, mods?: readonly string[]): TimeLineFrame[];
|
|
114
|
+
declare function generateFramesOsu(judgementColumns: Columns<JudgementV1>, hp: number, mods?: readonly string[]): TimeLineFrame[];
|
|
80
115
|
declare namespace index_d_exports$1 {
|
|
81
|
-
export { HoldJudgementV1, JudgementV1, accTable$1 as accTable, baseWindows$1 as baseWindows, countResults, createLifeTable, generateFrames$1 as generateFrames, generateFramesOsu, isHoldJudgement,
|
|
116
|
+
export { HoldJudgementV1, JudgementV1, ScoreAccumulator, ScoreEventKind, accTable$1 as accTable, baseWindows$1 as baseWindows, calculateScoreV1, countResults, createLifeTable, createScoreAccumulator, generateFrames$1 as generateFrames, generateFramesOsu, isHoldJudgement, playColumnFrames, playFrames, playOsuFrames as playOsu, playOsuFrames };
|
|
82
117
|
}
|
|
83
118
|
//#endregion
|
|
84
119
|
//#region src/osu-lazer/types.d.ts
|
|
@@ -103,8 +138,8 @@ declare function baseWindows(od: number): HitWindows;
|
|
|
103
138
|
declare function tailWindows(headWindows: Readonly<HitWindows>): HitWindows;
|
|
104
139
|
//#endregion
|
|
105
140
|
//#region src/osu-lazer/judgement.d.ts
|
|
106
|
-
declare function playColumn(notes: Note[], actions: Action[], windows: HitWindows,
|
|
107
|
-
declare function play(noteColumns: Columns<Note>, actionColumns: Columns<Action>, windows: HitWindows,
|
|
141
|
+
declare function playColumn(notes: Note[], actions: Action[], windows: HitWindows, tails?: HitWindows): JudgementV2[];
|
|
142
|
+
declare function play(noteColumns: Columns<Note>, actionColumns: Columns<Action>, windows: HitWindows, tails?: HitWindows): Columns<JudgementV2>;
|
|
108
143
|
declare function playOsu(data: OsuData): Columns<JudgementV2>;
|
|
109
144
|
//#endregion
|
|
110
145
|
//#region src/osu-lazer/timeline.d.ts
|
|
@@ -120,13 +155,14 @@ declare namespace index_d_exports {
|
|
|
120
155
|
}
|
|
121
156
|
//#endregion
|
|
122
157
|
//#region src/column.d.ts
|
|
123
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Extract the replay's raw frame timeline (ms, ascending, deduped).
|
|
160
|
+
* osu!stable judges on these frames, so the exact settle time of every object
|
|
161
|
+
* is "the first frame at or after the boundary" — not the boundary itself.
|
|
162
|
+
*/
|
|
163
|
+
declare function replayToFrameTimes(frames: readonly {
|
|
124
164
|
readonly time: number;
|
|
125
|
-
|
|
126
|
-
getHoldingAction(): Action | null;
|
|
127
|
-
getNextAction(): Action | null;
|
|
128
|
-
};
|
|
129
|
-
type ActionCursor = ReturnType<typeof createActionCursor>;
|
|
165
|
+
}[]): number[];
|
|
130
166
|
/**
|
|
131
167
|
* Group beatmap hit objects into per-column note arrays.
|
|
132
168
|
* Structurally compatible with `osu-mania-io`'s `Beatmap`.
|
|
@@ -150,10 +186,48 @@ declare function replayToActionColumns(frames: readonly {
|
|
|
150
186
|
readonly columns: readonly boolean[];
|
|
151
187
|
}[], keyCount: number): Columns<Action>;
|
|
152
188
|
//#endregion
|
|
189
|
+
//#region src/osu-data.d.ts
|
|
190
|
+
/**
|
|
191
|
+
* 结构化的谱面接口:只依赖判定真正用到的字段,不绑定任何解析库。
|
|
192
|
+
* 如果已经把 mod 应用过(例如 `applyLegacyBeatmapMods`),它会额外带上
|
|
193
|
+
* `speedMultiplier` / `hitWindowScale`,这里会一并读出来。
|
|
194
|
+
*/
|
|
195
|
+
interface BeatmapLike {
|
|
196
|
+
readonly difficulty: {
|
|
197
|
+
readonly keyCount: number;
|
|
198
|
+
readonly overallDifficulty: number;
|
|
199
|
+
readonly hpDrainRate: number;
|
|
200
|
+
};
|
|
201
|
+
readonly hitObjects: readonly {
|
|
202
|
+
readonly column: number;
|
|
203
|
+
readonly startTime: number;
|
|
204
|
+
readonly endTime?: number;
|
|
205
|
+
}[];
|
|
206
|
+
readonly speedMultiplier?: number;
|
|
207
|
+
readonly hitWindowScale?: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 结构化的回放接口:`columns` 是这一帧每列的按键状态。
|
|
211
|
+
*/
|
|
212
|
+
interface ReplayLike {
|
|
213
|
+
readonly frames: readonly {
|
|
214
|
+
readonly time: number;
|
|
215
|
+
readonly columns: readonly boolean[];
|
|
216
|
+
}[];
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* 把「已解析的谱面 + 回放」组装成判定输入。
|
|
220
|
+
*
|
|
221
|
+
* 本库不解析 `.osu` / `.osr`,也不做 mod 计算,所以传进来的 `beatmap` 应当
|
|
222
|
+
* 已经是应用过 mod 的那一份(`speedMultiplier` / `hitWindowScale` 会被读取;
|
|
223
|
+
* `overallDifficulty` / `hpDrainRate` 也用应用后的值)。
|
|
224
|
+
*/
|
|
225
|
+
declare function createOsuData(beatmap: BeatmapLike, replay: ReplayLike): OsuData;
|
|
226
|
+
//#endregion
|
|
153
227
|
//#region src/utils.d.ts
|
|
154
228
|
declare function clamp(value: number, min: number, max: number): number;
|
|
155
229
|
declare function difficultyRange(difficulty: number, min: number, mid: number, max: number): number;
|
|
156
230
|
declare function truncWindows(windows: Readonly<HitWindows>, scale?: number): HitWindows;
|
|
157
231
|
declare function calcAccuracy(resultCounts: Readonly<HitResultTable<number>>, accTable: Readonly<HitResultTable<number>>): number;
|
|
158
232
|
//#endregion
|
|
159
|
-
export { Action,
|
|
233
|
+
export { Action, BeatmapLike, Columns, HIT_RESULTS, HitResult, HitResultTable, HitWindows, type HoldJudgementV1, type HoldJudgementV2, HoldNote, type JudgementV1, type JudgementV2, Note, OsuData, ReplayLike, TapJudgement, TapNote, TimeLineFrame, beatmapToNoteColumns, calcAccuracy, clamp, createOsuData, difficultyRange, index_d_exports as lazer, replayToActionColumns, replayToFrameTimes, truncWindows, index_d_exports$1 as v1 };
|