From 4faa467ef4c8d2aead7e0f3376d44827575fc8e2 Mon Sep 17 00:00:00 2001 From: ryo-ma Date: Sun, 23 Aug 2020 19:34:06 +0900 Subject: [PATCH] Add TotalFollowerTrophy --- src/card.ts | 10 +++++++++- src/trophies.ts | 49 ++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/card.ts b/src/card.ts index e45f1b7..96a02a8 100644 --- a/src/card.ts +++ b/src/card.ts @@ -1,4 +1,4 @@ -import { TotalStarTrophy, TotalCommitTrophy } from "./trophies.ts"; +import { TotalStarTrophy, TotalCommitTrophy, TotalFollowerTrophy } from "./trophies.ts"; export class Card { constructor(private width = 1000, private height = 200) { @@ -12,6 +12,10 @@ export class Card { const trophy6 = new TotalCommitTrophy(200); const trophy7 = new TotalCommitTrophy(1000); const trophy8 = new TotalCommitTrophy(5000); + const trophy9 = new TotalFollowerTrophy(1); + const trophy10 = new TotalFollowerTrophy(50); + const trophy11 = new TotalFollowerTrophy(100); + const trophy12 = new TotalFollowerTrophy(500); return ` `; } } diff --git a/src/trophies.ts b/src/trophies.ts index 889bb20..88e974f 100644 --- a/src/trophies.ts +++ b/src/trophies.ts @@ -40,22 +40,26 @@ abstract class Trophy { export class TotalStarTrophy extends Trophy { constructor(private totalStartgazer: Number) { super(); - this.title = "TOTAL STAR"; + this.title = "STAR"; this.setRank(); } setRank() { if (this.totalStartgazer >= 1000) { this.rank = "S"; - this.topMessage = "Super Star +1000"; + this.topMessage = "Super Star"; + this.bottomMessage = "+1000"; } else if (this.totalStartgazer >= 500) { this.rank = "A"; - this.topMessage = "High Star +500"; + this.topMessage = "High Star"; + this.bottomMessage = "+500"; } else if (this.totalStartgazer >= 100) { this.rank = "B"; - this.topMessage = "Middle Star +100"; + this.topMessage = "Middle Star"; + this.bottomMessage = "+100"; } else if (this.totalStartgazer >= 1) { this.rank = "C"; this.topMessage = "First Star"; + this.bottomMessage = "+1"; } } } @@ -63,25 +67,52 @@ export class TotalStarTrophy extends Trophy { export class TotalCommitTrophy extends Trophy { constructor(private totalStartgazer: Number) { super(); - this.title = "TOTAL COMMIT"; + this.title = "COMMIT"; this.setRank(); } setRank() { if (this.totalStartgazer >= 5000) { this.rank = "S"; - this.topMessage = "Super commiter"; + this.topMessage = "Super Commiter"; this.bottomMessage = "+5000"; } else if (this.totalStartgazer >= 1000) { this.rank = "A"; - this.topMessage = "High commiter"; + this.topMessage = "High Commiter"; this.bottomMessage = "+1000"; } else if (this.totalStartgazer >= 200) { this.rank = "B"; - this.topMessage = "Middle commiter"; + this.topMessage = "Middle Commiter"; this.bottomMessage = "+200"; } else if (this.totalStartgazer >= 1) { this.rank = "C"; - this.topMessage = "First commit"; + this.topMessage = "First Commit"; + this.bottomMessage = "+1"; + } + } +} + +export class TotalFollowerTrophy extends Trophy { + constructor(private totalStartgazer: Number) { + super(); + this.title = "FOLLOWER"; + this.setRank(); + } + setRank() { + if (this.totalStartgazer >= 500) { + this.rank = "S"; + this.topMessage = "Celebrity"; + this.bottomMessage = "+500"; + } else if (this.totalStartgazer >= 200) { + this.rank = "A"; + this.topMessage = "Famous User"; + this.bottomMessage = "+200"; + } else if (this.totalStartgazer >= 50) { + this.rank = "B"; + this.topMessage = "Many Friends"; + this.bottomMessage = "+50"; + } else if (this.totalStartgazer >= 1) { + this.rank = "C"; + this.topMessage = "First Friend"; this.bottomMessage = "+1"; } }