blob: eb7ac498186e5c3bcea1e35202c5a129e2c13187 (
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
39
40
41
42
43
|
package engine
import (
"sakura/engine/pool"
)
type Player struct {
Game *Game `json:"-"`
Vigour Vigour
Life *pool.Pool
Aura *pool.Pool
Flare *pool.Pool
Hand Stack
MasterDeck Stack
DrawPile Stack
Ultimates []*Card
}
func (p *Player) Opponent(g *Game) *Player {
if p == g.Yin {
return g.Yang
} else {
return g.Yin
}
}
func (p *Player) propagate(g *Game) {
p.Game = g
p.Aura.SubtractsTo = g.Shadow
p.Flare.SubtractsTo = g.Shadow
p.Life.SubtractsTo = p.Flare
}
func NewPlayer(g *Game) *Player {
p := &Player{
Life: pool.New(pool.Empty, 10),
Aura: pool.New(3, 5),
Flare: pool.New(pool.Empty, pool.Infinite),
Vigour: Vigour(0),
}
p.propagate(g)
return p
}
|