diff options
Diffstat (limited to 'sw-common-model/src/commonMain')
-rw-r--r-- | sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt new file mode 100644 index 00000000..ca117c1d --- /dev/null +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt @@ -0,0 +1,27 @@ +package org.luxons.sevenwonders.model.score + +import kotlinx.serialization.Serializable + +@Serializable +class ScoreBoard(val scores: Collection<PlayerScore>) + +@Serializable +data class PlayerScore( + val boardGold: Int, + val pointsByCategory: Map<ScoreCategory, Int> +) : Comparable<PlayerScore> { + + val totalPoints = pointsByCategory.map { it.value }.sum() + + override fun compareTo(other: PlayerScore) = compareValuesBy(this, other, { it.totalPoints }, { it.boardGold }) +} + +enum class ScoreCategory { + CIVIL, + SCIENCE, + MILITARY, + TRADE, + GUILD, + WONDER, + GOLD +} |