Skip to content

Commit

Permalink
增加新的段位上限
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Sep 23, 2024
1 parent 6beda0e commit d583d5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/Game.kt
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ class Game(val id: Int, totalPlayerCount: Int, val actorRef: ActorRef) {
if (declaredWinners != null && winners != null) {
if (players.size >= 5) {
if (winners.isNotEmpty() && winners.size < players.size) {
val totalWinners = winners.sumOf { (Statistics.getScore(it) ?: 0).coerceIn(180..1900) }
val totalPlayers = players.sumOf { (Statistics.getScore(it!!) ?: 0).coerceIn(180..1900) }
val totalWinners = winners.sumOf { (Statistics.getScore(it) ?: 0).coerceIn(180..2000) }
val totalPlayers = players.sumOf { (Statistics.getScore(it!!) ?: 0).coerceIn(180..2000) }
val totalLoser = totalPlayers - totalWinners
val delta = totalLoser / (players.size - winners.size) - totalWinners / winners.size
for ((i, p) in players.withIndex()) {
Expand Down
9 changes: 6 additions & 3 deletions src/main/kotlin/ScoreFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import kotlin.math.ceil
import kotlin.math.round

object ScoreFactory : Logging {
private val rankString = listOf("I", "II", "III", "IV", "V")
private val rankString = listOf("I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X")

fun getRankNameByScore(score: Int): String = when {
score < 60 -> "\uD83E\uDD49" + rankString[2 - score / 20]
Expand All @@ -27,10 +27,12 @@ object ScoreFactory : Logging {
score < 1000 -> "\uD83D\uDC8D" + rankString[4 - (score - 600) / 80]
score < 1500 -> "\uD83D\uDCA0" + rankString[4 - (score - 1000) / 100]
score < 2000 -> "\uD83D\uDC51" + rankString[4 - (score - 1500) / 100]
else -> "\uD83D\uDC51" + rankString[0]
score < 2900 -> "\u2B50" + rankString[9 - (score - 2000) / 100]
else -> "\u2B50" + rankString[0]
}

fun getSeasonTitleByScore(score: Int): String = when {
score >= 2900 -> "\u2B50"
score >= 1900 -> "\uD83D\uDC51"
score >= 1400 -> "\uD83D\uDCA0"
score >= 920 -> "\uD83D\uDC8D"
Expand All @@ -47,7 +49,8 @@ object ScoreFactory : Logging {
score < 1000 -> "铂金" + rankString[4 - (score - 600) / 80]
score < 1500 -> "钻石" + rankString[4 - (score - 1000) / 100]
score < 2000 -> "大师" + rankString[4 - (score - 1500) / 100]
else -> "大师" + rankString[0]
score < 2800 -> "至尊" + rankString[9 - (score - 2000) / 100]
else -> "至尊" + rankString[0]
}
}

Expand Down

0 comments on commit d583d5c

Please sign in to comment.