class_name ExtraBall extends Item
## Item which grants extra balls when picked up.
## Amount values < 0 will instead grant the player unlimited ammunition of this type.

## Type of ball which will be replenished.
@export var ball_type: GameBall.Type


func _collect(player: WorldPlayer) -> void:
	if amount < 0:
		player.set_balls(ball_type, -1)
	else:
		player.mutate_balls(ball_type, amount)

	player.shot_setup.hud.peek_club_selector()
	player.shot_setup.hud.ball_particles.emit_spatial(maxi(amount, 1), global_position)
