diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-29 18:02:47 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-29 18:07:31 +0200 |
commit | 57a6e5135ee554079c6064bd770d51545800969d (patch) | |
tree | 9c688d1fc261cf6740c63a604695f9301220830f /sw-engine | |
parent | Ensure error saga starts first (diff) | |
download | seven-wonders-57a6e5135ee554079c6064bd770d51545800969d.tar.gz seven-wonders-57a6e5135ee554079c6064bd770d51545800969d.tar.bz2 seven-wonders-57a6e5135ee554079c6064bd770d51545800969d.zip |
Fix duplicated inconsistent state
Diffstat (limited to 'sw-engine')
-rw-r--r-- | sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt index 935d66e5..ad3c28d4 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt @@ -50,7 +50,7 @@ class GameTest { assertEquals(nbPlayers, turnInfos.size) turnInfos.forEach { assertEquals(ageToCheck, it.currentAge) - assertEquals(handSize, it.hand.size) + assertEquals(handSize, it.hand?.size) } val moveExpectations = turnInfos.mapNotNull { it.firstAvailableMove() } @@ -67,20 +67,20 @@ class GameTest { private fun PlayerTurnInfo.firstAvailableMove(): MoveExpectation? = when (action) { Action.PLAY, Action.PLAY_2, Action.PLAY_LAST -> createPlayCardMove(this) Action.PICK_NEIGHBOR_GUILD -> createPickGuildMove(this) - Action.WAIT -> null + Action.WAIT, Action.SAY_READY -> null } private fun createPlayCardMove(turnInfo: PlayerTurnInfo): MoveExpectation { val wonderBuildability = turnInfo.wonderBuildability if (wonderBuildability.isBuildable) { val transactions = wonderBuildability.cheapestTransactions.first() - return planMove(turnInfo, MoveType.UPGRADE_WONDER, turnInfo.hand.first(), transactions) + return planMove(turnInfo, MoveType.UPGRADE_WONDER, turnInfo.hand!!.first(), transactions) } - val playableCard = turnInfo.hand.firstOrNull { it.playability.isPlayable } + val playableCard = turnInfo.hand!!.firstOrNull { it.playability.isPlayable } return if (playableCard != null) { planMove(turnInfo, MoveType.PLAY, playableCard, playableCard.playability.cheapestTransactions.first()) } else { - planMove(turnInfo, MoveType.DISCARD, turnInfo.hand.first(), + planMove(turnInfo, MoveType.DISCARD, turnInfo.hand!!.first(), noTransactions() ) } |