diff --git a/Sources/App/Model/Tables/BiddingTable.swift b/Sources/App/Model/Tables/BiddingTable.swift index 21339f4..1a224c4 100644 --- a/Sources/App/Model/Tables/BiddingTable.swift +++ b/Sources/App/Model/Tables/BiddingTable.swift @@ -131,7 +131,11 @@ final class BiddingTable: AbstractTable { players.forEach { $0.isAllowedToOfferWedding = false } } } - selectNextBidder() + if remainingBidders == 1 { + moveToGameSelection() + } else { + selectNextBidder() + } return (.success, nil) } @@ -150,11 +154,7 @@ final class BiddingTable: AbstractTable { if gameToOutbid != .none { // Last player must play player.isNextActor = false - indexOfHighestBidder = players.firstIndex { $0.isStillBidding == true }! - let highestPlayer = players[indexOfHighestBidder] - highestPlayer.isStillBidding = false - highestPlayer.selectsGame = true - highestPlayer.isNextActor = true + moveToGameSelection() return (.success, nil) } default: @@ -164,6 +164,14 @@ final class BiddingTable: AbstractTable { return (.success, nil) } + private func moveToGameSelection() { + indexOfHighestBidder = players.firstIndex { $0.isStillBidding == true }! + let highestPlayer = players[indexOfHighestBidder] + highestPlayer.isStillBidding = false + highestPlayer.selectsGame = true + highestPlayer.isNextActor = true + } + override func cards(forPlayerAt index: Int) -> [PlayableCard] { players[index].cards.unplayable }