diff options
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt index 60dc505b..1d4fab65 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt @@ -34,12 +34,14 @@ class Game internal constructor( private val preparedMoves: MutableMap<Int, Move> = mutableMapOf() private var currentTurnInfo: List<PlayerTurnInfo> = emptyList() private var hands: Hands = Hands(emptyList()) + private var militaryConflictsResolved = false init { startNewAge() } private fun startNewAge() { + militaryConflictsResolved = false table.increaseCurrentAge() hands = decks.deal(table.currentAge, players.size) startNewTurn() @@ -196,7 +198,12 @@ class Game internal constructor( private fun endOfAgeReached(): Boolean = hands.isEmpty - private fun executeEndOfAgeEvents() = table.resolveMilitaryConflicts() + private fun executeEndOfAgeEvents() { + if (!militaryConflictsResolved) { + table.resolveMilitaryConflicts() + militaryConflictsResolved = true + } + } fun endOfGameReached(): Boolean = endOfAgeReached() && table.currentAge == LAST_AGE |