From 07ea64c3b9e5a9a6ac4831baf542d44c820b9148 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Wed, 12 Aug 2020 01:45:05 +0200 Subject: Display only victory military points on the board next to victory tokens The count displayed used to be the total combined number of points including defeat tokens, but this is a bit confusing as we can see both types of tokens next to each other. --- .../main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt | 8 +++++--- .../kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'sw-engine/src') diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt index a4cb4ee8..0b81f29d 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt @@ -9,7 +9,10 @@ internal class Military( var nbShields = 0 private set - var totalPoints = 0 + val totalPoints + get() = victoryPoints + lostPointsPerDefeat * nbDefeatTokens + + var victoryPoints = 0 private set var nbDefeatTokens = 0 @@ -21,11 +24,10 @@ internal class Military( internal fun victory(age: Age) { val wonPoints = wonPointsPerVictoryPerAge[age] ?: throw UnknownAgeException(age) - totalPoints += wonPoints + victoryPoints += wonPoints } internal fun defeat() { - totalPoints -= lostPointsPerDefeat nbDefeatTokens++ } diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt index 0d8369ac..ba07ce3a 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt @@ -87,7 +87,8 @@ internal fun Resources.toCountedResourcesList(): List = .map { (type, count) -> CountedResource(count, type) } .sortedBy { it.type } -internal fun InternalMilitary.toApiMilitary(): ApiMilitary = ApiMilitary(nbShields, totalPoints, nbDefeatTokens) +internal fun InternalMilitary.toApiMilitary(): ApiMilitary = + ApiMilitary(nbShields, victoryPoints, totalPoints, nbDefeatTokens) internal fun InternalScience.toApiScience(): ApiScience = ApiScience( -- cgit