From 003d11b3b79fddfe5cd021c2c35e7b75bb0053c2 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 16:02:05 -0800 Subject: [PATCH 1/6] FRLG AutoStory: segment 17 WIP (17.01-17.04 plans, spin glyph tiles, tests) --- .../Overworld/PokemonFRLG_OverworldMap.cpp | 18 +- .../Overworld/PokemonFRLG_OverworldMaps.cpp | 5 + .../Overworld/PokemonFRLG_OverworldSpin.h | 7 +- .../PokemonFRLG/PokemonFRLG_Tests.cpp | 2 + .../PokemonFRLG_AutoStoryRows17_Tests.h | 27 +++ .../AutoStory/PokemonFRLG_AutoStoryTable.cpp | 3 +- .../PokemonFRLG_AutoStoryViridian_Tests.cpp | 126 ++++++++++++ .../AutoStory/StoryData/frlg-17.01.plan.json | 82 ++++++++ .../AutoStory/StoryData/frlg-17.02.plan.json | 180 ++++++++++++++++++ .../AutoStory/StoryData/frlg-17.03.plan.json | 112 +++++++++++ .../AutoStory/StoryData/frlg-17.04.plan.json | 140 ++++++++++++++ SerialPrograms/cmake/SourceFiles.cmake | 2 + 12 files changed, 698 insertions(+), 6 deletions(-) create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.01.plan.json create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMap.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMap.cpp index 8a623e2745..3ba0bda2d4 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMap.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMap.cpp @@ -271,10 +271,24 @@ std::optional spin_direction(const MapData& map, const TilePos& point return direction; } } - return std::nullopt; + // A map file's own glyphs (Viridian Gym). + switch (tile_at(map, point)){ + case TileKind::SPIN_NORTH: + return Direction::NORTH; + case TileKind::SPIN_SOUTH: + return Direction::SOUTH; + case TileKind::SPIN_WEST: + return Direction::WEST; + case TileKind::SPIN_EAST: + return Direction::EAST; + default: + return std::nullopt; + } } bool stops_spinning(const MapData& map, const TilePos& point){ - return coded_spin_stop(map.name, point) || in_region(map, SPIN_STOP_REGION, point); + return coded_spin_stop(map.name, point) + || in_region(map, SPIN_STOP_REGION, point) + || tile_at(map, point) == TileKind::STOP_SPIN; } std::optional spin_slide(const MapData& map, const PlayerState& state){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp index aebe2afd2a..a11581b7d2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp @@ -149,6 +149,11 @@ constexpr std::string_view MAP_NAMES[] = { // Cinnabar Island's Center and Blaine's gym, through its quiz doors. "CinnabarIsland", "CinnabarIsland_Gym", + // Pallet Town south over Route 21 to Cinnabar, and Viridian Gym with its + // spinner tiles (the map file's glyphs: PokemonFRLG_OverworldSpin.h). + "Route21_North", + "Route21_South", + "ViridianCity_Gym", // Silph Co.'s floors, 1F to 11F (the lift's map, SilphCo_Elevator, is // not built in). "SilphCo_1F", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSpin.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSpin.h index 6a4a5a9730..19fa7665b8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSpin.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSpin.h @@ -21,9 +21,10 @@ namespace PokemonFRLG{ // Spinner tiles (Rocket Hideout B2F and B3F, Viridian Gym): pokefirered's // MB_SPIN_UP, MB_SPIN_DOWN, MB_SPIN_LEFT, MB_SPIN_RIGHT and -// MB_STOP_SPINNING. The tile glyphs can't say so: the hideout's floors -// have them coded (coded_spin_direction(), PokemonFRLG_CodedRooms.h); -// another map may list them in these regions, as it does WILD_REGION. +// MB_STOP_SPINNING. The hideout's floors have them coded +// (coded_spin_direction(), PokemonFRLG_CodedRooms.h); Viridian Gym's map +// file writes them as glyphs ('u', 'd', 'l', 'r' and the stop 'o'); another +// map may list them in these regions, as it does WILD_REGION. // "spin_north": MB_SPIN_UP. // "spin_south": MB_SPIN_DOWN. // "spin_west": MB_SPIN_LEFT. diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp index 66947d9483..15b95fdbbf 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp @@ -59,6 +59,7 @@ #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows13_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows16_Tests.h" +#include "Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryTable.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryTrashCans.h" #include "Programs/AutoStory/Data/Json_Tests.h" @@ -343,6 +344,7 @@ static void add_tests_AutoStoryRows(UnitTestDatabase& database){ add_tests_AutoStoryCinnabarGym(database); add_tests_AutoStorySilph(database); add_tests_AutoStoryMansion(database); + add_tests_AutoStoryViridian(database); } void add_tests(UnitTestDatabase& database){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h new file mode 100644 index 0000000000..49529584c9 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h @@ -0,0 +1,27 @@ +/* AutoStory Row Tests, Segment 17 + * + * From: https://github.com/PokemonAutomation/ + * + * Registration of the tests that run segment 17's rows (Saffron to + * Cinnabar by Fly and Surf, and Viridian Gym) on the overworld sim. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryRows17_Tests_H +#define PokemonAutomation_PokemonFRLG_AutoStoryRows17_Tests_H + +#include "Common/Cpp/TestRunners/UnitTestDatabase.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// Rows 17.01 to 17.04 and Viridian Gym's spinner tiles, on the overworld sim (PokemonFRLG_AutoStoryViridian_Tests.cpp). +void add_tests_AutoStoryViridian(UnitTestDatabase& database); + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp index b58844d235..e33d605a62 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp @@ -232,7 +232,8 @@ 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", "15.01", "16.01", "13.01", "13.02", "13.03", "13.04", "14.01", "14.02", + "12.01", "12.02", "12.03", "14.03", "14.04", "15.01", "16.01", "17.01", "13.01", "13.02", "13.03", "13.04", "14.01", "14.02", + "17.02", "17.03", "17.04", }; // `checkpoints` in STORY_ORDER's order. Throws ParseException for a diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp new file mode 100644 index 0000000000..e000c38684 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp @@ -0,0 +1,126 @@ +/* AutoStory Viridian Tests + * + * From: https://github.com/PokemonAutomation/ + * + * Rows 17.01 to 17.04 (StoryData/frlg-17.0N.plan.json) on the overworld + * sim: Saffron's Center to Cinnabar's by Fly and Surf, and from Cinnabar's + * Center by Fly to Viridian City and through its Gym to Giovanni. + * + */ + +#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 "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSpin.h" +#include "PokemonFRLG_AutoStoryEvents.h" +#include "PokemonFRLG_AutoStoryRooms.h" +#include "PokemonFRLG_AutoStoryRowSim.h" +#include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryRows17_Tests.h" +#include "PokemonFRLG_AutoStoryTable.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +namespace{ + +struct AutoStoryViridianInput{ + std::string name; + std::function body; +}; + +struct AutoStoryViridianExpectation{ + std::string_view description; +}; + +struct AutoStoryViridianCase{ + AutoStoryViridianInput input; + AutoStoryViridianExpectation expectation; +}; + +class Test_AutoStoryViridian : public UnitTest{ +public: + explicit Test_AutoStoryViridian(AutoStoryViridianCase 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: + AutoStoryViridianCase 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)); +} + +// 17.01 on the sim from Saffron's nurse: out of the Center, the Fly to +// Pallet Town, the shore, the Surf onto Route 21 and the way south over it +// to Cinnabar's Center door. No trainer is met and no rule is broken. +UnitTestResult test_surf_to_cinnabar(){ + const StoryCheckpoint& row = checkpoint("17.01"); + StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); + OverworldSim sim(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + std::vector maps; + 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("17.01: ended on {}; {}", to_string(sim.state().position), failure); + } + maps.push_back(sim.state().position.map); + } + const MapPosition below_center{"CinnabarIsland", {14, 12}}; + if (!(sim.state().position == below_center)){ + return std::format("17.01: ended on {}, not below Cinnabar's Center door {}.", to_string(sim.state().position), to_string(below_center)); + } + if (!sim.state().trainers_beaten.empty() || !sim.state().violations.empty()){ + return "17.01: met a trainer or broke a rule on the way."; + } + return true; +} + +const AutoStoryViridianCase AUTO_STORY_VIRIDIAN_CASES[] = { + { + .input = {.name = "17.01 Saffron to Cinnabar by Fly and Surf", .body = test_surf_to_cinnabar}, + .expectation = {.description = "Pallet Town's shore, Route 21 surfed, below Cinnabar's Center door, nobody met"}, + }, +}; + +} // namespace + + +void add_tests_AutoStoryViridian(UnitTestDatabase& database){ + for (const auto& item : AUTO_STORY_VIRIDIAN_CASES){ + database.add(item); + } +} + + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.01.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.01.plan.json new file mode 100644 index 0000000000..77e0d27708 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.01.plan.json @@ -0,0 +1,82 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "17.01", + "title": "Saffron to Cinnabar: Fly to Pallet Town, Surf down Route 21, heal at Cinnabar's Center", + "start": {"map": "SaffronCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"}, + "events": [ + { + "id": "saffron_outside", + "kind": "route", + "action": "run", + "args": { + "target": {"map": "SaffronCity", "tiles": [[24, 39]], "facing": "south"} + }, + "why": "out of Saffron's Center onto the street below its door (24, 38): Fly works outdoors only" + }, + { + "id": "fly_pallet", + "kind": "game_action", + "action": "fly", + "args": {"town": "PalletTown", "species": "pidgey"}, + "declared_after": {"map": "PalletTown", "tiles": [[6, 8]], "facing": "south"}, + "why": "the Pidgey flies to Pallet Town, landing below the player's house door (6, 7) (pokeguy 1:18:59, from Fuchsia; here from Saffron)" + }, + { + "id": "pallet_shore", + "kind": "route", + "action": "run", + "args": { + "target": {"map": "PalletTown", "tiles": [[8, 16]], "facing": "south"} + }, + "why": "south through the town to the shore (7..10, 17..19), a tile above the water, facing it (pokeguy bikes to Pallet's water edge, 1:19:00)" + }, + { + "id": "surf_off_pallet", + "kind": "game_action", + "action": "surf", + "args": {"direction": "south"}, + "declared_after": {"map": "PalletTown", "tiles": [[8, 17]], "facing": "south"}, + "why": "the lead's Surf (taught in 12.01): A at the water, YES, onto (8, 17)" + }, + { + "id": "surf_route_21", + "kind": "route", + "action": "run", + "args": { + "target": {"map": "CinnabarIsland", "tiles": [[14, 12]], "facing": "north"} + }, + "why": "south over Route 21's water (Pallet Town, Route21_North, Route21_South) to Cinnabar's north shore, off the water onto land and down to below the Center's door (14, 11); round the swimmers' and tuber's lines (pokeguy avoids them, 1:19:00 to 1:19:23)" + }, + { + "id": "cinnabar_nurse", + "kind": "game_action", + "action": "center_enter", + "declared_after": {"map": "CinnabarIsland_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" + }, + { + "id": "heal_cinnabar", + "kind": "heal", + "why": "full HP and PP before the Mansion's trainers" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts at Saffron's nurse, facing her. Saffron's Silph Co. and Sabrina (rows after 16.01) are not authored, so this row's start is its own (starts_after_unauthored_rows()); it is where 16.01 begins, not where it ends. Ends at Cinnabar's nurse, facing her: 13.01's start (the Mansion).", + "Fly to Pallet Town, then Surf (HM03, taught to the lead in 12.01) down Route 21: pokeguy does the same from Fuchsia (1:18:59 to 1:19:23). No Seafoam Islands (user, 2026-11-12, design section 12). Route 21 is two maps (Route21_North, Route21_South) between Pallet Town and Cinnabar.", + "Route 21's water has wild encounters (Tentacool, Tentacruel) and its swimmers and tuber see one or four ways a tile or more: the planner keeps off their lines where the water allows. A trainer that does see the player is fought with the normal battle code, and the Center's nurse at the end heals." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": {"map": "CinnabarIsland_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"} + } + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json new file mode 100644 index 0000000000..f360e372ad --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json @@ -0,0 +1,180 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "17.02", + "title": "Cinnabar to Viridian Gym: Fly, Warren", + "start": { + "map": "CinnabarIsland_PokemonCenter_1F", + "tiles": [ + [ + 7, + 4 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "cinnabar_outside", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "CinnabarIsland", + "tiles": [ + [ + 14, + 12 + ] + ], + "facing": "south" + } + }, + "why": "out of Cinnabar's Center onto the street below its door: Fly works outdoors only" + }, + { + "id": "fly_viridian", + "kind": "game_action", + "action": "fly", + "args": { + "town": "ViridianCity", + "species": "pidgey" + }, + "declared_after": { + "map": "ViridianCity", + "tiles": [ + [ + 26, + 27 + ] + ], + "facing": "south" + }, + "why": "Fly to Viridian City (the badge-8 gym is the last before the Elite Four); lands below the Center's door (26, 26)" + }, + { + "id": "below_gym_door", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity", + "tiles": [ + [ + 36, + 11 + ] + ], + "facing": "north" + } + }, + "why": "east along the city to below the Gym's door (36, 10)" + }, + { + "id": "into_gym", + "kind": "step", + "args": { + "direction": "north" + }, + "declared_after": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 17, + 22 + ] + ], + "facing": "north" + }, + "why": "through the Gym's door (36, 10) onto the mat (17, 22) inside" + }, + { + "id": "below_warren_line", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 15, + 8 + ] + ], + "facing": "north" + } + }, + "why": "north and west through the gym's open floor (no arrow tile on this way) to (15, 8), below Warren's line (14..16, 7)" + }, + { + "id": "warren_line", + "kind": "step", + "action": "trainer_line", + "args": { + "direction": "north" + }, + "why": "onto (15, 7), the end of Warren's line (sight 3, facing east): he walks over" + }, + { + "id": "lead_lv47_for_giovanni", + "kind": "game_action", + "action": "level", + "args": { + "slot": 1, + "min": 47 + }, + "why": "the lead at least Lv47 before the gym's fights (Giovanni's Rhyhorn is Lv50); below it the run stops" + }, + { + "id": "warren", + "kind": "battle", + "args": { + "trainer": "TRAINER_COOLTRAINER_WARREN", + "foes": [ + "marowak", + "marowak", + "rhyhorn", + "nidorina", + "nidoqueen" + ] + }, + "declared_after": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 15, + 7 + ] + ], + "facing": "north" + }, + "why": "Warren (TRAINER_COOLTRAINER_WARREN): Marowak Lv37, Marowak Lv37, Rhyhorn Lv38, Nidorina Lv39, Nidoqueen Lv39" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts at Cinnabar's nurse, where 14.02 ends (Bill declined there; nothing later needs the One Island trip: its Sevii quest flags are optional, the Ruby/Sapphire stone and Network Machine are post-game).", + "Fly to Viridian City, then in through the Gym's door. The route keeps off the arrow tiles on purpose (design section 12 scripts them; the planned way never meets one), and ends on (15, 7) after Warren's battle." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 15, + 7 + ] + ], + "facing": "north" + } + } + } +} \ No newline at end of file diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json new file mode 100644 index 0000000000..25600f94d1 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json @@ -0,0 +1,112 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "17.03", + "title": "Viridian Gym: Takashi, to Giovanni", + "start": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 15, + 7 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "below_takashi_line", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 10, + 6 + ] + ], + "facing": "north" + } + }, + "why": "back up column 15, west along row 6 to (10, 6), below Takashi's line (10, 3..5)" + }, + { + "id": "takashi_line", + "kind": "step", + "action": "trainer_line", + "args": { + "direction": "north" + }, + "why": "onto (10, 5), the end of Takashi's line (sight 3, facing south)" + }, + { + "id": "takashi", + "kind": "battle", + "args": { + "trainer": "TRAINER_BLACK_BELT_TAKASHI", + "foes": [ + "machoke", + "machop", + "machoke", + "machoke" + ] + }, + "declared_after": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 10, + 5 + ] + ], + "facing": "north" + }, + "why": "Takashi (TRAINER_BLACK_BELT_TAKASHI): Machoke Lv38, Machop Lv38, Machoke Lv38, Machoke Lv43" + }, + { + "id": "below_giovanni", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 2, + 3 + ] + ], + "facing": "north" + } + }, + "why": "west along row 3 and down to (2, 3), facing Giovanni (2, 2)" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Ends at (2, 3) facing Giovanni (2, 2): the save in front of him, as for the other leaders." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 2, + 3 + ] + ], + "facing": "north" + } + } + } +} \ No newline at end of file diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json new file mode 100644 index 0000000000..de15be3715 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json @@ -0,0 +1,140 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "17.04", + "title": "Viridian Gym: Giovanni and the EARTHBADGE, heal at Viridian's Center", + "start": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 2, + 3 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "lead_lv50_for_giovanni", + "kind": "game_action", + "action": "level", + "args": { + "slot": 1, + "min": 50 + }, + "why": "the precondition for Giovanni (Rhyhorn Lv50): below it the run stops before the fight" + }, + { + "id": "challenge_giovanni", + "kind": "talk", + "why": "Giovanni (2, 2)" + }, + { + "id": "giovanni", + "kind": "battle", + "args": { + "trainer": "TRAINER_LEADER_GIOVANNI", + "foes": [ + "rhyhorn", + "dugtrio", + "nidoqueen", + "nidoking", + "rhydon" + ] + }, + "declared_after": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 2, + 3 + ] + ], + "facing": "north" + }, + "why": "Giovanni: Rhyhorn Lv45, Dugtrio Lv42, Nidoqueen Lv44, Nidoking Lv45, Rhydon Lv50; then the EARTHBADGE and TM26 Earthquake" + }, + { + "id": "gym_exit", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity", + "tiles": [ + [ + 36, + 11 + ] + ], + "facing": "south" + } + }, + "why": "back through the gym to the door and out onto Viridian City below it" + }, + { + "id": "below_center_door", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity", + "tiles": [ + [ + 26, + 27 + ] + ], + "facing": "north" + } + }, + "why": "west and down to below the Center's door (26, 26)" + }, + { + "id": "viridian_nurse", + "kind": "game_action", + "action": "center_enter", + "declared_after": { + "map": "ViridianCity_PokemonCenter_1F", + "tiles": [ + [ + 7, + 4 + ] + ], + "facing": "north" + }, + "why": "the Center script in, up to the nurse" + }, + { + "id": "heal_viridian", + "kind": "heal", + "why": "full HP and PP" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Ends at Viridian's nurse (declared: the gym exit is a street tile; the Center is where the next row starts)." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "ViridianCity_PokemonCenter_1F", + "tiles": [ + [ + 7, + 4 + ] + ], + "facing": "north" + } + } + } +} \ No newline at end of file diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index fad1c648b8..25bdb72344 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2065,7 +2065,9 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCinnabarGym_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySilph_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows16_Tests.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMansion_Tests.cpp + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows13_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryChoice.cpp From 9f3ad9c116bcd9f01b23f67c1a057e6d1301d77f Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 16:10:40 -0800 Subject: [PATCH 2/6] FRLG AutoStory: segment 17 WIP 2 --- .../Overworld/PokemonFRLG_OverworldMaps.cpp | 17 +++ .../PokemonFRLG_AutoStoryFaultSweep_Tests.cpp | 4 + .../PokemonFRLG_AutoStoryPlanGolden17.h | 104 ++++++++++++++++++ .../PokemonFRLG_AutoStoryRunPlan_Tests.cpp | 8 +- ...emonFRLG_AutoStoryUnauthoredStarts_Tests.h | 12 +- .../PokemonFRLG_AutoStoryViridian_Tests.cpp | 50 ++++++++- .../AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 11 +- .../AutoStory/StoryData/frlg-17.02.plan.json | 20 ++-- SerialPrograms/cmake/SourceFiles.cmake | 1 + 9 files changed, 202 insertions(+), 25 deletions(-) create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp index a11581b7d2..914232693b 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp @@ -198,11 +198,28 @@ void add_unmapped_centers(std::vector& maps){ } } +// Pallet Town's fat man wanders over (7..19, 15..19), which holds the whole +// shore (7..10, 16) the way onto Route 21's water goes by. A planned route +// never crosses a wanderer's box, so none would reach the water. He stands on +// his own tile (13, 17) in the planner's model: east of the shore, off the +// way; a person in the way on the console is waited out (17.01). +void waive_pallet_fat_man_box(MapData& map){ + if (map.name != "PalletTown"){ + return; + } + for (MapObject& object : map.objects){ + if (object.name == "fat_man"){ + object.wander.reset(); + } + } +} + const std::vector& all_maps(){ static const std::vector MAPS = []{ std::vector maps; for (std::string_view name : MAP_NAMES){ maps.push_back(load_map(std::string(name))); + waive_pallet_fat_man_box(maps.back()); } add_unmapped_centers(maps); return maps; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp index 38fd5d3fab..fdf3cabb19 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp @@ -130,6 +130,10 @@ const std::map KNOWN_FAILING{ "fly_celadon: a Fly that doesn't leave Lavender Town goes unseen, and east_of_snorlax walks from Lavender to Route 16 by Routes 8 and 7 instead: check the fly lands on its town's tile (FlyTown::landing) before the step ends"}, {"PokemonFRLG::AutoStory - Fault sweep: 12.03, warp no-op", "fly_celadon: a Fly that doesn't leave Fuchsia City goes unseen, and the row, which walks no further, ends on Celadon's declared tile: the same fix as 11.01's, the fly landing on its town's tile (FlyTown::landing) checked before the step ends"}, + {"PokemonFRLG::AutoStory - Fault sweep: 17.01, warp no-op", + "fly_pallet: a Fly that doesn't leave Saffron City goes unseen, and the row, which walks on from Saffron's streets to Pallet's shore, ends on Cinnabar's nurse tile: the same fix as 11.01's, the fly landing on its town's tile (FlyTown::landing) checked before the step ends"}, + {"PokemonFRLG::AutoStory - Fault sweep: 17.02, warp no-op", + "fly_viridian: a Fly that doesn't leave Cinnabar Island goes unseen, and the row, which walks on from Cinnabar's streets, ends on Viridian's Gym tile: the same fix as 11.01's, the fly landing on its town's tile (FlyTown::landing) checked before the step ends"}, {"PokemonFRLG::AutoStory - Fault sweep: 08.03, off the Bicycle at a bike leg", "riding with no fault, route7_underground_exit's warp to UndergroundPath_EastEntrance is not confirmed on the sim (the screen after the fade reads as before the hold): the sim's warp off the Bicycle, before this class can sweep 08.03"}, }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h new file mode 100644 index 0000000000..2eca1bec8a --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h @@ -0,0 +1,104 @@ +/* FRLG AutoStory Plan Golden, Segment 17 + * + * From: https://github.com/PokemonAutomation/ + * + * The golden's lines for 17.01 (after PokemonFRLG_AutoStoryPlanGolden16.h's, + * before PokemonFRLG_AutoStoryPlanGolden13.h's) and for 17.02 to 17.04 + * (after PokemonFRLG_AutoStoryPlanGolden14.h's), in the story's order. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryPlanGolden17_H +#define PokemonAutomation_PokemonFRLG_AutoStoryPlanGolden17_H + +#include + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + +// The stored plan lines of 17.01, Saffron to Cinnabar. +inline constexpr std::string_view FRLG_PLAN_GOLDEN_17_SURF[] = { + "17.01 saffron_outside from SaffronCity_PokemonCenter_1F (7, 4) facing north to SaffronCity (24, 39) facing south", + "17.01 walk south 5 (warp) -> SaffronCity (24, 39) [walk only]", + "17.01 pallet_shore from PalletTown (6, 8) facing south to PalletTown (8, 16) facing south", + "17.01 walk south 2 (to wall) -> PalletTown (6, 10)", + "17.01 walk east 4 -> PalletTown (10, 10)", + "17.01 walk south 6 (to wall) -> PalletTown (10, 16)", + "17.01 walk west 2 -> PalletTown (8, 16)", + "17.01 face south -> PalletTown (8, 16)", + "17.01 surf_route_21 from PalletTown (8, 17) facing south to CinnabarIsland (14, 12) facing north", + "17.01 walk south 29 -> Route21_North (8, 26) [surfing] [wild] [connection 3]", + "17.01 walk south 1 -> Route21_North (8, 27) [surfing] [wild]", + "17.01 surf north -> Route21_North (8, 26) [wild]", + "17.01 walk east 5 -> Route21_North (13, 26) [surfing] [wild]", + "17.01 walk east 1 -> Route21_North (14, 26) [surfing] [wild]", + "17.01 surf west -> Route21_North (13, 26) [wild]", + "17.01 walk south 68 -> Route21_South (13, 44) [surfing] [wild] [connection 24]", + "17.01 walk south 1 -> Route21_South (13, 45) [surfing] [wild]", + "17.01 walk south 10 -> CinnabarIsland (13, 5) [connection 5]", + "17.01 walk east 8 (to wall) -> CinnabarIsland (21, 5)", + "17.01 walk south 7 -> CinnabarIsland (21, 12)", + "17.01 walk west 7 -> CinnabarIsland (14, 12)", + "17.01 face north -> CinnabarIsland (14, 12)", +}; + +// The stored plan lines of 17.02 to 17.04, Cinnabar to Viridian Gym. +inline constexpr std::string_view FRLG_PLAN_GOLDEN_17_GYM[] = { + "17.02 cinnabar_outside from CinnabarIsland_PokemonCenter_1F (7, 4) facing north to CinnabarIsland (14, 12) facing south", + "17.02 walk south 5 (warp) -> CinnabarIsland (14, 12) [walk only]", + "17.02 below_gym_door from ViridianCity (26, 27) facing south to ViridianCity (36, 11) facing north", + "17.02 walk west 4 -> ViridianCity (22, 27)", + "17.02 walk north 21 -> ViridianCity (22, 6)", + "17.02 walk east 19 (to wall) -> ViridianCity (41, 6)", + "17.02 walk south 5 -> ViridianCity (41, 11)", + "17.02 walk west 5 -> ViridianCity (36, 11)", + "17.02 face north -> ViridianCity (36, 11)", + "17.02 below_warren_line from ViridianCity_Gym (17, 22) facing north to ViridianCity_Gym (15, 8) facing north", + "17.02 walk north 7 (to wall) -> ViridianCity_Gym (17, 15) [walk only]", + "17.02 walk west 3 (to wall) -> ViridianCity_Gym (14, 15) [walk only]", + "17.02 walk north 2 (to wall) -> ViridianCity_Gym (14, 13) [walk only]", + "17.02 walk west 1 -> ViridianCity_Gym (13, 13) [walk only]", + "17.02 walk north 3 (to wall) -> ViridianCity_Gym (13, 10) [walk only]", + "17.02 walk east 3 (to wall) -> ViridianCity_Gym (16, 10) [walk only]", + "17.02 walk north 2 -> ViridianCity_Gym (16, 8) [walk only]", + "17.02 walk west 1 (to wall) -> ViridianCity_Gym (15, 8) [walk only]", + "17.02 face north -> ViridianCity_Gym (15, 8) [walk only]", + "17.03 below_takashi_line from ViridianCity_Gym (15, 7) facing north to ViridianCity_Gym (10, 6) facing north", + "17.03 walk north 1 (to wall) -> ViridianCity_Gym (15, 6) [walk only]", + "17.03 walk west 3 (to wall) -> ViridianCity_Gym (12, 6) [walk only]", + "17.03 walk south 1 (to wall) -> ViridianCity_Gym (12, 7) [walk only]", + "17.03 walk west 2 (to wall) -> ViridianCity_Gym (10, 7) [walk only]", + "17.03 walk north 1 -> ViridianCity_Gym (10, 6) [walk only]", + "17.03 below_giovanni from ViridianCity_Gym (10, 5) facing north to ViridianCity_Gym (2, 3) facing north", + "17.03 walk north 2 -> ViridianCity_Gym (10, 3) [walk only]", + "17.03 walk west 3 -> ViridianCity_Gym (7, 3) [walk only]", + "17.03 walk south 3 (to wall) -> ViridianCity_Gym (7, 6) [walk only]", + "17.03 walk west 5 -> ViridianCity_Gym (2, 6) [walk only]", + "17.03 walk north 3 -> ViridianCity_Gym (2, 3) [walk only]", + "17.04 gym_exit from ViridianCity_Gym (2, 3) facing north to ViridianCity (36, 11) facing south", + "17.04 walk south 4 (to wall) -> ViridianCity_Gym (2, 7) [walk only]", + "17.04 walk east 4 (to wall) -> ViridianCity_Gym (6, 7) [walk only]", + "17.04 walk north 1 (to wall) -> ViridianCity_Gym (6, 6) [walk only]", + "17.04 walk east 1 (to wall) -> ViridianCity_Gym (7, 6) [walk only]", + "17.04 walk north 3 -> ViridianCity_Gym (7, 3) [walk only]", + "17.04 walk east 4 (spins 6) -> ViridianCity_Gym (17, 3) [walk only]", + "17.04 walk east 1 (spins 11) -> ViridianCity_Gym (18, 14) [walk only]", + "17.04 walk south 8 (to wall) -> ViridianCity_Gym (18, 22) [walk only]", + "17.04 walk west 1 -> ViridianCity_Gym (17, 22) [walk only] [tapped]", + "17.04 walk south 1 (warp) -> ViridianCity (36, 11) [walk only]", + "17.04 below_center_door from ViridianCity (36, 11) facing south to ViridianCity (26, 27) facing north", + "17.04 walk east 5 (to wall) -> ViridianCity (41, 11)", + "17.04 walk north 7 (to wall) -> ViridianCity (41, 4)", + "17.04 walk west 13 (to wall) -> ViridianCity (28, 4)", + "17.04 walk south 4 (to wall) -> ViridianCity (28, 8)", + "17.04 walk west 6 -> ViridianCity (22, 8)", + "17.04 walk south 19 -> ViridianCity (22, 27)", + "17.04 walk east 4 -> ViridianCity (26, 27)", + "17.04 face north -> ViridianCity (26, 27)", +}; + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif 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 095a870752..b246e9dbdb 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 09.03 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 15.01 16.01 13.01 13.02 13.03 13.04 14.01 14.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 09.03 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 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 17.02 17.03 17.04"; 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 09.03 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 15.01 16.01 13.01 13.02 13.03 13.04 14.01 14.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 09.03 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 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 17.02 17.03 17.04"}, }, { .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 09.03 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 15.01 16.01 13.01 13.02 13.03 13.04 14.01 14.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 09.03 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 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 17.02 17.03 17.04"}, }, { .input = { .name = "Gift RNG: started at 04.03, from the save beside the salesman", @@ -273,7 +273,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 09.03 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 15.01 16.01 13.01 13.02 13.03 13.04 14.01 14.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 09.03 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 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 17.02 17.03 17.04"}, }, { .input = { .name = "Starter RNG first, with both on", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h index 859bb7cfdc..7fad93580f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h @@ -19,13 +19,13 @@ 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 story's order (STORY_ORDER in PokemonFRLG_AutoStoryTable.cpp) ends. -// 13.01 starts at Cinnabar's Center nurse, where no row before it in the -// order ends (Silph Co.'s 16.01 ends on a pad on 5F; the Surf or Fly to -// Cinnabar is not authored). 14.01 starts outside the Pokemon Mansion, after -// its Escape Rope (13.04), which is not authored. An id leaves this list -// once the rows before it are in. +// 17.01 starts at Saffron's Center nurse, where no row before it in the +// order ends (Silph Co.'s 16.01 ends on a pad on 5F; the rest of Silph Co. +// and Sabrina are not authored). 14.01 starts outside the Pokemon Mansion, +// after its Escape Rope (13.04), which is not authored. An id leaves this +// list once the rows before it are in. inline bool starts_after_unauthored_rows(std::string_view id){ - return id == "13.01" || id == "14.01"; + return id == "17.01" || id == "14.01"; } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp index e000c38684..f357e563a8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp @@ -103,10 +103,58 @@ UnitTestResult test_surf_to_cinnabar(){ return true; } +// Viridian Gym's arrow tiles (the map file's glyphs): stepped onto, the +// player slides until a stop tile or a wall, turned by each arrow met. +UnitTestResult check_gym_slide(const TilePos& from, const TilePos& end, Direction facing, int tiles){ + const MapData* gym = nullptr; + for (const MapData& map : story_maps()){ + if (map.name == "ViridianCity_Gym"){ + gym = ↦ + } + } + if (gym == nullptr){ + return "No ViridianCity_Gym map."; + } + const std::optional slide = spin_slide(*gym, PlayerState{from, ELEVATION_GROUND, false}); + if (!slide){ + return "No slide from " + to_string(from) + "."; + } + if (!(slide->end.position == end) || slide->facing != facing || slide->tiles != tiles){ + return std::format( + "From {}: slid {} tile(s) to {} facing {}; expected {} to {} facing {}.", + to_string(from), slide->tiles, to_string(slide->end.position), direction_name(slide->facing), + tiles, to_string(end), direction_name(facing) + ); + } + return true; +} + +UnitTestResult test_gym_east_arrow(){ + return check_gym_slide({11, 3}, {17, 3}, Direction::EAST, 6); +} +UnitTestResult test_gym_south_arrow_chain(){ + return check_gym_slide({18, 3}, {18, 14}, Direction::SOUTH, 11); +} +UnitTestResult test_gym_north_arrow(){ + return check_gym_slide({0, 20}, {0, 11}, Direction::NORTH, 9); +} + const AutoStoryViridianCase AUTO_STORY_VIRIDIAN_CASES[] = { { .input = {.name = "17.01 Saffron to Cinnabar by Fly and Surf", .body = test_surf_to_cinnabar}, - .expectation = {.description = "Pallet Town's shore, Route 21 surfed, below Cinnabar's Center door, nobody met"}, + .expectation = {.description = "Pallet Town's shore, Route 21 surfed, below Cinnabar's Center door, nobody met"}, + }, + { + .input = {.name = "Viridian Gym: the east arrow at (11, 3) slides to its stop", .body = test_gym_east_arrow}, + .expectation = {.description = "6 tiles east to (17, 3)"}, + }, + { + .input = {.name = "Viridian Gym: the south arrows at (18, 3) slide to the stop below", .body = test_gym_south_arrow_chain}, + .expectation = {.description = "11 tiles south to (18, 14)"}, + }, + { + .input = {.name = "Viridian Gym: the north arrow at (0, 20) slides to its stop", .body = test_gym_north_arrow}, + .expectation = {.description = "9 tiles north to (0, 11)"}, }, }; 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 ea8cc3304d..47051ed575 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -41,6 +41,7 @@ #include "PokemonFRLG_AutoStoryPlanGolden14.h" #include "PokemonFRLG_AutoStoryPlanGolden15.h" #include "PokemonFRLG_AutoStoryPlanGolden16.h" +#include "PokemonFRLG_AutoStoryPlanGolden17.h" #include "PokemonFRLG_AutoStoryPlanGolden13.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" #include "PokemonFRLG_AutoStoryMoveData.h" @@ -291,8 +292,8 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po // 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() != 63 || checkpoints[0].start){ - return "Expected 63 checkpoints, the first from a new game."; + if (checkpoints.size() != 67 || checkpoints[0].start){ + return "Expected 67 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){ @@ -338,8 +339,10 @@ UnitTestResult test_golden_plans(){ golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_12), std::end(FRLG_PLAN_GOLDEN_12)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_15), std::end(FRLG_PLAN_GOLDEN_15)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_16), std::end(FRLG_PLAN_GOLDEN_16)); + golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_17_SURF), std::end(FRLG_PLAN_GOLDEN_17_SURF)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_13), std::end(FRLG_PLAN_GOLDEN_13)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_14), std::end(FRLG_PLAN_GOLDEN_14)); + golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_17_GYM), std::end(FRLG_PLAN_GOLDEN_17_GYM)); const size_t stored = golden.size(); size_t first_diff = 0; while (first_diff < actual.size() && first_diff < stored && actual[first_diff] == golden[first_diff]){ @@ -924,10 +927,10 @@ UnitTestResult test_trainer_lines(){ } has_shoes = has_shoes || checkpoint.id == "03.03"; } - if (beaten.size() != 41){ + if (beaten.size() != 43){ return "Expected to fight Colton, Greg and James on Route 3, the Grunt at (12, 20) in Mt. Moon, Nugget Bridge's five" ", Franklin, Kelsey, Nob and Haley on Route 25, Jeff on Route 6, Dwayne, Baily and Tucker in Vermilion Gym, Alicia, Jeremy and Conner on Route 9" - ", Ashton, Winston, Martha, Allen, Lenny, Sofia, Dudley and Dana in Rock Tunnel, Rich on Route 8, the Lift Key Grunt on B4F, Ruth, Tammy, Jennifer and Emilia and the three Grunts in the Pokemon Tower, and Kayden , Kirk in Fuchsia Gym, and Tamia and Lori in Celadon Gym; the table fights " + ", Ashton, Winston, Martha, Allen, Lenny, Sofia, Dudley and Dana in Rock Tunnel, Rich on Route 8, the Lift Key Grunt on B4F, Ruth, Tammy, Jennifer and Emilia and the three Grunts in the Pokemon Tower, and Kayden , Kirk in Fuchsia Gym, and Tamia and Lori in Celadon Gym, and Warren and Takashi in Viridian Gym; the table fights " + std::to_string(beaten.size()) + " trainers."; } return true; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json index f360e372ad..9170ccdef0 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json @@ -107,6 +107,16 @@ }, "why": "north and west through the gym's open floor (no arrow tile on this way) to (15, 8), below Warren's line (14..16, 7)" }, + { + "id": "lead_lv47_for_the_gym", + "kind": "game_action", + "action": "level", + "args": { + "slot": 1, + "min": 47 + }, + "why": "the lead at least Lv47 before the gym's fights (Giovanni's Rhyhorn is Lv50), checked before the first trainer's line; below it the run stops" + }, { "id": "warren_line", "kind": "step", @@ -116,16 +126,6 @@ }, "why": "onto (15, 7), the end of Warren's line (sight 3, facing east): he walks over" }, - { - "id": "lead_lv47_for_giovanni", - "kind": "game_action", - "action": "level", - "args": { - "slot": 1, - "min": 47 - }, - "why": "the lead at least Lv47 before the gym's fights (Giovanni's Rhyhorn is Lv50); below it the run stops" - }, { "id": "warren", "kind": "battle", diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 25bdb72344..627cebc29b 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2157,6 +2157,7 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden14.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden15.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryResources.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryResources.h From d157785dd77efd937194dce9925683fa61bc4e10 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 16:10:51 -0800 Subject: [PATCH 3/6] FRLG AutoStory: Viridian tests, format a message --- .../Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp index f357e563a8..b178fef7d4 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp @@ -117,7 +117,7 @@ UnitTestResult check_gym_slide(const TilePos& from, const TilePos& end, Directio } const std::optional slide = spin_slide(*gym, PlayerState{from, ELEVATION_GROUND, false}); if (!slide){ - return "No slide from " + to_string(from) + "."; + return std::format("No slide from {}.", to_string(from)); } if (!(slide->end.position == end) || slide->facing != facing || slide->tiles != tiles){ return std::format( From 4241acba6e982a398c0e332fa03b306ec08a532c Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 20:47:27 -0800 Subject: [PATCH 4/6] FRLG AutoStory: the chain test expects 70 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 1fea476e03..af78b7d424 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -292,8 +292,8 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po // 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() != 69 || checkpoints[0].start){ - return "Expected 69 checkpoints, the first from a new game."; + if (checkpoints.size() != 70 || checkpoints[0].start){ + return "Expected 70 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){ From 22764e861faebd02557f3a5be08db68286cb32cb Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 20:52:04 -0800 Subject: [PATCH 5/6] FRLG 17.04: Giovanni alone; the walk out and the heal are 17.04b A boss battle is its own checkpoint (user, 2026-11-12). 17.04 starts in front of Giovanni and ends there after the EARTHBADGE and TM26 text; the new 17.04b starts at the same tile, leaves the gym and heals at Viridian's Center. Ids are not renumbered; the golden, run-plan, table and count follow. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG_AutoStoryPlanGolden17.h | 40 +++---- .../PokemonFRLG_AutoStoryRows17_Tests.h | 2 +- .../PokemonFRLG_AutoStoryRunPlan_Tests.cpp | 8 +- .../AutoStory/PokemonFRLG_AutoStoryTable.cpp | 2 +- .../PokemonFRLG_AutoStoryViridian_Tests.cpp | 2 +- .../AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 4 +- .../AutoStory/StoryData/frlg-17.04.plan.json | 67 +----------- .../AutoStory/StoryData/frlg-17.04b.plan.json | 101 ++++++++++++++++++ 8 files changed, 135 insertions(+), 91 deletions(-) create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04b.plan.json diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h index 2eca1bec8a..8045515591 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h @@ -76,26 +76,26 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_17_GYM[] = { "17.03 walk south 3 (to wall) -> ViridianCity_Gym (7, 6) [walk only]", "17.03 walk west 5 -> ViridianCity_Gym (2, 6) [walk only]", "17.03 walk north 3 -> ViridianCity_Gym (2, 3) [walk only]", - "17.04 gym_exit from ViridianCity_Gym (2, 3) facing north to ViridianCity (36, 11) facing south", - "17.04 walk south 4 (to wall) -> ViridianCity_Gym (2, 7) [walk only]", - "17.04 walk east 4 (to wall) -> ViridianCity_Gym (6, 7) [walk only]", - "17.04 walk north 1 (to wall) -> ViridianCity_Gym (6, 6) [walk only]", - "17.04 walk east 1 (to wall) -> ViridianCity_Gym (7, 6) [walk only]", - "17.04 walk north 3 -> ViridianCity_Gym (7, 3) [walk only]", - "17.04 walk east 4 (spins 6) -> ViridianCity_Gym (17, 3) [walk only]", - "17.04 walk east 1 (spins 11) -> ViridianCity_Gym (18, 14) [walk only]", - "17.04 walk south 8 (to wall) -> ViridianCity_Gym (18, 22) [walk only]", - "17.04 walk west 1 -> ViridianCity_Gym (17, 22) [walk only] [tapped]", - "17.04 walk south 1 (warp) -> ViridianCity (36, 11) [walk only]", - "17.04 below_center_door from ViridianCity (36, 11) facing south to ViridianCity (26, 27) facing north", - "17.04 walk east 5 (to wall) -> ViridianCity (41, 11)", - "17.04 walk north 7 (to wall) -> ViridianCity (41, 4)", - "17.04 walk west 13 (to wall) -> ViridianCity (28, 4)", - "17.04 walk south 4 (to wall) -> ViridianCity (28, 8)", - "17.04 walk west 6 -> ViridianCity (22, 8)", - "17.04 walk south 19 -> ViridianCity (22, 27)", - "17.04 walk east 4 -> ViridianCity (26, 27)", - "17.04 face north -> ViridianCity (26, 27)", + "17.04b gym_exit from ViridianCity_Gym (2, 3) facing north to ViridianCity (36, 11) facing south", + "17.04b walk south 4 (to wall) -> ViridianCity_Gym (2, 7) [walk only]", + "17.04b walk east 4 (to wall) -> ViridianCity_Gym (6, 7) [walk only]", + "17.04b walk north 1 (to wall) -> ViridianCity_Gym (6, 6) [walk only]", + "17.04b walk east 1 (to wall) -> ViridianCity_Gym (7, 6) [walk only]", + "17.04b walk north 3 -> ViridianCity_Gym (7, 3) [walk only]", + "17.04b walk east 4 (spins 6) -> ViridianCity_Gym (17, 3) [walk only]", + "17.04b walk east 1 (spins 11) -> ViridianCity_Gym (18, 14) [walk only]", + "17.04b walk south 8 (to wall) -> ViridianCity_Gym (18, 22) [walk only]", + "17.04b walk west 1 -> ViridianCity_Gym (17, 22) [walk only] [tapped]", + "17.04b walk south 1 (warp) -> ViridianCity (36, 11) [walk only]", + "17.04b below_center_door from ViridianCity (36, 11) facing south to ViridianCity (26, 27) facing north", + "17.04b walk east 5 (to wall) -> ViridianCity (41, 11)", + "17.04b walk north 7 (to wall) -> ViridianCity (41, 4)", + "17.04b walk west 13 (to wall) -> ViridianCity (28, 4)", + "17.04b walk south 4 (to wall) -> ViridianCity (28, 8)", + "17.04b walk west 6 -> ViridianCity (22, 8)", + "17.04b walk south 19 -> ViridianCity (22, 27)", + "17.04b walk east 4 -> ViridianCity (26, 27)", + "17.04b face north -> ViridianCity (26, 27)", }; } // namespace PokemonFRLG diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h index 49529584c9..fd6a740a97 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows17_Tests.h @@ -17,7 +17,7 @@ namespace NintendoSwitch{ namespace PokemonFRLG{ -// Rows 17.01 to 17.04 and Viridian Gym's spinner tiles, on the overworld sim (PokemonFRLG_AutoStoryViridian_Tests.cpp). +// Rows 17.01 to 17.04b and Viridian Gym's spinner tiles, on the overworld sim (PokemonFRLG_AutoStoryViridian_Tests.cpp). void add_tests_AutoStoryViridian(UnitTestDatabase& database); 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 0376bd23f1..ec19db59fb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp @@ -145,7 +145,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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04"; +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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04 17.04b"; const RunPlanScenario RUN_PLAN_CASES[] = { { @@ -236,11 +236,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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04"}, + .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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04 17.04b"}, }, { .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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04"}, + .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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04 17.04b"}, }, { .input = { .name = "Gift RNG: started at 04.03, from the save beside the salesman", @@ -279,7 +279,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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04"}, + .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 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01 17.01 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 17.02 17.03 17.04 17.04b"}, }, { .input = { .name = "Starter RNG first, with both on", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp index bae4f7e560..b889b2bd68 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp @@ -235,7 +235,7 @@ constexpr std::string_view STORY_ORDER[] = { "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.02b", "12.03", "14.03", "14.04", "14.04b", "15.01", "16.01", "17.01", "13.01", "13.02", "13.03", "13.04", "14.01", "14.02", "14.02b", - "17.02", "17.03", "17.04", + "17.02", "17.03", "17.04", "17.04b", }; // `checkpoints` in STORY_ORDER's order. Throws ParseException for a diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp index b178fef7d4..260fdc197a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp @@ -2,7 +2,7 @@ * * From: https://github.com/PokemonAutomation/ * - * Rows 17.01 to 17.04 (StoryData/frlg-17.0N.plan.json) on the overworld + * Rows 17.01 to 17.04b (StoryData/frlg-17.0N.plan.json) on the overworld * sim: Saffron's Center to Cinnabar's by Fly and Surf, and from Cinnabar's * Center by Fly to Viridian City and through its Gym to Giovanni. * 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 af78b7d424..32d9a6438a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -292,8 +292,8 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po // 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() != 70 || checkpoints[0].start){ - return "Expected 70 checkpoints, the first from a new game."; + if (checkpoints.size() != 71 || checkpoints[0].start){ + return "Expected 71 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json index de15be3715..df66993362 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04.plan.json @@ -3,7 +3,7 @@ "game": "frlg", "checkpoint": { "id": "17.04", - "title": "Viridian Gym: Giovanni and the EARTHBADGE, heal at Viridian's Center", + "title": "Viridian Gym: Giovanni and the EARTHBADGE", "start": { "map": "ViridianCity_Gym", "tiles": [ @@ -54,63 +54,6 @@ "facing": "north" }, "why": "Giovanni: Rhyhorn Lv45, Dugtrio Lv42, Nidoqueen Lv44, Nidoking Lv45, Rhydon Lv50; then the EARTHBADGE and TM26 Earthquake" - }, - { - "id": "gym_exit", - "kind": "route", - "action": "run", - "args": { - "target": { - "map": "ViridianCity", - "tiles": [ - [ - 36, - 11 - ] - ], - "facing": "south" - } - }, - "why": "back through the gym to the door and out onto Viridian City below it" - }, - { - "id": "below_center_door", - "kind": "route", - "action": "run", - "args": { - "target": { - "map": "ViridianCity", - "tiles": [ - [ - 26, - 27 - ] - ], - "facing": "north" - } - }, - "why": "west and down to below the Center's door (26, 26)" - }, - { - "id": "viridian_nurse", - "kind": "game_action", - "action": "center_enter", - "declared_after": { - "map": "ViridianCity_PokemonCenter_1F", - "tiles": [ - [ - 7, - 4 - ] - ], - "facing": "north" - }, - "why": "the Center script in, up to the nurse" - }, - { - "id": "heal_viridian", - "kind": "heal", - "why": "full HP and PP" } ] }, @@ -118,7 +61,7 @@ "menu": "full", "notes": { "checkpoint": [ - "Ends at Viridian's nurse (declared: the gym exit is a street tile; the Center is where the next row starts)." + "A boss battle is its own checkpoint (user, 2026-11-12): Giovanni's fight is all this row does. It ends in front of him after the EARTHBADGE and TM26 text, and saves there; 17.04b goes on out of the gym." ] } }, @@ -126,11 +69,11 @@ "phase": "testing", "postconditions": { "position": { - "map": "ViridianCity_PokemonCenter_1F", + "map": "ViridianCity_Gym", "tiles": [ [ - 7, - 4 + 2, + 3 ] ], "facing": "north" diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04b.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04b.plan.json new file mode 100644 index 0000000000..4281616ef2 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.04b.plan.json @@ -0,0 +1,101 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "17.04b", + "title": "Out of the gym, heal at Viridian's Center", + "start": { + "map": "ViridianCity_Gym", + "tiles": [ + [ + 2, + 3 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "gym_exit", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity", + "tiles": [ + [ + 36, + 11 + ] + ], + "facing": "south" + } + }, + "why": "back through the gym to the door and out onto Viridian City below it" + }, + { + "id": "below_center_door", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "ViridianCity", + "tiles": [ + [ + 26, + 27 + ] + ], + "facing": "north" + } + }, + "why": "west and down to below the Center's door (26, 26)" + }, + { + "id": "viridian_nurse", + "kind": "game_action", + "action": "center_enter", + "declared_after": { + "map": "ViridianCity_PokemonCenter_1F", + "tiles": [ + [ + 7, + 4 + ] + ], + "facing": "north" + }, + "why": "the Center script in, up to the nurse" + }, + { + "id": "heal_viridian", + "kind": "heal", + "why": "full HP and PP" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts in front of Giovanni, where 17.04 ends after his battle and saves.", + "Ends at Viridian's nurse (declared: the gym exit is a street tile; the Center is where the next row starts)." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "ViridianCity_PokemonCenter_1F", + "tiles": [ + [ + 7, + 4 + ] + ], + "facing": "north" + } + } + } +} \ No newline at end of file From ca40dfa0ff3bae6a894d8628ed0b454f22070ec6 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 21:33:47 -0800 Subject: [PATCH 6/6] FRLG AutoStory: 70 checkpoints without 17.01; trim Viridian test includes Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp | 4 ---- .../Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp index a49e08927f..2c0aeb9cbc 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp @@ -15,13 +15,9 @@ #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 "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSpin.h" -#include "PokemonFRLG_AutoStoryEvents.h" -#include "PokemonFRLG_AutoStoryRooms.h" #include "PokemonFRLG_AutoStoryRowSim.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" #include "PokemonFRLG_AutoStoryRows17_Tests.h" 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 e99a62fefa..d88532ea20 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -292,8 +292,8 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po // 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() != 71 || checkpoints[0].start){ - return "Expected 71 checkpoints, the first from a new game."; + if (checkpoints.size() != 70 || checkpoints[0].start){ + return "Expected 70 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){