summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt1
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt8
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt3
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt2
4 files changed, 9 insertions, 5 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt
index 333883b6..e080b929 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt
@@ -35,6 +35,7 @@ data class Production(
@Serializable
data class Military(
val nbShields: Int,
+ val victoryPoints: Int,
val totalPoints: Int,
val nbDefeatTokens: Int
)
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<CountedResource> =
.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(
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt
index 30efc894..011ce732 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt
@@ -113,7 +113,7 @@ private fun RBuilder.wonderComponent(wonder: ApiWonder, military: Military) {
this.alt = "Wonder ${wonder.name}"
}
}
- victoryPoints(military.totalPoints) {
+ victoryPoints(military.victoryPoints) {
css {
position = Position.absolute
top = 25.pct // below the wonder name
bgstack15