diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-28 12:47:00 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-28 13:34:57 +0200 |
commit | a4da60fa4a816e3b8428eaffd2bd605dc0aed031 (patch) | |
tree | 18fcef04d9826fb94854c1a38584460659d8a3dd /sw-bot | |
parent | Add server-side support for PLAY_FREE_DISCARDED special ability (diff) | |
download | seven-wonders-a4da60fa4a816e3b8428eaffd2bd605dc0aed031.tar.gz seven-wonders-a4da60fa4a816e3b8428eaffd2bd605dc0aed031.tar.bz2 seven-wonders-a4da60fa4a816e3b8428eaffd2bd605dc0aed031.zip |
Add UI support for playing discarded cards
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/25
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/26
Diffstat (limited to 'sw-bot')
-rw-r--r-- | sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt index 80bad9e4..daa4afe3 100644 --- a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt +++ b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt @@ -59,7 +59,7 @@ class SevenWondersBot( private suspend fun SevenWondersSession.playTurn(turn: PlayerTurnInfo): Boolean { when (turn.action) { Action.PLAY, Action.PLAY_2, Action.PLAY_LAST -> prepareMove(createPlayCardMove(turn)) - Action.PLAY_FREE_DISCARDED -> prepareMove(createPlayFreeDiscardedMove(turn)) + Action.PLAY_FREE_DISCARDED -> prepareMove(createPlayFreeDiscardedCardMove(turn)) Action.PICK_NEIGHBOR_GUILD -> prepareMove(createPickGuildMove(turn)) Action.SAY_READY -> sayReady() Action.WAIT -> Unit @@ -85,8 +85,8 @@ private fun createPlayCardMove(turnInfo: PlayerTurnInfo): PlayerMove { } } -private fun createPlayFreeDiscardedMove(turn: PlayerTurnInfo): PlayerMove { - val card = turn.discardedCards?.random() ?: error("No discarded card to play") +private fun createPlayFreeDiscardedCardMove(turnInfo: PlayerTurnInfo): PlayerMove { + val card = turnInfo.discardedCards?.random() ?: error("No discarded card to play") return PlayerMove(MoveType.PLAY_FREE_DISCARDED, card.name) } |