Merge task #3: pouch 8 base, Bigger pouch upgrade to 16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-05 14:50:44 -04:00
commit 5b72e830db
4 changed files with 54 additions and 5 deletions

View file

@ -18,6 +18,7 @@ func run(r: GameTestRunner) -> void:
_store(r)
_state(r)
_goop_persistence(r)
_pouch_upgrade(r)
await _hidden_items(r)
var farm := (load("res://game/scenes/farm.tscn") as PackedScene).instantiate() as Node3D
r.root.add_child(farm)
@ -105,6 +106,37 @@ func _goop_persistence(r: GameTestRunner) -> void:
r.check(back != null and back.resources.shed.get("alien_goop", -1) == 0, "the morning snapshot (what's saved) round-trips Alien Goop through JSON")
## Pouch capacity (#3): a flat 16 is now a base of 8, raised to 16 by the Bigger pouch upgrade
## (bought once at the workbench, like straw_stuffing raises scarecrow_max_hp). The upgrade writes
## straight to the live ResourceStore value (FarmState.create() only seeds it from GameConfig at
## the start of a vacation), so like scarecrow_max_hp it carries into the next morning (FarmState's
## "resources" field round-trips through JSON) and survives a save and a retry from a morning on
## or after the day it was bought.
func _pouch_upgrade(r: GameTestRunner) -> void:
var cfg := (load("res://game/resources/game_config.tres") as GameConfig).duplicate(true) as GameConfig
var c := r.make_campaign(cfg)
var s := c.state
r.check(cfg.pouch_capacity == 8 and s.resources.pouch_capacity == 8, "the pouch starts at the base 8 units")
c.begin_day()
s.resources.shed = cfg.costs["pouch_upgrade"].duplicate()
var msg := Upgrades.buy(c, "pouch_upgrade")
r.check(Upgrades.owned(s, "pouch_upgrade") and msg.contains("done:") and s.resources.pouch_capacity == 16,
"Bigger pouch raises capacity from 8 to 16 (%s)" % msg)
r.check(s.resources.shed_total() == 0, "it costs the configured materials")
r.check(Upgrades.buy(c, "pouch_upgrade").contains("already done"), "it can only be bought once")
# It carries into the next morning (same mechanic as straw_stuffing/scarecrow_max_hp).
while s.phase != P.MORNING:
c.advance_phase()
r.check(s.resources.pouch_capacity == 16, "the bigger pouch carries into the next morning")
var back := FarmState.from_dict(JSON.parse_string(JSON.stringify(s.to_dict())))
r.check(back != null and back.resources.pouch_capacity == 16, "and through a save")
# And a retry from that (later) morning keeps it, same as the upgrades dict itself.
c.begin_day()
c.advance_phase() # DAY -> DUSK
c.advance_phase() # DUSK -> NIGHT
r.check(c.retry_night() and c.state.resources.pouch_capacity == 16, "a retry from that morning keeps the bigger pouch")
## Hidden shop items (#5): an item definition can set "hidden": true (optionally its own
## "reveal_goop", else GameConfig.hidden_reveal_goop) so the workbench shows only a bare "?" (no
## name, text, or cost) and refuses the purchase (blocker()/buy(), so this also covers the co-op