From 8691cda9eb2431d27a57b5a8a51bbfbdbcc22c81 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Sat, 20 Jan 2024 23:02:15 -0600 Subject: [PATCH] implemented item use --- game/game.go | 7 +++++++ 1 file changed, 7 insertions(+) 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.