Schafkopf-Server/Sources/App/Model/Players/FinishedPlayer.swift

34 lines
690 B
Swift
Raw Normal View History

2021-12-18 15:08:43 +01:00
import Foundation
final class FinishedPlayer: Player {
let points: Int
let leadsGame: Bool
let playedCard: Card
2021-12-18 15:08:43 +01:00
init(player: PlayingPlayer) {
self.points = player.wonTricks.map { $0.points }.reduce(0, +)
self.leadsGame = player.leadsGame
self.playedCard = player.playedCard!
2021-12-18 15:08:43 +01:00
super.init(player: player)
}
override var actions: [PlayerAction] {
[.deal]
}
override var states: [PlayerState] {
super.states + [] // TODO: Finish
}
override var info: PlayerInfo {
var result = super.info
result.points = points
result.playedCard = playedCard.id
return result
}
2021-12-18 15:08:43 +01:00
}