Merge task #26: upgrade tiers and timed shed stock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	game/scripts/coop_session.gd
This commit is contained in:
Forrest 2026-10-06 16:20:52 -04:00
commit 787b36a1c2
12 changed files with 531 additions and 137 deletions

View file

@ -110,7 +110,8 @@ func _waves(plan: NightPlan) -> int:
return waves
## The upgrades change the systems they're about, can't be bought twice or at night, and persist.
## The upgrades (level 1 of each) change the systems they're about, can't be bought twice (a
## one-off) or before their day (a next level) or at night, and persist.
func _upgrades(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void:
var c := sim.campaign
var s := c.state
@ -131,13 +132,17 @@ func _upgrades(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void
var shed := s.resources.shed_total()
var spent := 0
r.check(not player.can_sprint(), "(no sprint before the Sprint upgrade)")
var day := s.night
s.night = 14 # every shed item is in stock by day 14 (#26's from_day)
for id in Upgrades.ORDER:
spent += _sum(Upgrades.cost(cfg, id))
var text := Upgrades.buy(c, id, st)
r.check(Upgrades.owned(s, id) and text.contains("done:"), "bought %s: '%s'" % [id, text])
r.check(s.resources.shed_total() == shed - spent, "all %d cost %d materials together" % [Upgrades.ORDER.size(), spent])
r.check(Upgrades.level(s, id) == 1 and text.contains("done:"), "bought %s: '%s'" % [id, text])
s.night = day
r.check(s.resources.shed_total() == shed - spent, "all %d cost %d materials together (level 1 each)" % [Upgrades.ORDER.size(), spent])
r.check(player.can_sprint(), "sprint: the scarecrow can sprint")
r.check(Upgrades.buy(c, "rapid_fire", st).contains("already done"), "an upgrade can't be bought twice")
r.check(Upgrades.buy(c, "sprint", st).contains("already done") and Upgrades.buy(c, "rapid_fire", st).contains("level 2 opens on day 8")
and Upgrades.level(s, "rapid_fire") == 1, "a one-off can't be bought twice, and an upgrade's level 2 waits for day 8")
r.check(sim.combat.interval_ticks() < int(before["interval"]) and sim.combat.shot_damage() == int(before["damage"]) + 1,
"rapid fire and heavy seeds: a shot every %d ticks (was %d), %d damage" % [sim.combat.interval_ticks(), before["interval"], sim.combat.shot_damage()])
r.check(is_equal_approx(sim.scarecrow.fear_radius(), float(before["radius"]) * 1.3) and is_equal_approx(sim.scarecrow.fear_cooldown(), float(before["cooldown"]) * 0.8),
@ -180,7 +185,7 @@ func _upgrades(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void
var bought := s.upgrades.duplicate()
while s.phase != P.NIGHT:
c.advance_phase()
r.check(Upgrades.blocker(c, "rapid_fire") == "Done" and Upgrades.buy(c, "long_range", st).contains("already done"), "(owned ones stay owned at night)")
r.check(Upgrades.blocker(c, "sprint") == "Done" and Upgrades.buy(c, "radar", st).contains("already done"), "(owned ones stay owned at night)")
s.upgrades.erase("sticky_tar")
r.check(Upgrades.blocker(c, "sticky_tar") == "The work area is for daytime", "nothing can be bought at night")
s.upgrades["sticky_tar"] = 1