This commit is contained in:
Forrest 2026-10-07 14:50:55 -04:00
parent 215e24e246
commit bbd8012fff
16 changed files with 510 additions and 213 deletions

View file

@ -183,16 +183,16 @@ func _dawn_and_morning(r: GameTestRunner, sim: FarmSim, review: ReviewPanel, bef
"animal losses are recorded and no sack is left in transit")
r.check(s.scarecrow_hp == 7, "the scarecrow's health carries over")
r.check(review.visible and review._title.text == "Morning of day 2 of %d" % sim.config.campaign_nights and review._last_head.visible
and review._last_head.text == "Night 1: Crows at the crops" and review._body.text.contains("Needs repair"),
"the morning screen shows last night's results and what needs repair")
and review._last_head.text == "Night 1: Crows at the crops", "the morning screen shows last night's results")
var rows := ReviewPanel.category_counts(e)
r.check(review.grid_text() == "Crops %d %d %d\nAnimals %d %d %d\nSupplies %d %d %d" % (rows["Crops"] + rows["Animals"] + rows["Supplies"])
and review._body.text.contains("%d of %d animals" % [s.animals, s.animals_total]), "with every category's taken, recovered, and lost")
var killed := int(e["killed_crow"]) + int(e["killed_thief"]) + int(e["killed_breaker"])
r.check(review._results.text.contains("Enemies defeated: ") and review._results.text.contains("Materials: gathered 2 wood")
and (killed == 0) == review._results.text.contains("defeated: none") and int(e["gathered_wood"]) == 2
and int(e["structures_built"]) == 2 and int(e["structures_damaged"]) >= 6, "enemies defeated, damage, and the day's gathering and building")
r.info("morning screen:\n" + review.grid_text() + "\n" + review._results.text + "\n" + review._body.text)
r.check(review.grid_text() == "Crops %d %d %d\nAnimals %d %d %d\nSupplies %d %d %d" % (rows["Crops"] + rows["Animals"] + rows["Supplies"]),
"with every category's taken, recovered, and lost")
var killed := int(e["killed_crow"]) + int(e["killed_thief"]) + int(e["killed_breaker"]) + int(e["killed_ufo"])
r.check((killed == 0) == (review.enemies_text() == "None") and (int(e["killed_crow"]) == 0 or review.enemies_text().contains("Crows %d" % int(e["killed_crow"])))
and review.materials_text().begins_with("Wood 2") and int(e["gathered_wood"]) == 2
and int(e["structures_built"]) == 2 and int(e["structures_damaged"]) >= 6, "the enemies defeated and the day's gathering ('%s'; '%s')" % [
review.enemies_text(), review.materials_text()])
r.info("morning screen:\n" + review.grid_text() + "\nEnemies: " + review.enemies_text() + "\nMaterials: " + review.materials_text())
func _retry(r: GameTestRunner, sim: FarmSim) -> void:

View file

@ -396,15 +396,12 @@ func _night_jump(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
f3.physical_keycode = KEY_F3
f3.pressed = true
debug._unhandled_input(f3)
var tonight := sim.waves.plan_for(2).title
var body := (sim.review_panel._body as Label).text
r.check(c.state == s and s.night == 2 and s.nights_survived == 1 and s.phase == P.MORNING,
"F3: the morning of day 2 (%d survived)" % s.nights_survived)
r.check(s.structure(fence).size() > 0 and s.resources.shed == shed and s.scarecrow_hp == s.scarecrow_max_hp - 1
and s.crops_total == crops and st.has_workbench(),
"the farm is as it was (the fence, the shed, the scarecrow's HP), and the Workbench is granted")
r.check(c.morning_snapshot() == s.to_dict() and sim.review_panel.visible and body.contains("Tonight: %s." % tonight),
"the retry snapshot and the review panel are day 2's")
r.check(c.morning_snapshot() == s.to_dict() and sim.review_panel.visible, "the retry snapshot is day 2's, and the review panel is up")
debug._unhandled_input(f3)
r.check(s.night == 3 and s.nights_survived == 2 and s.crops_total == crops + 30 and sim.loot.count(LootSystem.Status.DORMANT) == dormant - 30,
"F3 again: day 3, and the field due after night 2 sprouts (%d crops)" % s.crops_total)

View file

@ -394,7 +394,6 @@ func _breach(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void:
inside = inside and pen.has_point(sim.animals.position(id))
r.check(inside and _at_loose_spots(sim) and sim.animals.pen_open,
"every penned animal is in the pen and every loose one at its spot (the pen still open: the gate is gone)")
r.check(sim.review_panel._body.text.contains("The pen is open"), "the morning review says the pen is open")
var e: Dictionary = s.night_log[s.night_log.size() - 1]
r.check(e["animals_lost"] == 0 and e["animals_strayed"] >= 2, "the night's record: %s" % [e])
# Retry: lose one to a thief tonight (the only way to lose an animal), fall, and the morning