diff --git a/game/game.go b/game/game.go index 84151c1..a022c5c 100644 --- a/game/game.go +++ b/game/game.go @@ -56,6 +56,13 @@ func (g *Game) Opponent() *Player { // Apply uses an item by index for the current player. func (g *Game) Apply(item int) { + cur := &g.PP[g.CurrentPlayer()] + if item < 0 || item >= len(cur.Items) { + return + } + if cur.Items[item].Apply(g) { + cur.Items[item] = ItemNone + } } // PopShell removes a shell from the shotgun.