implemented item use
This commit is contained in:
parent
e173225b6e
commit
8691cda9eb
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user