Add SECRET RANK

This commit is contained in:
ryo-ma 2020-08-28 02:18:29 +09:00
parent 819c5ba2b8
commit b1babb507c
2 changed files with 22 additions and 2 deletions

View file

@ -9,12 +9,14 @@ class RankCondition {
) {}
}
export class Trophy {
rankCondition: RankCondition | null = null;
rank: RANK = RANK.UNKNOWN;
topMessage = "Unknown";
bottomMessage = "0";
title = "";
hidden = false;
constructor(
private score: number,
private rankConditions: Array<RankCondition>,
@ -38,7 +40,8 @@ export class Trophy {
}
private calculateNextRankPercentage() {
const nextRankIndex = RANK_ORDER.indexOf(this.rank) - 1;
if (nextRankIndex < 0) {
// When got the max rank
if (nextRankIndex < 0 || this.rank === RANK.SSS) {
return 1;
}
const nextRank = RANK_ORDER[nextRankIndex];
@ -87,6 +90,22 @@ export class Trophy {
}
}
export class MultipleLangTrophy extends Trophy{
constructor(score: number){
const rankConditions = [
new RankCondition(
RANK.SECRET,
"Rainbow Lang User",
7,
),
];
super(score, rankConditions);
this.title = "MultipleLang";
this.hidden = true;
}
}
export class TotalStarTrophy extends Trophy {
constructor(score: number) {
const rankConditions = [

View file

@ -28,6 +28,7 @@ export const CONSTANTS = {
};
export enum RANK {
SECRET = "SECRET",
SSS = "SSS",
SS = "SS",
S = "S",