mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-29 10:28:04 +03:00
Support DP randoms and add test cases
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
} from "./converter";
|
||||
import { FervidexScore } from "./types";
|
||||
import deepmerge from "deepmerge";
|
||||
import { ChartDocument } from "tachi-common";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
@@ -136,7 +137,43 @@ t.test("#ConverterIRFervidex", (t) => {
|
||||
song: Testing511Song,
|
||||
chart: Testing511SPA,
|
||||
dryScore: baseDryScore,
|
||||
}, // broken
|
||||
},
|
||||
"Should return a dry score."
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("Should turn DP randoms into tuples.", async (t) => {
|
||||
// lazily clone the SPA as a DPA.
|
||||
|
||||
const Testing511DPA = deepmerge(Testing511SPA, {
|
||||
playtype: "DP",
|
||||
chartID: "dp_test",
|
||||
data: { arcChartID: "dp_test" },
|
||||
});
|
||||
|
||||
await db.charts.iidx.insert(Testing511DPA);
|
||||
|
||||
// @ts-expect-error apparantly this prop isnt optional. but i'm sure it is.
|
||||
delete Testing511DPA._id;
|
||||
|
||||
const res = await ConverterIRFervidex(
|
||||
deepmerge(baseFervidexScore, { option: { style_2p: "R_RANDOM" }, chart: "dpa" }),
|
||||
{ version: "27" },
|
||||
"ir/fervidex",
|
||||
logger
|
||||
);
|
||||
|
||||
t.hasStrict(
|
||||
res,
|
||||
{
|
||||
song: Testing511Song,
|
||||
chart: Testing511DPA,
|
||||
dryScore: deepmerge(baseDryScore, {
|
||||
scoreMeta: { random: ["RANDOM", "R-RANDOM"] },
|
||||
}),
|
||||
},
|
||||
"Should return a dry score."
|
||||
);
|
||||
|
||||
@@ -157,7 +194,7 @@ t.test("#ConverterIRFervidex", (t) => {
|
||||
song: Testing511Song,
|
||||
chart: Testing511SPA,
|
||||
dryScore: deepmerge(baseDryScore, { scoreData: { hitMeta: { bp: null } } }),
|
||||
}, // broken
|
||||
},
|
||||
"Should return a dry score."
|
||||
);
|
||||
|
||||
@@ -235,7 +272,7 @@ t.test("#ConverterIRFervidex", (t) => {
|
||||
dryScore: deepmerge(baseDryScore, {
|
||||
scoreData: { hitMeta: { gauge: null, gaugeHistory: [10, 5, null, null] } },
|
||||
}),
|
||||
}, // broken
|
||||
},
|
||||
"Should return a dry score."
|
||||
);
|
||||
|
||||
|
||||
@@ -77,9 +77,7 @@ export function TachifyRange(
|
||||
}
|
||||
}
|
||||
|
||||
export function TachifyRandom(
|
||||
gauge: FervidexScore["option"]["style"]
|
||||
): DryScore<"iidx:SP" | "iidx:DP">["scoreMeta"]["random"] {
|
||||
export function TachifyRandom(gauge: FervidexScore["option"]["style"]) {
|
||||
switch (gauge) {
|
||||
case "RANDOM":
|
||||
return "RANDOM";
|
||||
@@ -213,7 +211,12 @@ export const ConverterIRFervidex: ConverterFunction<FervidexScore, FervidexConte
|
||||
scoreMeta: {
|
||||
assist: TachifyAssist(data.option.assist),
|
||||
gauge: TachifyGauge(data.option.gauge),
|
||||
random: TachifyRandom(data.option.style),
|
||||
// @ts-expect-error Awkward expansion of iidx:SP|DP strings here causes this
|
||||
// to complain that [x,x] is not assignable to SP randoms. This is a lazy ignore!
|
||||
random:
|
||||
chart.playtype === "SP"
|
||||
? TachifyRandom(data.option.style)
|
||||
: [TachifyRandom(data.option.style), TachifyRandom(data.option.style_2p)],
|
||||
range: TachifyRange(data.option.range),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -40,6 +40,7 @@ export interface FervidexScore {
|
||||
| "LIFT_SUD_PLUS"
|
||||
| null;
|
||||
style?: "RANDOM" | "R_RANDOM" | "S_RANDOM" | "MIRROR" | null;
|
||||
style_2p?: "RANDOM" | "R_RANDOM" | "S_RANDOM" | "MIRROR" | null;
|
||||
assist?: "AUTO_SCRATCH" | "LEGACY_NOTE" | "ASCR_LEGACY" | "FULL_ASSIST" | null;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user