Schafkopf-Server/Sources/App/Model/Players/CardHoldingPlayer.swift
2021-12-20 20:18:19 +01:00

41 lines
862 B
Swift

import Foundation
class CardHoldingPlayer: Player {
var didDouble: Bool
var cards: [Card]
var selectsGame = false
override init(player: Player) {
self.cards = []
self.didDouble = false
super.init(player: player)
}
init(player: CardHoldingPlayer) {
self.cards = player.cards
self.didDouble = player.didDouble
self.selectsGame = player.selectsGame
super.init(player: player)
}
override var states: [PlayerState] {
var states = super.states
if didDouble {
states.append(.didDouble)
}
if selectsGame {
states.append(.isGameSelector)
}
return states
}
override var info: PlayerInfo {
var info = super.info
info.numberOfDoubles = didDouble ? 1 : 0
return info
}
}