summaryrefslogtreecommitdiff
path: root/engine/game.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-09-15 13:41:27 +0200
committerewy <ewy0@protonmail.com>2026-09-15 13:41:27 +0200
commitb82e6069c9dc93eff6e539a8cccd73e69ecde38e (patch)
tree84127d459d176bb560a0d4253e7b03bf58cc07c2 /engine/game.go
parent899ef7448222f0d087c194b3379b702f8dd2ff8c (diff)
update
Diffstat (limited to 'engine/game.go')
-rw-r--r--engine/game.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/engine/game.go b/engine/game.go
index 0ed93e2..19880f0 100644
--- a/engine/game.go
+++ b/engine/game.go
@@ -13,6 +13,8 @@ type Game struct {
Stack []IsCard
Actions map[InteractionID]Action
+
+ CurrentPlayer *Player
}
func (g *Game) propagate() {
@@ -28,6 +30,7 @@ func NewGame() *Game {
g.Yin = NewPlayer(g)
g.Yang = NewPlayer(g)
g.propagate()
+ g.NextTurn()
return g
}
@@ -45,3 +48,19 @@ func (g *Game) Winner() *Player {
}
return nil
}
+
+func (g *Game) NextTurn() {
+ current := g.CurrentPlayer.Opponent(g)
+ g.CurrentPlayer = current
+ g.Actions = Interactions(&ShuffleDeck{
+ &BaseAction{
+ User: current,
+ BaseSource: nil,
+ },
+ }, &DrawCard{
+ &BaseAction{
+ User: current,
+ BaseSource: nil,
+ },
+ })
+}