Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cb5d054
Navigation: gates, switches and one-way warps; gated planner; gate st…
dayfine Nov 12, 2026
ac601a8
Gates: split MapGates and GatedTypes headers, document, bundle planne…
dayfine Nov 12, 2026
b08ee1a
Merge nav/gates into frlg/gates
dayfine Nov 12, 2026
d11b360
Merge nav/gates: keep the FRLG stack's PokemonFRLG_Navigation and EggRng
dayfine Nov 12, 2026
5f81d2a
FRLG: gate-aware step model, OPEN_GATE/PRESS_SWITCH route steps in th…
dayfine Nov 13, 2026
d528016
FRLG story: gate state and run flags carried through steps; walks pla…
dayfine Nov 13, 2026
521cfcf
FRLG gates: code-health splits (walk hold helpers, gates in SimState,…
dayfine Nov 13, 2026
c8f0b0e
Merge remote-tracking branch 'origin/frlg/gates' into frlg/stage19-vi…
dayfine Nov 13, 2026
8f4ad4e
FRLG AutoStory 19.01: Viridian Mart, then the Route 22 rival by PokeG…
dayfine Nov 13, 2026
0e10427
FRLG AutoStory 19.02: Route 22's ledge and north gate guard, onto Rou…
dayfine Nov 13, 2026
a5f2be9
Merge remote-tracking branch 'origin/frlg/stage17-viridian' into frlg…
dayfine Nov 13, 2026
d61eb5e
FRLG 19.01: rival foe_threats from PokemonSimulation planning_risk, p…
dayfine Nov 13, 2026
4597b3c
Merge remote-tracking branch 'origin/frlg/stage17-viridian' into frlg…
dayfine Nov 13, 2026
d71d34a
FRLG 19.03 to 19.05: Route 23's guards and Surf stretch, Strength int…
dayfine Nov 13, 2026
dc3163e
Merge remote-tracking branch 'origin/frlg/stage17-viridian' into frlg…
dayfine Nov 13, 2026
e6ceb4e
FRLG: push_boulder step and sim boulders, Victory Road 1F boulder sol…
dayfine Nov 13, 2026
d5af672
Merge frlg/stage17-viridian (12.02 split) into stage19-victory-road
dayfine Nov 13, 2026
2e01e82
Merge frlg/stage17-viridian (14.02 split) into frlg/stage19-victory-road
dayfine Nov 13, 2026
d27da2b
Merge frlg/stage17-viridian (14.04 split) into frlg/stage19-victory-road
dayfine Nov 13, 2026
c99ee72
FRLG AutoStory: the chain test expects 75 checkpoints (the split's me…
dayfine Nov 13, 2026
e8763df
Merge frlg/stage17-viridian (17.04 split) into frlg/stage19-victory-road
dayfine Nov 13, 2026
4af8b7d
FRLG 19.01: the Mart is 19.01a; 19.01 is the Route 22 rival alone
dayfine Nov 13, 2026
9b22816
Merge remote-tracking branch 'origin/frlg/stage17-viridian' into HEAD
dayfine Nov 13, 2026
fe17f4b
Merge frlg/stage17-viridian into frlg/stage19-victory-road
dayfine Nov 13, 2026
c3ab275
Merge origin/frlg/stage17-viridian into frlg/stage19-victory-road
dayfine Nov 13, 2026
6d74a59
Merge branch 'nav/grid-screen-state' into nav/grid-story-steps (#361)
dayfine Nov 13, 2026
87f4c4f
Merge branch 'nav/grid-story-steps' into nav/sim-goldens (#362)
dayfine Nov 13, 2026
567d6d0
Merge branch 'nav/sim-goldens' into nav/sim-faults (#419)
dayfine Nov 13, 2026
2652616
Merge origin/nav/sim-faults into nav/gates
dayfine Nov 13, 2026
54946de
Merge frlg/stage17-viridian into frlg/stage19-victory-road: upstream …
dayfine Nov 13, 2026
c0fee6b
Gates: switch keys per floor, boulder buttons, and the stop risks thr…
dayfine Nov 13, 2026
bdf9d6a
Merge origin/nav/gates into frlg/stage19-victory-road
dayfine Nov 13, 2026
62a89d1
Gates: OPEN_GATE and PRESS_SWITCH route leg actions, with their log text
dayfine Nov 13, 2026
d3d33cf
Merge origin/nav/gates into frlg/stage19-victory-road
dayfine Nov 13, 2026
37e6590
Merge autostory/engine into nav/gates
dayfine Nov 14, 2026
ed4adb5
Merge frlg/stage17-viridian into frlg/stage19-victory-road
dayfine Nov 14, 2026
16c7f59
Merge remote-tracking branch 'origin/nav/gates' into HEAD
dayfine Nov 14, 2026
0a3c5a0
Merge frlg/stage17-viridian into frlg/stage19-victory-road
dayfine Nov 14, 2026
346cf72
Merge frlg/stage17-viridian into frlg/stage19-victory-road
dayfine Nov 14, 2026
60c2eb8
Merge frlg/stage17-viridian into frlg/stage19-victory-road
dayfine Nov 14, 2026
a16820a
Merge origin/frlg/stage17-viridian into frlg/stage19-victory-road
dayfine Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ pa_embed_text_files(SerialProgramsLib Source/VideoGames/PokemonFRLG/Programs/Aut
VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.h PokemonAutomation::NintendoSwitch::PokemonFRLG autostory_checkpoint_json)
pa_embed_text_files(SerialProgramsLib Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData
VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_StoryReplay.h PokemonAutomation::NintendoSwitch::PokemonFRLG story_replay_fixture_json)
pa_embed_text_files(SerialProgramsLib Source/Pokemon/Navigation/GateTestMaps
Pokemon/Navigation/Pokemon_NavigationGateTestMaps.h PokemonAutomation::Pokemon navigation_gate_test_map_json)


# Create binary target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "PokemonBDSP/Inference/PokemonBDSP_MenuDetector.h"

#include "Pokemon/Navigation/Pokemon_ConnectedMaps_Tests.h"
#include "Pokemon/Navigation/Pokemon_Gates_Tests.h"
#include "Pokemon/Navigation/Pokemon_LegPlanner_Tests.h"
#include "Pokemon/Navigation/Pokemon_LegWalker_Tests.h"
#include "Pokemon/Navigation/Pokemon_MapData_Tests.h"
Expand Down Expand Up @@ -66,7 +67,7 @@



UnitTestDatabase make_UNIT_TESTS_ALL(){

Check failure on line 70 in SerialPrograms/Source/ComputerPrograms/ComputerPrograms_UnitTestRunner.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health

PokemonAutomation::ComputerPrograms::make_UNIT_TESTS_ALL(): function_lines=51, limit=50, allowed 50
UnitTestDatabase ret;

add_tests_QtEventThreadPool(ret, GlobalThreadPools::computation_normal());
Expand All @@ -93,6 +94,7 @@
Pokemon::add_tests_WallRecovery(ret);
Pokemon::add_tests_MapData(ret);
Pokemon::add_tests_ConnectedMaps(ret);
Pokemon::add_tests_Gates(ret);
Pokemon::add_tests_MoveMechanics(ret);
Pokemon::add_tests_RuntimeMap(ret);
Pokemon::add_tests_RouteLog(ret);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,53 @@
return result;
}

GateChange read_gate_change(const JsonValue& value, std::string_view source){
const JsonObject& root = fields(value, {"opened", "switches"}, source);
GateChange result;
if (const JsonValue* field = root.get_value("opened")){
for (std::string& key : read_strings(*field, source)){
result.opened.insert(std::move(key));
}
}
if (const JsonValue* field = root.get_value("switches")){
for (const auto& [id, on] : field->to_object_throw(std::string(source))){
result.switches[id] = on.to_boolean_throw(std::string(source));
}
}
return result;
}

JsonValue write_gate_change(const GateChange& change){
JsonObject object;
if (!change.opened.empty()){
JsonArray opened;
for (const std::string& key : change.opened){
opened.push_back(key);
}
object["opened"] = std::move(opened);
}
if (!change.switches.empty()){
JsonObject switches;
for (const auto& [id, on] : change.switches){
switches[id] = on;
}
object["switches"] = std::move(switches);
}
return object;
}

GateState read_gate_state(const JsonValue& value, std::string_view source){
GateState result;
apply_gate_change(result, read_gate_change(value, source));
return result;
}

JsonValue write_gate_state(const GateState& state){
return write_gate_change(gate_change_between(GateState(), state));
}

StoryStep read_story_step(const JsonValue& value, std::string_view source, std::span<const StoryActionSpec> actions){

Check warning on line 371 in SerialPrograms/Source/Pokemon/AutoStory/Data/Pokemon_StoryStepJson.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::Pokemon::read_story_step( const JsonValue & value , std :: string_view source , std :: span<const StoryActionSpec> actions): function_lines=29 (advisory above 25, limit 50)
const JsonObject& root = fields(value, {"id", "kind", "why", "action", "args", "skip_if", "declared_after"}, source);
const JsonObject& root = fields(value, {"id", "kind", "why", "action", "args", "skip_if", "declared_after", "gates_after", "flags_after"}, source);
StoryStep result;
result.name = root.get_string_throw("id");
if (result.name.empty()){
Expand All @@ -344,11 +389,17 @@
if (const JsonValue* field = root.get_value("declared_after")){
result.pose_after = read_declared_pose(*field, source);
}
if (const JsonValue* field = root.get_value("gates_after")){
result.gates_after = read_gate_change(*field, source);
}
if (const JsonValue* field = root.get_value("flags_after")){
result.flags_after = read_strings(*field, source);
}
return result;
}

StoryCheckpoint read_story_checkpoint(const JsonValue& value, std::string_view source, std::span<const StoryActionSpec> actions){

Check warning on line 401 in SerialPrograms/Source/Pokemon/AutoStory/Data/Pokemon_StoryStepJson.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::Pokemon::read_story_checkpoint( const JsonValue & value , std :: string_view source , std :: span<const StoryActionSpec> actions): function_lines=31 (advisory above 25, limit 50)
const JsonObject& root = fields(value, {"id", "title", "start", "events", "metadata"}, source);
const JsonObject& root = fields(value, {"id", "title", "start", "start_gates", "start_flags", "events", "metadata"}, source);
StoryCheckpoint result;
result.id = root.get_string_throw("id");
if (result.id.empty()){
Expand All @@ -358,6 +409,12 @@
if (const JsonValue* start = root.get_value("start")){
result.start = read_declared_pose(*start, source);
}
if (const JsonValue* gates = root.get_value("start_gates")){
result.start_gates = read_gate_state(*gates, source);
}
if (const JsonValue* flags = root.get_value("start_flags")){
result.start_flags = read_strings(*flags, source);
}
std::set<std::string> names;
result.steps_json = root.get_value_throw("events").dump(-1);
for (const JsonValue& event : root.get_array_throw("events")){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Story Step JSON

Check warning on line 1 in SerialPrograms/Source/Pokemon/AutoStory/Data/Pokemon_StoryStepJson.h

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<header>: header_symbols=8 (advisory above 6, limit 8)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -36,6 +36,20 @@
DeclaredPose read_declared_pose(const JsonValue& value, std::string_view source);


// Read a gate change, {"opened": ["SilphCo_5F/door_1"], "switches": {"mansion": true}}
// (the gates a step opens, the switches it sets; both optional, unknown
// fields fail) and write it back.
GateChange read_gate_change(const JsonValue& value, std::string_view source);
// The change as JSON, as read_gate_change() reads it.
JsonValue write_gate_change(const GateChange& change);

// The same as a state: what a checkpoint's "start_gates" says is open and
// on. "switches" that are off need not be listed, and are not written.
GateState read_gate_state(const JsonValue& value, std::string_view source);
// The state as JSON, as read_gate_state() reads it.
JsonValue write_gate_state(const GateState& state);


// Read a step, its args parsed against its action among `actions` (by
// default the built-in ones; a game passes them with its own) and their
// fallbacks filled in. Unknown fields, kinds, actions and args, mistyped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,47 @@ const WireCase CASES[] = {
const DeclaredPose start = ZoneDeclared{.place = "HotelZ", .spot = std::nullopt, .heading = std::nullopt};
return expect(checkpoint.start == start && checkpoint.steps.size() == 1 && checkpoint.steps[0].kind == StoryStepKind::MASH, "a zone start and one scene");
}}},
{.input = {.name = "step opens gates", .json = R"({"id":"unlock","kind":"talk","gates_after":{"opened":["SilphCo_5F/door_1"],"switches":{"mansion":true}}})"}, .expectation = {.check = [](const ReadRecord& record){
const StoryStep& step = step_of(record);
GateChange expected;
expected.opened.insert("SilphCo_5F/door_1");
expected.switches["mansion"] = true;
return expect(step.gates_after && *step.gates_after == expected, "door_1 opened and the mansion switch on");
}}},
{.input = {.name = "step with no gates", .json = R"({"id":"plain","kind":"talk"})"}, .expectation = {.check = [](const ReadRecord& record){
return expect(!step_of(record).gates_after, "no gate change");
}}},
{.input = {.name = "flags: given after a step, held at the start", .record = Record::CHECKPOINT, .json = R"({"id":"16.02","title":"Silph","start_flags":["has_pass"],"events":[{"id":"a","kind":"talk","flags_after":["card_key_held"]},{"id":"b","kind":"talk"}]})"}, .expectation = {.check = [](const ReadRecord& record){
const StoryCheckpoint& checkpoint = std::get<StoryCheckpoint>(record);
return expect(
checkpoint.start_flags == std::vector<std::string>{"has_pass"}
&& checkpoint.steps[0].flags_after == std::vector<std::string>{"card_key_held"}
&& checkpoint.steps[1].flags_after.empty(),
"start_flags and flags_after"
);
}}},
{.input = {.name = "gate change with an unknown field", .json = R"({"id":"x","kind":"talk","gates_after":{"closed":["a/b"]}})"}, .expectation = {.rejected = true}},
{.input = {.name = "checkpoint gate state", .record = Record::CHECKPOINT, .json = R"({"id":"16.02","title":"Silph","start_gates":{"opened":["SilphCo_5F/door_1"]},"events":[{"id":"a","kind":"talk","gates_after":{"opened":["SilphCo_5F/door_2"]}},{"id":"b","kind":"talk","gates_after":{"switches":{"mansion":true}}},{"id":"c","kind":"talk"}]})"}, .expectation = {.check = [](const ReadRecord& record){
const StoryCheckpoint& checkpoint = std::get<StoryCheckpoint>(record);
if (!checkpoint.start_gates || checkpoint.start_gates->opened.size() != 1){
return std::string("Expected start_gates with door_1 open.");
}
const GateState none = checkpoint_gates(checkpoint, 0);
const GateState first = checkpoint_gates(checkpoint, 1);
const GateState all = checkpoint_gates(checkpoint, 3);
if (!(none == *checkpoint.start_gates) || first.opened.size() != 2 || first.switch_on("mansion")){
return std::string("Expected the start, then door_2 as well after one step.");
}
if (!all.switch_on("mansion") || !(checkpoint_gates(checkpoint, 99) == all)){
return std::string("Expected the switch on after the steps, and past the end the same.");
}
const JsonValue written = write_gate_state(all);
return expect(read_gate_state(written, "round trip") == all, "the gate state to read back as written");
}}},
{.input = {.name = "checkpoint without gates", .record = Record::CHECKPOINT, .json = R"({"id":"x","title":"X","events":[{"id":"a","kind":"talk"}]})"}, .expectation = {.check = [](const ReadRecord& record){
const StoryCheckpoint& checkpoint = std::get<StoryCheckpoint>(record);
return expect(!checkpoint.start_gates && checkpoint_gates(checkpoint, 1) == GateState(), "no start gates and nothing open");
}}},
{.input = {.name = "ordered checkpoint", .record = Record::CHECKPOINT, .json = R"({"id":"00.05","title":"Parcel","events":[ {"id":"first","kind":"talk"}, {"id":"second","kind":"scene"} ]})"}, .expectation = {.check = [](const ReadRecord& record){
const StoryCheckpoint& checkpoint = std::get<StoryCheckpoint>(record);
return expect(checkpoint.id == "00.05" && checkpoint.title == "Parcel" && !checkpoint.start && checkpoint.steps.size() == 2
Expand Down
11 changes: 11 additions & 0 deletions SerialPrograms/Source/Pokemon/AutoStory/Pokemon_StoryPose.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Story Pose

Check warning on line 1 in SerialPrograms/Source/Pokemon/AutoStory/Pokemon_StoryPose.h

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<header>: header_symbols=8 (advisory above 6, limit 8)
*
* From: https://github.com/PokemonAutomation/
*
Expand All @@ -17,6 +17,8 @@
#include <string_view>
#include <vector>
#include "Common/Cpp/MoveOnlyFunction.h"
#include "Pokemon/Navigation/Pokemon_GatedTypes.h"
#include "Pokemon/Navigation/Pokemon_GateState.h"
#include "Pokemon_StoryLog.h"

namespace PokemonAutomation{
Expand Down Expand Up @@ -70,8 +72,17 @@
struct RunState{
Pose pose;
std::set<std::string> flags;
// The gates open and the switches on (Pokemon_GateState.h): from the
// checkpoint's start_gates, then each step's gates_after as it is done.
GateState gates;
};

// The rules a plan over `state`'s gates follows: the flag "card_key_held"
// (set after the Card Key is picked up) lets it open card-key gates.
inline GateRules gate_rules_of(const RunState& state){
return GateRules{.card_key_held = state.flags.contains("card_key_held")};
}



} // namespace Pokemon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ Event story_event(const StoryStep& step, StoryStepExecutor& executor){
}));
}
event.act = [&executor, &step](RunState& state){
return executor.run(step, state);
Outcome outcome = executor.run(step, state);
// What a step that failed did to the game is not known to the run.
if (outcome.succeeded()){
if (step.gates_after){
apply_gate_change(state.gates, *step.gates_after);
}
state.flags.insert(step.flags_after.begin(), step.flags_after.end());
}
return outcome;
};
if (step.pose_after){
event.pose_learned = pose_of(*step.pose_after);
Expand All @@ -63,13 +71,24 @@ Event story_event(const StoryStep& step, StoryStepExecutor& executor){
namespace{

// The first event of a checkpoint that starts from a save: where the save
// leaves the player, for a run that reloaded it.
Event from_save_event(const Pose& start){
// leaves the player, and the gates and flags it has, for a run that
// reloaded it.
Event from_save_event(const StoryCheckpoint& data){
Event event;
event.name = "from_save";
event.why = "where the checkpoint's save leaves the player";
event.act = [](RunState&){ return outcome_ok(); };
event.pose_learned = start;
// A checkpoint that does not say what its save has leaves the run's
// gates as the steps before it made them.
event.act = [gates = data.start_gates, flags = data.start_flags](RunState& state){
if (gates){
state.gates = *gates;
}
state.flags.insert(flags.begin(), flags.end());
return outcome_ok();
};
if (data.start){
event.pose_learned = pose_of(*data.start);
}
return event;
}

Expand Down Expand Up @@ -99,8 +118,8 @@ Checkpoint build_story_checkpoint(const StoryCheckpoint& data, StoryStepExecutor
executor.begin_attempt(data);
Checkpoint checkpoint;
checkpoint.id = data.id;
if (data.start){
checkpoint.events.push_back(from_save_event(pose_of(*data.start)));
if (data.start || data.start_gates || !data.start_flags.empty()){
checkpoint.events.push_back(from_save_event(data));
}
for (const StoryStep& step : data.steps){
checkpoint.events.push_back(story_event(step, executor));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Story Steps Tests

Check warning on line 1 in SerialPrograms/Source/Pokemon/AutoStory/Pokemon_StoryStepExecutor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=887 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -50,6 +50,9 @@
std::map<std::string, size_t> failures_left;
// The pose each step started from, by name.
std::vector<std::pair<std::string, std::string>> poses_seen;
// The gates and the run flags each step started with, by name.
std::vector<std::pair<std::string, GateState>> gates_seen;
std::vector<std::pair<std::string, std::set<std::string>>> flags_seen;
// The checkpoints begun, one per attempt.
std::vector<std::string> attempts;
// Game steps by name that change nothing in the game.
Expand All @@ -61,6 +64,8 @@

virtual Outcome run(const StoryStep& step, RunState& state) override{
poses_seen.emplace_back(step.name, to_string(state.pose));
gates_seen.emplace_back(step.name, state.gates);
flags_seen.emplace_back(step.name, state.flags);
trace.push_back(std::format("{} {}", story_step_kind_name(step.kind), step.name));
if (failing.contains(step.name)){
return outcome_failed("blocked", std::format("{} was blocked", step.name));
Expand Down Expand Up @@ -294,6 +299,51 @@
return true;
}

// A checkpoint whose save has Silph's first door open: a step opens the
// second and gives the Card Key, a failing step changes nothing.
StoryCheckpoint silph_checkpoint(){
StoryStep key = make(StoryStepKind::TALK, "card_key");
key.gates_after = GateChange{.opened = {"SilphCo_5F/door_2"}};
key.flags_after = {"card_key_held"};
StoryStep blocked = make(StoryStepKind::TALK, "blocked");
blocked.gates_after = GateChange{.opened = {"SilphCo_5F/door_3"}};
blocked.flags_after = {"never"};
GateState start;
start.opened.insert("SilphCo_5F/door_1");
return StoryCheckpoint{
.id = "16.02",
.title = "Silph",
.steps = {make(StoryStepKind::TALK, "before"), key, make(StoryStepKind::TALK, "after"), blocked},
.start_gates = start,
.start_flags = {"has_pass"},
};
}

UnitTestResult test_gate_state_carried(){
const StoryCheckpoint data = silph_checkpoint();
FakeExecutor executor;
executor.failing = {"blocked"};
const Run result = run(data, executor);
if (executor.gates_seen.size() != 4){
return std::format("Expected four steps run, got {}:{}", executor.gates_seen.size(), joined(executor.trace));
}
const GateState& before = executor.gates_seen[0].second;
const GateState& after = executor.gates_seen[2].second;
if (before.opened != std::set<std::string>{"SilphCo_5F/door_1"} || !executor.flags_seen[0].second.contains("has_pass")){
return "Expected the save's own gates and flags at the first step.";
}
if (executor.flags_seen[1].second.contains("card_key_held")){
return "The Card Key was held before its step was done.";
}
if (after.opened != std::set<std::string>{"SilphCo_5F/door_1", "SilphCo_5F/door_2"} || !executor.flags_seen[2].second.contains("card_key_held")){
return "Expected door_2 open and the Card Key held after the step that gave it.";
}
if (result.state.gates.opened.contains("SilphCo_5F/door_3") || result.state.flags.contains("never")){
return "A step that failed changed the gates or the flags.";
}
return true;
}

UnitTestResult test_failure_names_the_step(){
const StoryCheckpoint data = lab_checkpoint();
FakeExecutor executor;
Expand Down Expand Up @@ -772,6 +822,10 @@
.input = {.name = "a failure names its step", .test = test_failure_names_the_step},
.expectation = {.description = "records failing step identifier on error"},
},
{
.input = {.name = "gate state and run flags carried from the save through the steps", .test = test_gate_state_carried},
.expectation = {.description = "applies start_gates, start_flags, gates_after and flags_after in order"},
},
{
.input = {.name = "unsupported kinds and lost battles", .test = test_unsupported_and_lost_battles},
.expectation = {.description = "flags unsupported step types and handles battle defeat"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <optional>
#include <string>
#include <vector>
#include "Pokemon/Navigation/Pokemon_GateState.h"
#include "Pokemon_DeclaredPose.h"
#include "Pokemon_StoryCheckpointMetadata.h"
#include "Pokemon_StoryPostconditions.h"
Expand All @@ -39,8 +40,23 @@ struct StoryCheckpoint{
// Its phase and verification (JSON "metadata"), which decide when a
// run of it may save.
StoryCheckpointMetadata metadata = {};
// Which gates are open and which switches are on at the start, where the
// save has any of the story's gates (Silph Co., Pokemon Mansion); none
// where the checkpoint does not say, which the run infers from the
// story so far, or else observes. JSON: "start_gates".
std::optional<GateState> start_gates = {};
// The run flags that hold at the start, as flags_after would have set
// them in the story so far, which a reload loses ("card_key_held" in a
// save made after the Card Key). JSON: "start_flags".
std::vector<std::string> start_flags = {};
};

// The gate state of `checkpoint` once its first `steps_done` steps are done:
// its start_gates (nothing open, no switch on if it has none) with the
// steps' gates_after applied in order. `steps_done` past the last step is
// the end.
GateState checkpoint_gates(const StoryCheckpoint& checkpoint, size_t steps_done);



} // namespace Pokemon
Expand Down
Loading
Loading