41 lines
862 B
Swift
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
|
|
}
|
|
}
|