Fix the rest of the jubeat class implementations.

This commit is contained in:
zkldi
2022-01-06 07:42:06 +00:00
parent 7b1e225b6b
commit ce856d637d
4 changed files with 52 additions and 10 deletions
+13
View File
@@ -195,3 +195,16 @@ export enum POPN_CLASSES {
HERMIT,
GOD,
}
export enum JUBEAT_COLOURS {
BLACK,
YELLOW_GREEN,
GREEN,
LIGHT_BLUE,
BLUE,
VIOLET,
PURPLE,
PINK,
ORANGE,
GOLD,
}
@@ -1,6 +1,7 @@
import {
CHUNITHM_COLOURS,
GitadoraColours,
JUBEAT_COLOURS,
POPN_CLASSES,
SDVXVFClasses,
WACCA_COLOURS,
@@ -199,13 +200,37 @@ function ChuniRatingToColour(rating: number) {
return CHUNITHM_COLOURS.BLUE;
}
// export function CalculateJubeatColour(
// game: Game,
// playtype: Playtypes[Game],
// userID: integer,
// ratings: Record<string, number>
// ): GameClasses<"jubeat:Single"> {
// throw new Error("Not implemented.");
// }
export function CalculateJubeatColour(
game: Game,
playtype: Playtypes[Game],
userID: integer,
ratings: Record<string, number>
) {
const colour = JubilityToColour(ratings.jubility);
// function JubilityToColour(jb: number) {}
return { colour };
}
function JubilityToColour(jubility: number) {
if (jubility >= 9500) {
return JUBEAT_COLOURS.GOLD;
} else if (jubility >= 8500) {
return JUBEAT_COLOURS.ORANGE;
} else if (jubility >= 7000) {
return JUBEAT_COLOURS.PINK;
} else if (jubility >= 5500) {
return JUBEAT_COLOURS.PURPLE;
} else if (jubility >= 4000) {
return JUBEAT_COLOURS.VIOLET;
} else if (jubility >= 2500) {
return JUBEAT_COLOURS.BLUE;
} else if (jubility >= 1500) {
return JUBEAT_COLOURS.LIGHT_BLUE;
} else if (jubility >= 750) {
return JUBEAT_COLOURS.GREEN;
} else if (jubility >= 250) {
return JUBEAT_COLOURS.YELLOW_GREEN;
}
return JUBEAT_COLOURS.BLACK;
}
@@ -8,6 +8,7 @@ import { ReturnClassIfGreater } from "utils/class";
import {
CalculateChunithmColour,
CalculateGitadoraColour,
CalculateJubeatColour,
CalculatePopnClass,
CalculateSDVXClass,
CalculateWACCAColour,
@@ -57,7 +58,9 @@ const STATIC_CLASS_HANDLERS: ClassHandlerMap = {
wacca: {
Single: CalculateWACCAColour,
},
jubeat: null,
jubeat: {
Single: CalculateJubeatColour,
},
};
/**
@@ -161,6 +161,7 @@ const RatingFunctions: RatingFunctions = {
jubeat: {
Single: async (g, p, u, l) => ({
jubility: await CalculateJubility(g, p, u, l),
naiveJubility: await LazySumN("jubility", 60)(g, p, u),
}),
},
};