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 { export class Trophy {
rankCondition: RankCondition | null = null; rankCondition: RankCondition | null = null;
rank: RANK = RANK.UNKNOWN; rank: RANK = RANK.UNKNOWN;
topMessage = "Unknown"; topMessage = "Unknown";
bottomMessage = "0"; bottomMessage = "0";
title = ""; title = "";
hidden = false;
constructor( constructor(
private score: number, private score: number,
private rankConditions: Array<RankCondition>, private rankConditions: Array<RankCondition>,
@ -38,7 +40,8 @@ export class Trophy {
} }
private calculateNextRankPercentage() { private calculateNextRankPercentage() {
const nextRankIndex = RANK_ORDER.indexOf(this.rank) - 1; 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; return 1;
} }
const nextRank = RANK_ORDER[nextRankIndex]; 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 { export class TotalStarTrophy extends Trophy {
constructor(score: number) { constructor(score: number) {
const rankConditions = [ const rankConditions = [

View file

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