implemented item use

This commit is contained in:
Branden J Brown 2024-01-20 23:02:15 -06:00
parent e173225b6e
commit 8691cda9eb
1 changed files with 7 additions and 0 deletions

View File

@ -56,6 +56,13 @@ func (g *Game) Opponent() *Player {
// Apply uses an item by index for the current player. // Apply uses an item by index for the current player.
func (g *Game) Apply(item int) { 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. // PopShell removes a shell from the shotgun.