Merge pull request #529 from TNG-dev:zkldi/issue-528

Support Permissive Gauge for USC
This commit is contained in:
zkldi
2021-12-02 19:04:52 +00:00
committed by GitHub
4 changed files with 16 additions and 3 deletions
@@ -16,6 +16,17 @@ t.test("#DeriveLamp", (t) => {
t.equal(DeriveLamp(d(uscScore, { options: { gaugeType: 0 }, gauge: 0.7 }), logger), "CLEAR");
t.equal(DeriveLamp(d(uscScore, { options: { gaugeType: 2 }, gauge: 1 }), logger), "FAILED");
t.equal(DeriveLamp(d(uscScore, { options: { gaugeType: 2 }, gauge: 0 }), logger), "FAILED");
t.equal(
DeriveLamp(d(uscScore, { options: { gaugeType: 2 }, gauge: 1, score: 10_000_000 }), logger),
"PERFECT ULTIMATE CHAIN"
);
t.equal(
DeriveLamp(d(uscScore, { options: { gaugeType: 2 }, gauge: 1, error: 0 }), logger),
"ULTIMATE CHAIN"
);
t.equal(
DeriveLamp(d(uscScore, { options: { gaugeType: 1 }, gauge: 0.1 }), logger),
"EXCESSIVE CLEAR"
@@ -58,7 +69,7 @@ t.test("#DeriveLamp", (t) => {
"ULTIMATE CHAIN"
);
t.throws(() => DeriveLamp(d(uscScore, { options: { gaugeType: 2 } }), logger));
t.throws(() => DeriveLamp(d(uscScore, { options: { gaugeType: 3 } }), logger));
t.end();
});
@@ -50,6 +50,8 @@ export function DeriveLamp(
return scoreDoc.gauge >= 0.7 ? "CLEAR" : "FAILED";
} else if (scoreDoc.options.gaugeType === 1) {
return scoreDoc.gauge > 0 ? "EXCESSIVE CLEAR" : "FAILED";
} else if (scoreDoc.options.gaugeType === 2) {
return "FAILED";
}
logger.error(`Could not derive Lamp from Score Document`, { scoreDoc });
@@ -18,7 +18,7 @@ const PR_USCIRScore: PrudenceSchema = {
late: p.optional(p.isPositiveInteger),
combo: p.optional(p.isPositiveInteger),
options: {
gaugeType: p.isIn(0, 1),
gaugeType: p.isIn(0, 1, 2),
mirror: "boolean",
random: "boolean",
autoFlags: p.isInteger,
@@ -24,7 +24,7 @@ export interface USCClientScore {
late: integer | null;
combo: integer | null;
options: {
gaugeType: 0 | 1;
gaugeType: 0 | 1 | 2;
gaugeOpt: integer;
mirror: boolean;
random: boolean;