From 83b2f2e9922f46fe46fd5330e6b38c66d1483ade Mon Sep 17 00:00:00 2001 From: Ewy Date: Mon, 21 Sep 2026 21:40:05 +0200 Subject: (wip) --- engine/game.go | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'engine/game.go') diff --git a/engine/game.go b/engine/game.go index 5130864..8365869 100644 --- a/engine/game.go +++ b/engine/game.go @@ -4,6 +4,12 @@ import ( "sakura/engine/pool" ) +type Turn struct { + Player *Player + ActionTaken bool + Actions []Action +} + type Game struct { Shadow *pool.Pool Distance *pool.Pool @@ -12,9 +18,11 @@ type Game struct { Stack []IsCard - Actions map[InteractionID]Action + Actions []Action CurrentPlayer *Player + + History []Turn } func (g *Game) propagate() { @@ -25,7 +33,6 @@ func NewGame() *Game { g := &Game{ Shadow: pool.New(0, pool.Infinite), Distance: pool.New(10, 10), - Actions: nil, } g.Yin = NewPlayer(g) g.Yang = NewPlayer(g) @@ -52,15 +59,18 @@ func (g *Game) Winner() *Player { 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, - }, + g.History = append(g.History, Turn{ + Player: current, + ActionTaken: false, }) + g.Actions = Interactions(ShuffleDeckAction(g),DrawCardAction(g)), +} + +func (g *Game) CurrentTurn() Turn { + return g.History[len(g.History) - 1] +} + +func (g *Game) ActionToHistory(a Action) { + thisTurn := g.History[len(g.History)-1] + thisTurn.Actions = append(thisTurn.Actions, a) } -- cgit v1.3.1