See if this gets you started.
The bullet had a bullet behavior added to it.
The weapon has an instance variable called ammo that starts with a value of 10.
When you press the space bar a bullet is spawned from the weapon and 1 is subtracted from the weapon's instance variable of ammo.
A condition of firing when you press the space bar is that the weapon's instance variable ammo must be greater than 0.