startingInventory function
What the player starts a game holding.
Here rather than as a field of the widget, which is where it was: the one test the application had could not reach it, so it built its own — and what it built was fists, a pistol and forty bullets against the game's four weapons and 90/30/12. "The crypt can be finished" was proved with equipment nobody is ever given.
A function rather than a constant because an Inventory is mutable and a
run spends it: two levels sharing one object would be two levels sharing
one health bar, which is right, and two runs sharing it would be a new
game that starts where the last one died, which is not.
Implementation
Inventory startingInventory() => Inventory(
arsenal: Arsenal(
slots: Weapons.all,
owned: <WeaponDef>[...Weapons.all],
ammo: <AmmoType, int>{
AmmoType.bullets: 90,
AmmoType.shells: 30,
AmmoType.rockets: 12,
},
// The pistol, not the fists: the game starts with both, and a shooter
// that opens with your hands up is making a promise it does not keep.
startingSlot: 1,
),
);