summaryrefslogtreecommitdiff
path: root/sw-engine/src/main
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2021-02-16 01:37:32 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2021-02-16 02:24:33 +0100
commit7600b51a738a48f99b4198021f325d8053ddb6b5 (patch)
treecc0692261ec56df1976a3fdcfd27ab4a2a09cd15 /sw-engine/src/main
parentBetter naming isEmpty->areEmpty (diff)
downloadseven-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/src/main')
-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