summaryrefslogtreecommitdiff
path: root/sw-engine/src
diff options
context:
space:
mode:
Diffstat (limited to 'sw-engine/src')
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt14
1 files changed, 7 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 86526abe..ed58250f 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
@@ -144,6 +144,12 @@ class Game internal constructor(
*/
fun playTurn() {
makeMoves()
+
+ // same goes for the discarded cards during the last turn, which should be available for special actions
+ if (hands.maxOneCardRemains()) {
+ discardLastCardsIfRelevant()
+ }
+
if (shouldStartPlayDiscardedTurn()) {
startPlayDiscardedTurn()
} else if (endOfAgeReached()) {
@@ -165,12 +171,6 @@ class Game internal constructor(
// all cards from this turn need to be placed before executing any effect
// because effects depending on played cards need to take the ones from the current turn into account too
placePreparedCards(moves)
-
- // same goes for the discarded cards during the last turn, which should be available for special actions
- if (hands.maxOneCardRemains()) {
- discardLastCardsOfHands()
- }
-
activatePlayedCards(moves)
table.lastPlayedMoves = moves
@@ -223,7 +223,7 @@ class Game internal constructor(
}
}
- private fun discardLastCardsOfHands() =
+ private fun discardLastCardsIfRelevant() =
table.boards.filterNot { it.hasSpecial(SpecialAbility.PLAY_LAST_CARD) }.forEach { discardHand(it.playerIndex) }
private fun discardHand(playerIndex: Int) {
bgstack15