Debug F8 unlocks everything: every upgrade and shop item at its last level
CampaignDebug.unlock_all (debug builds, not on a co-op partner's machine, until the vacation ends) grants every upgrade and shed item at its last level for free through Upgrades.grant_all, which shares the new Upgrades.level_up with buy(), so each level's effect (max health, pouch, barrier health) applies as if bought. Not counted as bought in the night record. In the morning review the retry snapshot is retaken (CampaignController.retake_morning_snapshot) so a retry keeps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3f32596034
commit
10390cf382
5 changed files with 101 additions and 5 deletions
|
|
@ -28,6 +28,7 @@ func run(r: GameTestRunner) -> void:
|
|||
await _hidden_items(r)
|
||||
await _tiers(r)
|
||||
await _stock(r)
|
||||
await _unlock_all(r)
|
||||
var farm := (load("res://game/scenes/farm.tscn") as PackedScene).instantiate() as Node3D
|
||||
r.root.add_child(farm)
|
||||
await r.process_frame
|
||||
|
|
@ -383,6 +384,51 @@ func _tiers(r: GameTestRunner) -> void:
|
|||
## Timed shed stock (#26): each shed item arrives on its day ("from_day"; day N is the day before
|
||||
## night N) and can't be bought before it. Its row shows just its name, greyed, and "Arrives on
|
||||
## day N"; a hidden one shows "?" and its day until it arrives, then the bare "?" until revealed.
|
||||
## Debug F8 (CampaignDebug.unlock_all): on day 1, every upgrade and shop item goes to its last
|
||||
## level for free, each level's effect applied; a retry from the morning review keeps it, one from
|
||||
## later in the day goes back to the morning without it.
|
||||
func _unlock_all(r: GameTestRunner) -> void:
|
||||
var c := r.make_campaign((load("res://game/resources/game_config.tres") as GameConfig).duplicate(true) as GameConfig)
|
||||
var cfg := c.config
|
||||
var s := c.state
|
||||
var debug := CampaignDebug.new()
|
||||
debug.campaign = c
|
||||
r.root.add_child(debug)
|
||||
await r.process_frame
|
||||
var hp := s.scarecrow_max_hp
|
||||
var pouch := s.resources.pouch_capacity
|
||||
var shed: Dictionary = s.resources.shed.duplicate()
|
||||
var damage := Upgrades.value(cfg, s, "shot_damage")
|
||||
var key := InputEventKey.new()
|
||||
key.physical_keycode = KEY_F8
|
||||
key.pressed = true
|
||||
debug._unhandled_input(key)
|
||||
var all_max := true
|
||||
for id: String in cfg.upgrades:
|
||||
all_max = all_max and Upgrades.maxed(cfg, s, id) and Upgrades.blocker(c, id) == "Done"
|
||||
r.check(all_max and s.night == 1 and Upgrades.levels_bought(cfg, s) == Upgrades.levels_total(cfg),
|
||||
"F8 on the first morning: every upgrade and shop item at its last level (%d levels), hidden and not-yet-arrived ones too"
|
||||
% Upgrades.levels_bought(cfg, s))
|
||||
r.check(s.resources.shed == shed and int(s.night_events.get("upgrades_bought", 0)) == 0, "free, and not counted as bought")
|
||||
r.check(s.scarecrow_max_hp == hp + 6 and s.scarecrow_hp == hp + 6 and s.resources.pouch_capacity == pouch + 16
|
||||
and is_equal_approx(Upgrades.value(cfg, s, "shot_damage"), damage + 3),
|
||||
"each level's effect applies: max health %d -> %d, pouch %d -> %d, kernels %.0f -> %.0f"
|
||||
% [hp, s.scarecrow_max_hp, pouch, s.resources.pouch_capacity, damage, Upgrades.value(cfg, s, "shot_damage")])
|
||||
r.check(debug.unlock_all() == 0, "pressing it again adds nothing")
|
||||
c.retry_night()
|
||||
r.check(Upgrades.levels_bought(cfg, c.state) == Upgrades.levels_total(cfg), "from the morning review, a retry keeps it")
|
||||
c.new_campaign()
|
||||
c.begin_day()
|
||||
r.check(debug.unlock_all() == Upgrades.levels_total(cfg), "it works by day too")
|
||||
c.retry_night()
|
||||
r.check(Upgrades.levels_bought(cfg, c.state) == 0, "a retry from later in the day goes back to the morning without it")
|
||||
c.outcome = CampaignController.Outcome.GAME_OVER_SCARECROW
|
||||
c.state.phase = CampaignController.Phase.GAME_OVER
|
||||
r.check(debug.unlock_all() == 0 and Upgrades.levels_bought(cfg, c.state) == 0, "nothing once the vacation is over")
|
||||
debug.queue_free()
|
||||
c.queue_free()
|
||||
|
||||
|
||||
func _stock(r: GameTestRunner) -> void:
|
||||
var c := r.make_campaign((load("res://game/resources/game_config.tres") as GameConfig).duplicate(true) as GameConfig)
|
||||
var cfg := c.config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue