Fix bidding error

This commit is contained in:
Christoph Hagen 2021-12-21 16:06:59 +01:00
parent ef966b0aa3
commit 97ff9ddce4

View File

@ -131,7 +131,11 @@ final class BiddingTable: AbstractTable<BiddingPlayer> {
players.forEach { $0.isAllowedToOfferWedding = false }
}
}
if remainingBidders == 1 {
moveToGameSelection()
} else {
selectNextBidder()
}
return (.success, nil)
}
@ -150,11 +154,7 @@ final class BiddingTable: AbstractTable<BiddingPlayer> {
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<BiddingPlayer> {
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
}