aboutsummaryrefslogtreecommitdiff
path: root/go/game/player.go
blob: 78ba69a7e31d5d073b1ab788411fa3cef1749f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package game

import (
	"image/color"
)

const (
	MAX_DRAW int = 3
)

type Player struct {
	Id          int
	Name        string
	Hand        *Hand
	DiscardPile *DiscardPile
	Deck        *Deck
	Ressource   int
	gameState   *State
	Color       color.Color
}

func NewPlayer(id int, name string, deck *Deck, gameState *State, color color.Color) *Player {
	p := Player{id, name, NewHand(), NewDiscardPile(), deck, 0, gameState, color}
	return &p
}

func (p *Player) Draw() {
	toDraw := MAX_DRAW - p.Hand.Size()
	if toDraw < 1 {
		return
	}

	drawnCards := p.Deck.Draw(toDraw)
	p.Hand.AddCards(drawnCards)
}

func (p *Player) PlayPermanent(card *Card) {
}