mania-judge 0.1.0 → 0.2.0

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 CHANGED
@@ -8,17 +8,14 @@ Simulates osu!stable mania judgements.
8
8
 
9
9
  - Implemented: judgements, combo, and life.
10
10
  - Not implemented: score.
11
- - Tap-only: accurate in current tests except for a few life mismatches.
11
+ - Tap-only: accurate in current tests.
12
12
  - Hold: not expected to be exact yet because the precise stable hold algorithm is still unknown.
13
- - Hold accuracy error across 47 fixtures: `0.00%` min, `0.39%` max, `0.16%` average.
14
13
  - Mod coverage: `HT`, `DT`, `HR`, `EZ`, and `MR`.
15
14
  - Not supported: `RD`.
16
15
 
17
16
  ## Usage
18
17
 
19
- ### Main entry
20
-
21
- Use the main entry if you already have `osuData`. This path does not need the parser peer dependencies.
18
+ ### Core simulation
22
19
 
23
20
  ```ts
24
21
  import { v1, calcAccuracy } from 'mania-judge'
@@ -33,20 +30,30 @@ if (lastFrame) {
33
30
  }
34
31
  ```
35
32
 
36
- ### Parser entries
33
+ ### Parsing `.osu` / `.osr` files
37
34
 
38
- Use these entries if you want to parse `.osu` and `.osr`. They require the peer dependencies `osu-classes`, `osu-mania-stable`, and `osu-parsers`.
35
+ Use [`osu-mania-io`](https://github.com/zzzzv/osu-mania-io) to parse beatmap and replay files, then convert the result with the adapter functions in `column.ts`:
39
36
 
40
37
  ```ts
41
- import { parse } from 'mania-judge/osu-parsers'
42
-
43
- const result = await parse(beatmapContent, replayBuffer)
44
- console.log(result.osuData)
45
- ```
46
-
47
- ```ts
48
- import { parseFromPath } from 'mania-judge/osu-parsers/node'
49
-
50
- const result = await parseFromPath('map.osu', 'score.osr')
51
- console.log(result.osuData)
38
+ import { parseBeatmap } from 'osu-mania-io/beatmap'
39
+ import { parseReplay } from 'osu-mania-io/replay'
40
+ import { applyLegacyBeatmapMods } from 'osu-mania-io/mod'
41
+ import { beatmapToNoteColumns, replayToActionColumns } from 'mania-judge'
42
+
43
+ const beatmap = parseBeatmap(osuContent)
44
+ const replay = parseReplay(osrBuffer, beatmap.difficulty.keyCount)
45
+
46
+ // Apply mods if needed.
47
+ const effective = replay.mods !== 0
48
+ ? applyLegacyBeatmapMods(beatmap, replay.mods)
49
+ : beatmap
50
+
51
+ const osuData = {
52
+ od: effective.difficulty.overallDifficulty,
53
+ hp: effective.difficulty.hpDrainRate,
54
+ speedRate: 'speedMultiplier' in effective ? effective.speedMultiplier : 1,
55
+ windowScale: 'hitWindowScale' in effective ? effective.hitWindowScale : 1,
56
+ noteColumns: beatmapToNoteColumns(effective),
57
+ actionColumns: replayToActionColumns(replay.frames, beatmap.difficulty.keyCount),
58
+ }
52
59
  ```
package/dist/index.d.mts CHANGED
@@ -1,3 +1,122 @@
1
- import { _ as TimeLineFrame, a as HitResult, c as HoldJudgementV1, d as JudgementV1, f as JudgementV2, g as TapNote, h as TapJudgement, i as HIT_RESULTS, l as HoldJudgementV2, m as OsuData, n as BaseJudgement, o as HitResultTable, p as Note, r as Columns, s as HitWindows, t as Action, u as HoldNote } from "./types-3MDvQQxi.mjs";
2
- import { a as ActionCursor, i as truncWindows, n as compareJudgements, o as createActionCursor, r as isHoldJudgement, s as index_d_exports, t as calcAccuracy } from "./index-Zuz8HPVe.mjs";
3
- export { Action, ActionCursor, BaseJudgement, Columns, HIT_RESULTS, HitResult, HitResultTable, HitWindows, HoldJudgementV1, HoldJudgementV2, HoldNote, JudgementV1, JudgementV2, Note, OsuData, TapJudgement, TapNote, TimeLineFrame, calcAccuracy, compareJudgements, createActionCursor, isHoldJudgement, truncWindows, index_d_exports as v1 };
1
+ //#region src/types.d.ts
2
+ interface TapNote {
3
+ column: number;
4
+ start: number;
5
+ end?: undefined;
6
+ }
7
+ interface HoldNote {
8
+ column: number;
9
+ start: number;
10
+ end: number;
11
+ }
12
+ type Note = TapNote | HoldNote;
13
+ interface Action {
14
+ column: number;
15
+ press: number;
16
+ release: number;
17
+ }
18
+ type Columns<T> = T[][];
19
+ interface OsuData {
20
+ od: number;
21
+ hp: number;
22
+ speedRate: number;
23
+ windowScale: number;
24
+ noteColumns: Columns<Note>;
25
+ actionColumns: Columns<Action>;
26
+ }
27
+ declare const HIT_RESULTS: {
28
+ readonly Perfect: 0;
29
+ readonly Great: 1;
30
+ readonly Good: 2;
31
+ readonly Ok: 3;
32
+ readonly Meh: 4;
33
+ readonly Miss: 5;
34
+ };
35
+ type HitResult = (typeof HIT_RESULTS)[keyof typeof HIT_RESULTS];
36
+ type HitResultTable<T> = [T, T, T, T, T, T];
37
+ type HitWindows = HitResultTable<number>;
38
+ interface BaseJudgement<T extends Note> {
39
+ note: T;
40
+ enter: number;
41
+ exit: number;
42
+ actions: Action[];
43
+ }
44
+ interface TapJudgement extends BaseJudgement<TapNote> {
45
+ result: HitResult;
46
+ }
47
+ interface HoldJudgementV1 extends BaseJudgement<HoldNote> {
48
+ result: HitResult;
49
+ breakTime?: number;
50
+ ticks: number[];
51
+ }
52
+ interface HoldJudgementV2 extends BaseJudgement<HoldNote> {
53
+ headResult: HitResult;
54
+ tailResult: HitResult;
55
+ breakTime?: number;
56
+ }
57
+ type JudgementV1 = TapJudgement | HoldJudgementV1;
58
+ type JudgementV2 = TapJudgement | HoldJudgementV2;
59
+ interface TimeLineFrame {
60
+ time: number;
61
+ combo: number;
62
+ maxCombo: number;
63
+ resultCounts: HitResultTable<number>;
64
+ life: number;
65
+ }
66
+ //#endregion
67
+ //#region src/osu-v1/judgement.d.ts
68
+ declare const accTable: Readonly<HitResultTable<number>>;
69
+ declare function baseWindows(od: number): HitWindows;
70
+ declare function playColumn(notes: Note[], actions: Action[], windows: HitWindows): JudgementV1[];
71
+ declare function play(noteColumns: Columns<Note>, actionColumns: Columns<Action>, windows: HitWindows): Columns<JudgementV1>;
72
+ declare function playOsu(data: OsuData): Columns<JudgementV1>;
73
+ //#endregion
74
+ //#region src/osu-v1/health.d.ts
75
+ declare function createLifeTable(hp: number, hpMultiplierNormal?: number): HitResultTable<number>;
76
+ //#endregion
77
+ //#region src/osu-v1/timeline.d.ts
78
+ declare function generateFrames(judgementColumns: Columns<JudgementV1>, lifeTable: HitResultTable<number>): TimeLineFrame[];
79
+ declare function generateFramesOsu(judgementColumns: Columns<JudgementV1>, hp: number): TimeLineFrame[];
80
+ declare namespace index_d_exports {
81
+ export { accTable, baseWindows, createLifeTable, generateFrames, generateFramesOsu, play, playColumn, playOsu };
82
+ }
83
+ //#endregion
84
+ //#region src/column.d.ts
85
+ declare function createActionCursor(actions: Action[]): {
86
+ readonly time: number;
87
+ setNextTime(nextTime: number): void;
88
+ getHoldingAction(): Action | null;
89
+ getNextAction(): Action | null;
90
+ };
91
+ type ActionCursor = ReturnType<typeof createActionCursor>;
92
+ /**
93
+ * Group beatmap hit objects into per-column note arrays.
94
+ * Structurally compatible with `osu-mania-io`'s `Beatmap`.
95
+ */
96
+ declare function beatmapToNoteColumns(beatmap: {
97
+ readonly difficulty: {
98
+ readonly keyCount: number;
99
+ };
100
+ readonly hitObjects: readonly {
101
+ readonly column: number;
102
+ readonly startTime: number;
103
+ readonly endTime?: number;
104
+ }[];
105
+ }): Columns<Note>;
106
+ /**
107
+ * Convert key-state replay frames into press/release actions.
108
+ * Structurally compatible with `osu-mania-io`'s `ReplayFrame`.
109
+ */
110
+ declare function replayToActionColumns(frames: readonly {
111
+ readonly time: number;
112
+ readonly columns: readonly boolean[];
113
+ }[], keyCount: number): Columns<Action>;
114
+ //#endregion
115
+ //#region src/extensions.d.ts
116
+ declare function truncWindows(windows: Readonly<HitWindows>, scale?: number): HitWindows;
117
+ declare function calcAccuracy(resultCounts: Readonly<HitResultTable<number>>, accTable: Readonly<HitResultTable<number>>): number;
118
+ declare function compareJudgements<T extends BaseJudgement<Note>>(a: T, b: T): number;
119
+ declare function isHoldJudgement(judgement: JudgementV1): judgement is HoldJudgementV1;
120
+ declare function countResults(judgements: JudgementV1[]): HitResultTable<number>;
121
+ //#endregion
122
+ export { Action, ActionCursor, BaseJudgement, Columns, HIT_RESULTS, HitResult, HitResultTable, HitWindows, HoldJudgementV1, HoldJudgementV2, HoldNote, JudgementV1, JudgementV2, Note, OsuData, TapJudgement, TapNote, TimeLineFrame, beatmapToNoteColumns, calcAccuracy, compareJudgements, countResults, createActionCursor, isHoldJudgement, replayToActionColumns, truncWindows, index_d_exports as v1 };
package/dist/index.mjs CHANGED
@@ -35,6 +35,43 @@ function createActionCursor(actions) {
35
35
  }
36
36
  };
37
37
  }
38
+ /**
39
+ * Group beatmap hit objects into per-column note arrays.
40
+ * Structurally compatible with `osu-mania-io`'s `Beatmap`.
41
+ */
42
+ function beatmapToNoteColumns(beatmap) {
43
+ const columns = Array.from({ length: beatmap.difficulty.keyCount }, () => []);
44
+ for (const hitObject of beatmap.hitObjects) columns[hitObject.column].push({
45
+ column: hitObject.column,
46
+ start: hitObject.startTime,
47
+ end: hitObject.endTime
48
+ });
49
+ return columns;
50
+ }
51
+ /**
52
+ * Convert key-state replay frames into press/release actions.
53
+ * Structurally compatible with `osu-mania-io`'s `ReplayFrame`.
54
+ */
55
+ function replayToActionColumns(frames, keyCount) {
56
+ const columns = Array.from({ length: keyCount }, () => []);
57
+ const lastPress = Array.from({ length: keyCount }, () => null);
58
+ for (const frame of frames) {
59
+ if (frame.time < 0) continue;
60
+ for (let col = 0; col < keyCount; col++) {
61
+ const pressed = frame.columns[col] ?? false;
62
+ if (pressed && lastPress[col] === null) lastPress[col] = frame.time;
63
+ else if (!pressed && lastPress[col] !== null) {
64
+ columns[col].push({
65
+ column: col,
66
+ press: lastPress[col],
67
+ release: frame.time
68
+ });
69
+ lastPress[col] = null;
70
+ }
71
+ }
72
+ }
73
+ return columns;
74
+ }
38
75
  //#endregion
39
76
  //#region src/extensions.ts
40
77
  const epsilon = 1e-6;
@@ -60,6 +97,19 @@ function compareJudgements(a, b) {
60
97
  function isHoldJudgement(judgement) {
61
98
  return judgement.note.end !== void 0;
62
99
  }
100
+ function countResults(judgements) {
101
+ return judgements.reduce((sum, j) => {
102
+ sum[j.result] += 1;
103
+ return sum;
104
+ }, [
105
+ 0,
106
+ 0,
107
+ 0,
108
+ 0,
109
+ 0,
110
+ 0
111
+ ]);
112
+ }
63
113
  //#endregion
64
114
  //#region src/osu-v1/judgement.ts
65
115
  const accTable = [
@@ -189,7 +239,7 @@ function play(noteColumns, actionColumns, windows) {
189
239
  return judgements;
190
240
  }
191
241
  function playOsu(data) {
192
- const windows = truncWindows(baseWindows(data.od), data.windowScale);
242
+ const windows = truncWindows(baseWindows(data.od), data.speedRate * data.windowScale);
193
243
  return play(data.noteColumns, data.actionColumns, windows);
194
244
  }
195
245
  //#endregion
@@ -321,4 +371,4 @@ var osu_v1_exports = /* @__PURE__ */ __exportAll({
321
371
  playOsu: () => playOsu
322
372
  });
323
373
  //#endregion
324
- export { HIT_RESULTS, calcAccuracy, compareJudgements, createActionCursor, isHoldJudgement, truncWindows, osu_v1_exports as v1 };
374
+ export { HIT_RESULTS, beatmapToNoteColumns, calcAccuracy, compareJudgements, countResults, createActionCursor, isHoldJudgement, replayToActionColumns, truncWindows, osu_v1_exports as v1 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mania-judge",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "Simulate osu!stable mania judgements.",
6
6
  "author": "zzzzv",
7
7
  "license": "MIT",
@@ -20,8 +20,6 @@
20
20
  ],
21
21
  "exports": {
22
22
  ".": "./dist/index.mjs",
23
- "./osu-parsers": "./dist/osu-parsers/index.mjs",
24
- "./osu-parsers/node": "./dist/osu-parsers/node.mjs",
25
23
  "./package.json": "./package.json"
26
24
  },
27
25
  "files": [
@@ -30,31 +28,18 @@
30
28
  "scripts": {
31
29
  "build": "tsdown",
32
30
  "dev": "tsdown --watch",
33
- "generate:test-json:tap-only": "node --env-file=.env --import tsx tests/generate-test-json.ts tap-only",
34
- "generate:test-json:hold": "node --env-file=.env --import tsx tests/generate-test-json.ts hold",
35
- "generate:test-json:mods": "node --env-file=.env --import tsx tests/generate-test-json.ts mods",
36
- "generate:test-files": "node --import tsx tests/generate-osu-files.ts",
31
+ "gen:stable-json:tap-only": "node --env-file=.env --import tsx tests/gen-stable-json.ts tap-only",
32
+ "gen:stable-json:hold": "node --env-file=.env --import tsx tests/gen-stable-json.ts hold",
33
+ "gen:stable-json:mods": "node --env-file=.env --import tsx tests/gen-stable-json.ts mods",
34
+ "gen:stable-json": "pnpm gen:stable-json:tap-only && pnpm gen:stable-json:hold && pnpm gen:stable-json:mods",
35
+ "gen:osu-files": "node --import tsx tests/gen-osu-files.ts",
37
36
  "test": "vitest",
38
37
  "typecheck": "tsc --noEmit",
39
38
  "prepublishOnly": "pnpm run build"
40
39
  },
41
- "peerDependencies": {
42
- "osu-classes": "^3.2.0-beta.0",
43
- "osu-mania-stable": "^5.0.1",
44
- "osu-parsers": "^4.2.0-beta.0"
45
- },
46
- "peerDependenciesMeta": {
47
- "osu-classes": {
48
- "optional": true
49
- },
50
- "osu-mania-stable": {
51
- "optional": true
52
- },
53
- "osu-parsers": {
54
- "optional": true
55
- }
56
- },
40
+
57
41
  "devDependencies": {
42
+ "osu-mania-io": "^0.1.0",
58
43
  "@types/node": "^25.5.0",
59
44
  "@typescript/native-preview": "7.0.0-dev.20260328.1",
60
45
  "jszip": "^3.10.1",
@@ -1,35 +0,0 @@
1
- import { _ as TimeLineFrame, c as HoldJudgementV1, d as JudgementV1, m as OsuData, n as BaseJudgement, o as HitResultTable, p as Note, r as Columns, s as HitWindows, t as Action } from "./types-3MDvQQxi.mjs";
2
-
3
- //#region src/osu-v1/judgement.d.ts
4
- declare const accTable: Readonly<HitResultTable<number>>;
5
- declare function baseWindows(od: number): HitWindows;
6
- declare function playColumn(notes: Note[], actions: Action[], windows: HitWindows): JudgementV1[];
7
- declare function play(noteColumns: Columns<Note>, actionColumns: Columns<Action>, windows: HitWindows): Columns<JudgementV1>;
8
- declare function playOsu(data: OsuData): Columns<JudgementV1>;
9
- //#endregion
10
- //#region src/osu-v1/health.d.ts
11
- declare function createLifeTable(hp: number, hpMultiplierNormal?: number): HitResultTable<number>;
12
- //#endregion
13
- //#region src/osu-v1/timeline.d.ts
14
- declare function generateFrames(judgementColumns: Columns<JudgementV1>, lifeTable: HitResultTable<number>): TimeLineFrame[];
15
- declare function generateFramesOsu(judgementColumns: Columns<JudgementV1>, hp: number): TimeLineFrame[];
16
- declare namespace index_d_exports {
17
- export { accTable, baseWindows, createLifeTable, generateFrames, generateFramesOsu, play, playColumn, playOsu };
18
- }
19
- //#endregion
20
- //#region src/column.d.ts
21
- declare function createActionCursor(actions: Action[]): {
22
- readonly time: number;
23
- setNextTime(nextTime: number): void;
24
- getHoldingAction(): Action | null;
25
- getNextAction(): Action | null;
26
- };
27
- type ActionCursor = ReturnType<typeof createActionCursor>;
28
- //#endregion
29
- //#region src/extensions.d.ts
30
- declare function truncWindows(windows: Readonly<HitWindows>, scale?: number): HitWindows;
31
- declare function calcAccuracy(resultCounts: Readonly<HitResultTable<number>>, accTable: Readonly<HitResultTable<number>>): number;
32
- declare function compareJudgements<T extends BaseJudgement<Note>>(a: T, b: T): number;
33
- declare function isHoldJudgement(judgement: JudgementV1): judgement is HoldJudgementV1;
34
- //#endregion
35
- export { ActionCursor as a, truncWindows as i, compareJudgements as n, createActionCursor as o, isHoldJudgement as r, index_d_exports as s, calcAccuracy as t };
@@ -1,2 +0,0 @@
1
- import { n as convertReplay, r as parseWithMods, t as convertBeatmap } from "../shared-D-sop3c6.mjs";
2
- export { convertBeatmap, convertReplay, parseWithMods as parse };
@@ -1,2 +0,0 @@
1
- import { n as convertReplay, r as parseWithMods, t as convertBeatmap } from "../shared-DJFUXeEy.mjs";
2
- export { convertBeatmap, convertReplay, parseWithMods as parse };
@@ -1,13 +0,0 @@
1
- import { m as OsuData } from "../types-3MDvQQxi.mjs";
2
- import { n as convertReplay, r as parseWithMods, t as convertBeatmap } from "../shared-D-sop3c6.mjs";
3
- import * as _$osu_mania_stable0 from "osu-mania-stable";
4
- import * as _$osu_classes0 from "osu-classes";
5
-
6
- //#region src/osu-parsers/node.d.ts
7
- declare const parseFromPath: (beatmapPath: string, replayPath: string) => Promise<{
8
- osuData: OsuData;
9
- rawBeatmap: _$osu_mania_stable0.ManiaBeatmap;
10
- rawScore: _$osu_classes0.Score;
11
- }>;
12
- //#endregion
13
- export { convertBeatmap, convertReplay, parseFromPath, parseWithMods };
@@ -1,9 +0,0 @@
1
- import { n as convertReplay, r as parseWithMods, t as convertBeatmap } from "../shared-DJFUXeEy.mjs";
2
- import { readFile } from "node:fs/promises";
3
- //#region src/osu-parsers/node.ts
4
- const parseFromPath = async (beatmapPath, replayPath) => {
5
- const [beatmapContent, replayBuffer] = await Promise.all([readFile(beatmapPath, "utf8"), readFile(replayPath)]);
6
- return parseWithMods(beatmapContent, replayBuffer);
7
- };
8
- //#endregion
9
- export { convertBeatmap, convertReplay, parseFromPath, parseWithMods };
@@ -1,15 +0,0 @@
1
- import { m as OsuData, p as Note, r as Columns, t as Action } from "./types-3MDvQQxi.mjs";
2
- import { ManiaBeatmap, ManiaReplayFrame } from "osu-mania-stable";
3
- import * as _$osu_classes0 from "osu-classes";
4
-
5
- //#region src/osu-parsers/shared.d.ts
6
- type ReplayBufferLike = ArrayBuffer | SharedArrayBuffer | Uint8Array | Buffer;
7
- declare const convertBeatmap: (beatmap: ManiaBeatmap) => Columns<Note>;
8
- declare const convertReplay: (frames: ManiaReplayFrame[], columns: number) => Columns<Action>;
9
- declare const parseWithMods: (beatmapContent: string, replayBuffer: ReplayBufferLike) => Promise<{
10
- osuData: OsuData;
11
- rawBeatmap: ManiaBeatmap;
12
- rawScore: _$osu_classes0.Score;
13
- }>;
14
- //#endregion
15
- export { convertReplay as n, parseWithMods as r, convertBeatmap as t };
@@ -1,69 +0,0 @@
1
- import { BeatmapDecoder, ScoreDecoder } from "osu-parsers";
2
- import { Hold, ManiaRuleset } from "osu-mania-stable";
3
- import { ModBitwise } from "osu-classes";
4
- //#region src/osu-parsers/shared.ts
5
- const ruleset = new ManiaRuleset();
6
- const beatmapDecoder = new BeatmapDecoder();
7
- const scoreDecoder = new ScoreDecoder();
8
- const convertBeatmap = (beatmap) => {
9
- const columnsArray = Array.from({ length: beatmap.totalColumns }, () => []);
10
- for (const hitObject of beatmap.hitObjects) {
11
- const note = {
12
- column: hitObject.column,
13
- start: hitObject.startTime,
14
- end: hitObject instanceof Hold ? hitObject.endTime : void 0
15
- };
16
- columnsArray[note.column].push(note);
17
- }
18
- return columnsArray;
19
- };
20
- const convertReplay = (frames, columns) => {
21
- const columnsArray = Array.from({ length: columns }, () => []);
22
- const lastPressTime = Array.from({ length: columns }, () => null);
23
- for (const frame of frames) {
24
- if (frame.startTime < 0) continue;
25
- for (let i = 0; i < columns; i++) if (frame.actions.has(10 + i)) {
26
- if (lastPressTime[i] === null) lastPressTime[i] = frame.startTime;
27
- } else if (lastPressTime[i] !== null) {
28
- columnsArray[i].push({
29
- column: i,
30
- press: lastPressTime[i],
31
- release: frame.startTime
32
- });
33
- lastPressTime[i] = null;
34
- }
35
- }
36
- return columnsArray;
37
- };
38
- const parseWithMods = async (beatmapContent, replayBuffer) => {
39
- const beatmap = beatmapDecoder.decodeFromString(beatmapContent, false);
40
- const score = await scoreDecoder.decodeFromBuffer(replayBuffer, true);
41
- score.info.ruleset = ruleset;
42
- const maniaBeatmap = ruleset.applyToBeatmap(beatmap);
43
- const columns = maniaBeatmap.totalColumns;
44
- const maniaFrames = ruleset.applyToReplay(score.replay, maniaBeatmap).frames;
45
- const mods = score.info.mods;
46
- const maniaBeatmapWithMods = mods === null || mods.bitwise === 0 ? maniaBeatmap : ruleset.applyToBeatmapWithMods(maniaBeatmap, mods);
47
- const osuData = {
48
- od: beatmap.difficulty.overallDifficulty,
49
- hp: beatmap.difficulty.drainRate,
50
- windowScale: 1,
51
- noteColumns: convertBeatmap(maniaBeatmapWithMods),
52
- actionColumns: convertReplay(maniaFrames, columns)
53
- };
54
- if (mods?.has(ModBitwise.Easy)) {
55
- osuData.windowScale = 1.4;
56
- osuData.hp *= .5;
57
- } else if (mods?.has(ModBitwise.HardRock)) {
58
- osuData.windowScale = 1 / 1.4;
59
- osuData.hp = Math.min(osuData.hp * 1.4, 10);
60
- } else if (mods?.has(ModBitwise.DoubleTime)) osuData.windowScale = 1.5;
61
- else if (mods?.has(ModBitwise.HalfTime)) osuData.windowScale = .75;
62
- return {
63
- osuData,
64
- rawBeatmap: maniaBeatmap,
65
- rawScore: score
66
- };
67
- };
68
- //#endregion
69
- export { convertReplay as n, parseWithMods as r, convertBeatmap as t };
@@ -1,66 +0,0 @@
1
- //#region src/types.d.ts
2
- interface TapNote {
3
- column: number;
4
- start: number;
5
- end?: undefined;
6
- }
7
- interface HoldNote {
8
- column: number;
9
- start: number;
10
- end: number;
11
- }
12
- type Note = TapNote | HoldNote;
13
- interface Action {
14
- column: number;
15
- press: number;
16
- release: number;
17
- }
18
- type Columns<T> = T[][];
19
- interface OsuData {
20
- od: number;
21
- hp: number;
22
- windowScale: number;
23
- noteColumns: Columns<Note>;
24
- actionColumns: Columns<Action>;
25
- }
26
- declare const HIT_RESULTS: {
27
- readonly Perfect: 0;
28
- readonly Great: 1;
29
- readonly Good: 2;
30
- readonly Ok: 3;
31
- readonly Meh: 4;
32
- readonly Miss: 5;
33
- };
34
- type HitResult = (typeof HIT_RESULTS)[keyof typeof HIT_RESULTS];
35
- type HitResultTable<T> = [T, T, T, T, T, T];
36
- type HitWindows = HitResultTable<number>;
37
- interface BaseJudgement<T extends Note> {
38
- note: T;
39
- enter: number;
40
- exit: number;
41
- actions: Action[];
42
- }
43
- interface TapJudgement extends BaseJudgement<TapNote> {
44
- result: HitResult;
45
- }
46
- interface HoldJudgementV1 extends BaseJudgement<HoldNote> {
47
- result: HitResult;
48
- breakTime?: number;
49
- ticks: number[];
50
- }
51
- interface HoldJudgementV2 extends BaseJudgement<HoldNote> {
52
- headResult: HitResult;
53
- tailResult: HitResult;
54
- breakTime?: number;
55
- }
56
- type JudgementV1 = TapJudgement | HoldJudgementV1;
57
- type JudgementV2 = TapJudgement | HoldJudgementV2;
58
- interface TimeLineFrame {
59
- time: number;
60
- combo: number;
61
- maxCombo: number;
62
- resultCounts: HitResultTable<number>;
63
- life: number;
64
- }
65
- //#endregion
66
- export { TimeLineFrame as _, HitResult as a, HoldJudgementV1 as c, JudgementV1 as d, JudgementV2 as f, TapNote as g, TapJudgement as h, HIT_RESULTS as i, HoldJudgementV2 as l, OsuData as m, BaseJudgement as n, HitResultTable as o, Note as p, Columns as r, HitWindows as s, Action as t, HoldNote as u };