summaryrefslogtreecommitdiff
path: root/sw-engine
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-08-09 13:04:54 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-08-09 13:06:09 +0200
commit833a043a35d36c9089f11d87d992c2491a3f1213 (patch)
treeefdba2d364dc42b36a2c06b6c81760acf562fc5c /sw-engine
parentAdd screenshots to README (diff)
downloadseven-wonders-833a043a35d36c9089f11d87d992c2491a3f1213.tar.gz
seven-wonders-833a043a35d36c9089f11d87d992c2491a3f1213.tar.bz2
seven-wonders-833a043a35d36c9089f11d87d992c2491a3f1213.zip
Fix discarded card play at end of age
Resolves: https://github.com/joffrey-bion/seven-wonders/issues/36
Diffstat (limited to 'sw-engine')
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt12
1 files changed, 5 insertions, 7 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 da3ae5c7..34a8dd99 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
@@ -149,7 +149,9 @@ class Game internal constructor(
*/
fun playTurn(): TableState {
makeMoves()
- if (endOfAgeReached()) {
+ if (shouldStartPlayDiscardedTurn()) {
+ startPlayDiscardedTurn()
+ } else if (endOfAgeReached()) {
executeEndOfAgeEvents()
if (endOfGameReached()) {
startEndGameTurn()
@@ -157,12 +159,8 @@ class Game internal constructor(
startNewAge()
}
} else {
- if (shouldStartPlayDiscardedTurn()) {
- startPlayDiscardedTurn()
- } else {
- rotateHandsIfRelevant()
- startNewTurn()
- }
+ rotateHandsIfRelevant()
+ startNewTurn()
}
return table.toTableState()
}
bgstack15