Schafkopf-Server/Sources/App/Model/Players/FinishedPlayer.swift
2021-12-21 09:53:42 +01:00

36 lines
734 B
Swift

import Foundation
final class FinishedPlayer: Player {
let points: Int
let leadsGame: Bool
let playedCard: Card
let selectedGame: Bool
init(player: PlayingPlayer) {
self.points = player.wonTricks.map { $0.points }.reduce(0, +)
self.leadsGame = player.leadsGame
self.playedCard = player.playedCard!
self.selectedGame = player.selectsGame
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.playedCard = playedCard.id
return result
}
}