diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-16 01:37:32 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-16 02:24:33 +0100 |
commit | 7600b51a738a48f99b4198021f325d8053ddb6b5 (patch) | |
tree | cc0692261ec56df1976a3fdcfd27ab4a2a09cd15 /sw-engine | |
parent | Better naming isEmpty->areEmpty (diff) | |
download | seven-wonders-7600b51a738a48f99b4198021f325d8053ddb6b5.tar.gz seven-wonders-7600b51a738a48f99b4198021f325d8053ddb6b5.tar.bz2 seven-wonders-7600b51a738a48f99b4198021f325d8053ddb6b5.zip |
Fix PLAY_LAST effect at end of age (Babylon B)
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/125
Diffstat (limited to 'sw-engine')
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt | 14 |
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) { |