track previous shell

This commit is contained in:
Branden J Brown 2024-01-21 00:28:29 -06:00
parent 402e3768e5
commit 178a86c597
1 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,7 @@ type Game struct {
HP int8 HP int8
Damage int8 Damage int8
Reveal bool Reveal bool
Prev *bool
// Backing storage for shells. // Backing storage for shells.
ShellArray [8]bool ShellArray [8]bool
@ -51,6 +52,7 @@ func (g *Game) StartGroup() {
ShuffleSlice(&g.RNG, g.Shells) ShuffleSlice(&g.RNG, g.Shells)
g.Group++ g.Group++
g.Turn = 0 g.Turn = 0
g.Prev = nil
g.NextTurn() g.NextTurn()
} }
@ -93,9 +95,9 @@ func (g *Game) Apply(id player.ID, item int) error {
// This may cause the shotgun to be empty, but does not start the next group // This may cause the shotgun to be empty, but does not start the next group
// if so. // if so.
func (g *Game) PopShell() bool { func (g *Game) PopShell() bool {
r := g.Shells[0] g.Prev = &g.Shells[0]
g.Shells = g.Shells[1:] g.Shells = g.Shells[1:]
return r return *g.Prev
} }
// Empty returns whether the shotgun is empty. // Empty returns whether the shotgun is empty.