track previous shell
This commit is contained in:
parent
402e3768e5
commit
178a86c597
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user