From d308ab251177bd65252349cd4284fc6c4bc6a8b7 Mon Sep 17 00:00:00 2001 From: dayfine Date: Wed, 11 Nov 2026 20:56:34 -0800 Subject: [PATCH 1/6] PokemonFRLG: S15, Route 7's gate with the TEA to Saffron's Center (15.01) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Menus/PokemonFRLG_SaveCardReader.cpp | 1 + .../Overworld/PokemonFRLG_OverworldMaps.cpp | 3 + .../PokemonFRLG/PokemonFRLG_Tests.cpp | 1 + .../AutoStory/PokemonFRLG_AutoStoryEvents.cpp | 1 + .../PokemonFRLG_AutoStoryRows_Tests.h | 12 ++ .../PokemonFRLG_AutoStoryRunPlan_Tests.cpp | 8 +- .../PokemonFRLG_AutoStorySaffron_Tests.cpp | 129 ++++++++++++++++++ .../PokemonFRLG_AutoStorySimulation_Tests.cpp | 7 +- .../AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 12 +- .../AutoStory/StoryData/frlg-15.01.plan.json | 73 ++++++++++ SerialPrograms/cmake/SourceFiles.cmake | 1 + 11 files changed, 239 insertions(+), 9 deletions(-) create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-15.01.plan.json diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp index 3933913e12..3aa3faff8c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp @@ -80,6 +80,7 @@ class PlaceNameMatcher : public OCR::SmallDictionaryMatcher{ {"vermilion-city", "Vermilion City"}, {"celadon-city", "Celadon City"}, {"rocket-hideout", "Rocket Hideout"}, + {"saffron-city", "Saffron City"}, }){ JsonArray names; names.push_back(std::string(name)); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp index f6d168d32a..eb69e66450 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp @@ -99,6 +99,9 @@ constexpr std::string_view MAP_NAMES[] = { "RocketHideout_B2F", "RocketHideout_B3F", "RocketHideout_B4F", + // Route 7's east gate, where the guard takes the TEA, and Saffron City. + "Route7_EastEntrance", + "SaffronCity", "CeruleanCave_1F", "CeruleanCave_2F", "CeruleanCave_B1F", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp index a3511b6d22..1be4113fa8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp @@ -326,6 +326,7 @@ static void add_tests_AutoStoryRows(UnitTestDatabase& database){ add_tests_AutoStoryVermilion(database); add_tests_AutoStoryVermilionGym(database); add_tests_AutoStoryCeladon(database); + add_tests_AutoStorySaffron(database); } void add_tests(UnitTestDatabase& database){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp index fff6d558f3..595b3a3e5e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp @@ -357,6 +357,7 @@ std::string save_card_place(const std::string& map){ {"LavenderTown", "lavender-town"}, {"CeladonCity", "celadon-city"}, {"RocketHideout", "rocket-hideout"}, + {"SaffronCity", "saffron-city"}, }; for (const auto& [prefix, place] : PLACES){ if (map == prefix || map.rfind(prefix + "_", 0) == 0){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h index 6b15acaab2..0880b8348e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h @@ -10,6 +10,7 @@ #ifndef PokemonAutomation_PokemonFRLG_AutoStoryRows_Tests_H #define PokemonAutomation_PokemonFRLG_AutoStoryRows_Tests_H +#include #include "Common/Cpp/TestRunners/UnitTestDatabase.h" namespace PokemonAutomation{ @@ -26,6 +27,17 @@ void add_tests_AutoStoryVermilionGym(UnitTestDatabase& database); void add_tests_AutoStoryCeladon(UnitTestDatabase& database); // Rows from 08.01 on on the overworld sim (PokemonFRLG_AutoStoryLavender_Tests.cpp). void add_tests_AutoStoryLavender(UnitTestDatabase& database); +// Row 15.01, Route 7's gate to Saffron, on the overworld sim (PokemonFRLG_AutoStorySaffron_Tests.cpp). +void add_tests_AutoStorySaffron(UnitTestDatabase& database); + +// Whether checkpoint `id` was authored before the rows that lead up to it: +// it starts from its own declared pose, not where the row before it in +// the table ends. 15.01 starts at Celadon's nurse, after Erika +// (14.04); segments 10 to 14 are authored separately. An id leaves +// this list once the rows before it are in. +inline bool starts_after_unauthored_rows(std::string_view id){ + return id == "15.01"; +} } // namespace PokemonFRLG diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp index 1bfb846f94..35279b4c24 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp @@ -139,7 +139,7 @@ class Test_RunPlan : public UnitTest{ const RunPlanScenario m_scenario; }; -const std::string TODAY = "01.01 01.03 01.04 01.05 02.01 02.02 02.03 03.01 03.02 03.03 04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02"; +const std::string TODAY = "01.01 01.03 01.04 01.05 02.01 02.02 02.03 03.01 03.02 03.03 04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 15.01"; const RunPlanScenario RUN_PLAN_CASES[] = { { @@ -230,11 +230,11 @@ const RunPlanScenario RUN_PLAN_CASES[] = { }, { .input = {.name = "Gift RNG off: 04.03 is passed over", .first = "04.01"}, - .expectation = {.expected_ids = "04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02"}, + .expectation = {.expected_ids = "04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 15.01"}, }, { .input = {.name = "Gift RNG off: 04.03 runs when started at", .first = "04.03"}, - .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02"}, + .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 15.01"}, }, { .input = { .name = "Gift RNG: started at 04.03, from the save beside the salesman", @@ -259,7 +259,7 @@ const RunPlanScenario RUN_PLAN_CASES[] = { }, { .input = {.name = "Starter RNG alone: 04.03 runs when started at", .first = "04.03", .handoffs = {.starter_rng = true}}, - .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02"}, + .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 15.01"}, }, { .input = { .name = "Starter RNG first, with both on", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp new file mode 100644 index 0000000000..9e8747e267 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp @@ -0,0 +1,129 @@ +/* AutoStory Saffron Tests + * + * From: https://github.com/PokemonAutomation/ + * + * Row 15.01 (StoryData/frlg-15.01.plan.json) on the overworld sim: from + * Celadon's nurse along Route 7 into its east gate, onto the guard's + * trigger, and through Saffron City to its nurse. + * + */ + +#include +#include +#include +#include +#include +#include +#include "Common/Cpp/Exceptions.h" +#include "Common/Cpp/TestRunners/UnitTest.h" +#include "Pokemon/AutoStory/Pokemon_BuiltinStoryActions.h" +#include "Pokemon/AutoStory/Pokemon_StoryStepExecutor.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" +#include "PokemonFRLG_AutoStoryEvents.h" +#include "PokemonFRLG_AutoStoryRooms.h" +#include "PokemonFRLG_AutoStoryRowSim.h" +#include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryTable.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +namespace{ + +struct AutoStorySaffronInput{ + std::string name; + std::function body; +}; + +struct AutoStorySaffronExpectation{ + std::string_view description; +}; + +struct AutoStorySaffronCase{ + AutoStorySaffronInput input; + AutoStorySaffronExpectation expectation; +}; + +class Test_AutoStorySaffron : public UnitTest{ +public: + explicit Test_AutoStorySaffron(AutoStorySaffronCase test_case) + : UnitTest(std::format("PokemonFRLG::AutoStory - Simulation: {}", test_case.input.name)) + , m_case(std::move(test_case)) + {} + virtual UnitTestResult run(Logger&, CancellableScope&) const override{ + try{ + return m_case.input.body(); + }catch (Exception& e){ + return std::format("{}: {}", e.name(), e.message()); + } + } + +private: + AutoStorySaffronCase m_case; +}; + +const StoryCheckpoint& checkpoint(std::string_view id){ + for (const StoryCheckpoint& row : story_checkpoints()){ + if (row.id == id){ + return row; + } + } + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format("No checkpoint {}.", id)); +} + +// 15.01 on the sim from Celadon's nurse: Route 7, the gate's top trigger +// (6, 4), where the TEA scene leaves the player, and Saffron City to below +// its Center's door; the way into the Center, which has no map, is the +// console's. No trainer is met. +UnitTestResult test_route7_to_saffron(){ + const StoryCheckpoint& row = checkpoint("15.01"); + StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); + OverworldSim sim(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + const MapPosition trigger{"Route7_EastEntrance", {6, 4}}; + bool on_trigger = false; + for (const StoryStep& step : row.steps){ + if (step.action == CENTER_ENTER_VARIANT){ + break; + } + if (const std::string failure = row_step_on_sim(sim, at, step, row.id); !failure.empty()){ + return std::format("15.01: ended on {}; {}", to_string(sim.state().position), failure); + } + on_trigger = on_trigger || sim.state().position == trigger; + } + if (!on_trigger){ + return std::format("15.01: never stood on the guard's trigger {}.", to_string(trigger)); + } + const MapPosition below_center{"SaffronCity", {24, 39}}; + if (!(sim.state().position == below_center)){ + return std::format("15.01: ended on {}, not below Saffron's Center door {}.", to_string(sim.state().position), to_string(below_center)); + } + if (!sim.state().trainers_beaten.empty() || !sim.state().violations.empty()){ + return "15.01: met a trainer or broke a rule on the way."; + } + return true; +} + +const AutoStorySaffronCase AUTO_STORY_SAFFRON_CASES[] = { + { + .input = {.name = "15.01 Route 7's gate with the TEA to Saffron's Center", .body = test_route7_to_saffron}, + .expectation = {.description = "onto the guard's trigger, below Saffron's Center door, nobody met"}, + }, +}; + +} // namespace + + +void add_tests_AutoStorySaffron(UnitTestDatabase& database){ + for (const auto& item : AUTO_STORY_SAFFRON_CASES){ + database.add(item); + } +} + + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp index 6a3d5e0278..dc4c899f6c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp @@ -36,6 +36,7 @@ #include "PokemonFRLG_AutoStoryEvents.h" #include "PokemonFRLG_AutoStoryPaceSim.h" #include "PokemonFRLG_AutoStoryRowSim.h" +#include "PokemonFRLG_AutoStoryRows_Tests.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" @@ -224,9 +225,13 @@ UnitTestResult test_whole_story(){ if (sim.begun() != ids || sim.saves.size() != ids.size()){ return "Expected each checkpoint once, in order, each saving at its end:" + joined(sim.game.trace); } - // Each checkpoint starts where the save before it stands. + // Each checkpoint starts where the save before it stands, but one + // authored before the rows that lead up to it. for (size_t c = 1; c < sim.rows.size(); c++){ const StoryCheckpoint& data = sim.rows[c]; + if (starts_after_unauthored_rows(data.id)){ + continue; + } const std::optional start = story_pose(*start_pose(data)); const std::optional saved = story_pose(sim.saves[c - 1].second); const bool same = start && saved && start->map == saved->map && start->tile == saved->tile diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp index 0a5f768539..dfd06ea2cb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -32,6 +32,7 @@ #include "PokemonFRLG_AutoStoryGrind.h" #include "PokemonFRLG_AutoStoryPcStorage.h" #include "PokemonFRLG_AutoStoryPlanGolden.h" +#include "PokemonFRLG_AutoStoryRows_Tests.h" #include "PokemonFRLG_AutoStoryMoveData.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" @@ -275,16 +276,19 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po } // Plans every route of the story, each checkpoint from where the one -// before leaves the player, and adds the plans to `golden`. +// before leaves the player (or, past rows not authored yet, from its own +// start: starts_after_unauthored_rows()), and adds the plans to `golden`. UnitTestResult chain_story_routes(std::vector& golden){ const std::vector& checkpoints = story_checkpoints(); - if (checkpoints.size() != 39 || checkpoints[0].start){ - return "Expected 39 checkpoints, the first from a new game."; + if (checkpoints.size() != 40 || checkpoints[0].start){ + return "Expected 40 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){ const StoryCheckpoint& checkpoint = checkpoints[c]; - if (c > 0){ + if (c > 0 && starts_after_unauthored_rows(checkpoint.id)){ + pose = one_tile(Pokemon::grid_pose_of(*checkpoint.start)); + }else if (c > 0){ const StoryPose start = one_tile(Pokemon::grid_pose_of(*checkpoint.start)); const bool same_facing = !start.facing || start.facing == pose.facing; if (start.map != pose.map || !(start.tile == pose.tile) || !same_facing){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-15.01.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-15.01.plan.json new file mode 100644 index 0000000000..2ead5faa0f --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-15.01.plan.json @@ -0,0 +1,73 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "15.01", + "title": "Celadon to Saffron: the TEA to Route 7's gate guard, heal at Saffron's Center", + "start": {"map": "CeladonCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"}, + "events": [ + { + "id": "west_of_tea_guard", + "kind": "route", + "action": "run", + "args": { + "target": {"map": "Route7_EastEntrance", "tiles": [[5, 4]], "facing": "east"} + }, + "why": "out of Celadon's Center (its ground floor coded), east through the city and along Route 7 into its east gate (pokeguy bikes, 1:27:07 to 1:27:30), to (5, 4), a tile west of the guard's top trigger (6, 4)" + }, + { + "id": "tea_trigger", + "kind": "step", + "args": { + "direction": "east" + }, + "declared_after": {"map": "Route7_EastEntrance", "tiles": [[6, 4]], "facing": "east"}, + "why": "onto the guard's top trigger (6, 4) (Route7_EastEntrance_EventScript_GuardTriggerTop): the player turns to the guard (6, 2) and stays on the tile (Route7_EastEntrance_Movement_WalkToGuardTop is a walk in place)" + }, + { + "id": "guard_takes_tea", + "kind": "scene", + "declared_after": {"map": "Route7_EastEntrance", "tiles": [[6, 4]], "facing": "north"}, + "why": "the guard takes the TEA (FLAG_GOT_TEA, Route7_EastEntrance_EventScript_GiveTea), shares it and lets the player through: VAR_MAP_SCENE_ROUTE5_ROUTE6_ROUTE7_ROUTE8_GATES 1 shuts every gate's triggers (pokeguy 1:27:30 to 1:27:43)" + }, + { + "id": "below_center_door", + "kind": "route", + "action": "run", + "args": { + "target": {"map": "SaffronCity", "tiles": [[24, 39]], "facing": "north"} + }, + "why": "east out of the gate into Saffron City (8, 27), and through the city, round the Rocket Grunts who stand and walk there until Silph Co. (FLAG_HIDE_SAFFRON_ROCKETS), to below the Center's door (24, 38)" + }, + { + "id": "saffron_nurse", + "kind": "game_action", + "action": "center_enter", + "declared_after": {"map": "SaffronCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"}, + "why": "the Center script in: through the door and up to the nurse; no map of the Center. It also makes Saffron a Fly point" + }, + { + "id": "heal_saffron", + "kind": "heal", + "why": "full HP and PP before the Fighting Dojo's five Black Belts" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts at Celadon's nurse, facing her, where 14.04 (#407) ends; until 14.04 is in this table, this row's start is its own (starts_after_unauthored_rows()).", + "The TEA comes from Celadon Mansion 1F's tea woman, which segment 10 or 11.01 is to cover (outline: pokeguy has it from 1:11). Without it the guard says he's thirsty and walks the player back west (Route7_EastEntrance_Movement_BlockPlayerEntry), and the route after this fails.", + "PokeGuy goes straight to Silph Co. (1:27:44); the Fighting Dojo's Hitmonchan is a user-approved deviation for a Gift RNG. This row ends at Saffron's nurse, where the Dojo checkpoints start.", + "Not authored yet, blocked: the Dojo itself (15.02: the Black Belts and KOICHI to the Poke Balls, saved facing HITMONCHAN's; 15.03: after Gift RNG, leave_gift_summary, deposit, save). SaffronCity_Dojo isn't in the pinned map pack (PokemonSimulation bdca47c), and Gift RNG knows only the Magikarp salesman." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": {"map": "SaffronCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"} + } + } +} diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 6be5941899..93d9890281 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2048,6 +2048,7 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCaptureTurns.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCapture_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCeladon_Tests.cpp + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryChoice.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryChoice.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryChoice_Tests.cpp From 48bf4a6630fcb75303df7277405be22a2b68ae8e Mon Sep 17 00:00:00 2001 From: dayfine Date: Wed, 11 Nov 2026 20:57:57 -0800 Subject: [PATCH 2/6] PokemonFRLG: S15 route golden --- .../AutoStory/PokemonFRLG_AutoStoryPlanGolden.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h index 4cd5d9abe1..74bdfbe0d0 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h @@ -849,6 +849,21 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "09.02 face north -> RocketHideout_B4F (19, 5)", "09.02 face_silph_scope from RocketHideout_B4F (19, 5) facing south to RocketHideout_B4F (19, 5) facing east", "09.02 face east -> RocketHideout_B4F (19, 5)", + "15.01 west_of_tea_guard from CeladonCity_PokemonCenter_1F (7, 4) facing north to Route7_EastEntrance (5, 4) facing east", + "15.01 walk south 5 (warp) -> CeladonCity (48, 12) [walk only]", + "15.01 walk east 19 -> Route7 (7, 2) [connection 12]", + "15.01 walk south 8 -> Route7 (7, 10)", + "15.01 walk east 9 (warp) -> Route7_EastEntrance (1, 5)", + "15.01 walk east 4 -> Route7_EastEntrance (5, 5)", + "15.01 walk north 1 (to wall) -> Route7_EastEntrance (5, 4)", + "15.01 face east -> Route7_EastEntrance (5, 4)", + "15.01 below_center_door from Route7_EastEntrance (6, 4) facing north to SaffronCity (24, 39) facing north", + "15.01 walk south 1 -> Route7_EastEntrance (6, 5)", + "15.01 walk east 6 (warp) -> SaffronCity (8, 27)", + "15.01 walk east 9 -> SaffronCity (17, 27)", + "15.01 walk south 12 -> SaffronCity (17, 39)", + "15.01 walk east 7 -> SaffronCity (24, 39)", + "15.01 face north -> SaffronCity (24, 39)", }; } // namespace PokemonFRLG From f2677eb5d9cf8c3e8a7e6e9f3536de92c004a6de Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 14:19:17 -0800 Subject: [PATCH 3/6] FRLG walk: bike taps read the facing and remount for the player (merge fix) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp index 388d21ffbb..47639d1887 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp @@ -133,7 +133,7 @@ BikeTap console_bike_tap( // An open leg on the Bicycle, a tap at a time (count_bike_taps()). StepWalk walk_bike_taps( ConsoleHandle& console, ProControllerContext& context, - const RouteStep& step, const OverworldInterruptSet& interrupts + const RouteStep& step, const OverworldInterruptSet& interrupts, PlayerGender player ){ StepWalk out{std::nullopt, current_time(), false, false}; const OverworldInterrupts& watched = step.wild ? interrupts.wild : interrupts.other; @@ -143,11 +143,11 @@ StepWalk walk_bike_taps( calls.log = [&](const std::string& message){ console.log(message, COLOR_ORANGE); }; // On foot if the player's standing sprite reads. const auto remount = [&]{ - if (!read_facing(console, context)){ + if (!read_facing(console, context, player)){ return false; } console.log("Bike: a tap didn't move and the player is on foot.", COLOR_ORANGE); - get_on_bike(console, context); + get_on_bike(console, context, player); return true; }; const StepOutcome outcome = count_bike_taps_remounting(step, calls, remount); @@ -317,7 +317,7 @@ StepOutcome walk_and_watch( if (counts_step_taps(step)){ walked = walk_step_taps(console, context, step, interrupts, player); }else if (counts_bike_taps(step, speed)){ - walked = walk_bike_taps(console, context, step, interrupts); + walked = walk_bike_taps(console, context, step, interrupts, player); }else{ walked = walk_step(console, context, step, facing, interrupts, speed, player); } From d35d45a54deddd01317d98fb9cdd874489b47cbc Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 14:27:14 -0800 Subject: [PATCH 4/6] FRLG 15.01: Saffron tests and the unauthored-starts list get their own headers (header symbol limit) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG/PokemonFRLG_Tests.cpp | 1 + .../PokemonFRLG_AutoStoryRows15_Tests.h | 27 ++++++++++++++++ .../PokemonFRLG_AutoStoryRows_Tests.h | 13 -------- .../PokemonFRLG_AutoStorySaffron_Tests.cpp | 1 + .../PokemonFRLG_AutoStorySimulation_Tests.cpp | 1 + ...emonFRLG_AutoStoryUnauthoredStarts_Tests.h | 32 +++++++++++++++++++ .../AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 1 + SerialPrograms/cmake/SourceFiles.cmake | 2 ++ 8 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp index 82934a908b..fcce137844 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp @@ -55,6 +55,7 @@ #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryHealing.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows12_Tests.h" +#include "Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryTable.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryTrashCans.h" #include "Programs/AutoStory/Data/Json_Tests.h" diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h new file mode 100644 index 0000000000..6973e0bfd7 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h @@ -0,0 +1,27 @@ +/* AutoStory Row Tests, Segment 15 + * + * From: https://github.com/PokemonAutomation/ + * + * Registration of the tests that run segment 15's rows on the overworld + * sim, beside PokemonFRLG_AutoStoryRows_Tests.h's earlier stretches. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryRows15_Tests_H +#define PokemonAutomation_PokemonFRLG_AutoStoryRows15_Tests_H + +#include "Common/Cpp/TestRunners/UnitTestDatabase.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// Row 15.01, Route 7's gate to Saffron, on the overworld sim (PokemonFRLG_AutoStorySaffron_Tests.cpp). +void add_tests_AutoStorySaffron(UnitTestDatabase& database); + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h index df7b284065..0e6d8c7c83 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h @@ -35,19 +35,6 @@ void add_tests_AutoStorySnorlax(UnitTestDatabase& database); void add_tests_AutoStorySlope(UnitTestDatabase& database); // Row 11.03 on the sims (PokemonFRLG_AutoStorySafari_Tests.cpp). void add_tests_AutoStorySafari(UnitTestDatabase& database); -// Row 15.01, Route 7's gate to Saffron, on the overworld sim (PokemonFRLG_AutoStorySaffron_Tests.cpp). -void add_tests_AutoStorySaffron(UnitTestDatabase& database); - - -// Whether checkpoint `id` was authored before the rows that lead up to it: -// it starts from its own declared pose, not where the row before it in -// the table ends. 15.01 starts at Celadon's nurse, after Erika -// (14.04); 12.02 ends at Fuchsia, and the rows between are authored separately. An id leaves -// this list once the rows before it are in. -inline bool starts_after_unauthored_rows(std::string_view id){ - return id == "15.01"; -} - } // namespace PokemonFRLG } // namespace NintendoSwitch diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp index 9e8747e267..f390852c98 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp @@ -24,6 +24,7 @@ #include "PokemonFRLG_AutoStoryRooms.h" #include "PokemonFRLG_AutoStoryRowSim.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryRows15_Tests.h" #include "PokemonFRLG_AutoStoryTable.h" namespace PokemonAutomation{ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp index 8d2a861040..2a501280ec 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp @@ -38,6 +38,7 @@ #include "PokemonFRLG_AutoStoryRngLoop.h" #include "PokemonFRLG_AutoStoryRowSim.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h new file mode 100644 index 0000000000..2e84ab72ed --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h @@ -0,0 +1,32 @@ +/* AutoStory Unauthored Starts + * + * From: https://github.com/PokemonAutomation/ + * + * Which checkpoints start from their own declared pose in the tests. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryUnauthoredStarts_Tests_H +#define PokemonAutomation_PokemonFRLG_AutoStoryUnauthoredStarts_Tests_H + +#include + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// Whether checkpoint `id` was authored before the rows that lead up to it: +// it starts from its own declared pose, not where the row before it in +// the table ends. 15.01 starts at Celadon's nurse, after Erika +// (14.04); 12.02 ends at Fuchsia, and the rows between are authored separately. An id leaves +// this list once the rows before it are in. +inline bool starts_after_unauthored_rows(std::string_view id){ + return id == "15.01"; +} + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp index a2af5b00a9..bd2030ddca 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -40,6 +40,7 @@ #include "PokemonFRLG_AutoStoryPlanGolden12.h" #include "PokemonFRLG_AutoStoryPlanGolden15.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h" #include "PokemonFRLG_AutoStoryMoveData.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 7b4134e015..24eefe4bf6 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2162,6 +2162,8 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows12_Tests.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSimStubs.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRngReturns.h From 041dfed4c0bb0bb77bae3b3118e69d8b15503da3 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 15:00:40 -0800 Subject: [PATCH 5/6] PokemonFRLG: STORY_ORDER lists 15.01 after 14.04 Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp index 9646454763..316f52c464 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp @@ -232,7 +232,7 @@ constexpr std::string_view STORY_ORDER[] = { "05.03", "05.04", "05.05", "05.06", "05.07", "05.08", "05.09", "05.10", "06.01", "06.02", "06.03", "06.04", "07.01", "07.02", "08.01", "08.02", "08.03", "09.01", "09.02", "09.03", "09.04", "10.01", "10.02", "10.03", "10.04", "10.05", "10.06", "11.01", "11.02", "11.03", - "12.01", "12.02", "12.03", "14.03", "14.04", + "12.01", "12.02", "12.03", "14.03", "14.04", "15.01", }; // `checkpoints` in STORY_ORDER's order. Throws ParseException for a From cb88b2a346680a290043b7f782369585b2e563fb Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 20:47:17 -0800 Subject: [PATCH 6/6] FRLG AutoStory: the chain test expects 58 checkpoints (the split's merge counted one twice) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp index 8fc4caf313..419dac9734 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -286,8 +286,8 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po // before leaves the player, and adds the plans to `golden`. UnitTestResult chain_story_routes(std::vector& golden){ const std::vector& checkpoints = story_checkpoints(); - if (checkpoints.size() != 57 || checkpoints[0].start){ - return "Expected 57 checkpoints, the first from a new game."; + if (checkpoints.size() != 58 || checkpoints[0].start){ + return "Expected 58 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){