From eae83efe39e9cbc9c811298d40af9458525335d2 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 02:39:33 -0800 Subject: [PATCH 1/8] PokemonFRLG: 11.03, the Safari Zone to HM03 Surf and Fly back to Fuchsia Pokeguy's Safari Zone: 500 for the game, the eastern path, one Super Repel and the Bicycle, the FULL RESTORE, the GOLD TEETH, HM03 SURF from the Secret House, and Fly out to Fuchsia City. The Safari Zone's START menu (RETIRE on top, no SAVE) is a StartMenu of its own, which the use_item and fly steps open with their new `safari` arg. The Safari maps are built in, and their edge warps keep a rider on the Bicycle. New sim suite: the row on the OverworldSim, its steps against the Safari Zone's 600 and the Super Repel's 200, and the menus. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_OverworldMaps.cpp | 11 + .../Overworld/PokemonFRLG_OverworldMaps.h | 5 +- .../PokemonFRLG/PokemonFRLG_Tests.cpp | 1 + .../AutoStory/Data/LegacyJsonFormat.h | 1 + .../PokemonFRLG_AutoStoryActions.cpp | 20 + .../AutoStory/PokemonFRLG_AutoStoryBagUse.h | 6 +- .../AutoStory/PokemonFRLG_AutoStoryEvents.cpp | 2 +- .../PokemonFRLG_AutoStoryFieldMoves.cpp | 10 +- .../PokemonFRLG_AutoStoryFieldMoves.h | 7 +- .../PokemonFRLG_AutoStoryHideout.cpp | 3 +- .../PokemonFRLG_AutoStoryItemUse.cpp | 5 +- .../AutoStory/PokemonFRLG_AutoStoryItemUse.h | 3 +- .../AutoStory/PokemonFRLG_AutoStoryMember.cpp | 6 +- .../PokemonFRLG_AutoStoryMemberInfo.h | 11 +- .../PokemonFRLG_AutoStoryPlanGolden11.h | 29 + .../PokemonFRLG_AutoStoryRows_Tests.h | 2 + .../PokemonFRLG_AutoStoryRunPlan_Tests.cpp | 8 +- .../PokemonFRLG_AutoStorySafari_Tests.cpp | 268 ++++++++++ .../PokemonFRLG_AutoStoryStartMenu.h | 15 +- .../PokemonFRLG_AutoStorySummary.cpp | 4 +- .../AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 4 +- .../AutoStory/StoryData/frlg-11.03.plan.json | 501 ++++++++++++++++++ SerialPrograms/cmake/SourceFiles.cmake | 1 + 23 files changed, 892 insertions(+), 31 deletions(-) create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySafari_Tests.cpp create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-11.03.plan.json diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp index 7dd074f2f1..1f2bc021b7 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp @@ -128,6 +128,14 @@ constexpr std::string_view MAP_NAMES[] = { "Route18", "Route18_EastEntrance_1F", "FuchsiaCity", + // The Safari Zone, pokeguy's way through it: its entrance, the + // center, east, north and west areas, and the Secret House (HM03). + "FuchsiaCity_SafariZone_Entrance", + "SafariZone_Center", + "SafariZone_East", + "SafariZone_North", + "SafariZone_West", + "SafariZone_SecretHouse", "CeruleanCave_1F", "CeruleanCave_2F", "CeruleanCave_B1F", @@ -211,6 +219,9 @@ TilePos map_point(const std::vector& maps, const std::string& map, cons bool warp_keeps_bike(const std::string& map){ static const std::set> MAPS{ "Route16_NorthEntrance_1F", "Route18_EastEntrance_1F", "Route16", "Route18", + // The Safari Zone's areas allow cycling, and their edge warps lead + // from one to the next (pokefirered SafariZone_* map.json). + "SafariZone_Center", "SafariZone_East", "SafariZone_North", "SafariZone_West", }; return MAPS.contains(map); } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h index 47d4bd43cf..37b6ab8244 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h @@ -66,8 +66,9 @@ std::set map_flag_set(const std::vector& maps, const std:: // Registers overworld map unit tests. // Whether a warp onto `map` leaves a rider on the Bicycle: the Cycling -// Road's gates (allow_cycling in pokefirered's map.json) and the routes -// their doors open onto. Every other door takes the player off (console +// Road's gates (allow_cycling in pokefirered's map.json), the routes +// their doors open onto, and the Safari Zone's areas, whose edge warps +// lead from one to the next (not measured). Every other door takes the player off (console // B, 2026-11-12 01:05: through Route 16's north gate the player still // rode, and a run-paced open leg after it overshot the Fly house's door). bool warp_keeps_bike(const std::string& map); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp index 238b3405fa..7774bb1077 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp @@ -329,6 +329,7 @@ static void add_tests_AutoStoryRows(UnitTestDatabase& database){ add_tests_AutoStoryCeladon(database); add_tests_AutoStorySnorlax(database); add_tests_AutoStorySlope(database); + add_tests_AutoStorySafari(database); } void add_tests(UnitTestDatabase& database){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/Data/LegacyJsonFormat.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/Data/LegacyJsonFormat.h index 148012d1db..3ce2deca55 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/Data/LegacyJsonFormat.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/Data/LegacyJsonFormat.h @@ -40,6 +40,7 @@ inline std::string_view menu_name(StartMenu menu){ case StartMenu::BEFORE_POKEMON: return "before_pokemon"; case StartMenu::BEFORE_POKEDEX: return "before_pokedex"; case StartMenu::FULL: return "full"; + case StartMenu::SAFARI: break; } throw ParseException("Unsupported FRLG START menu."); } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp index 51bcaa44cd..b427679afc 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp @@ -33,6 +33,7 @@ #include "VideoGames/PokemonFRLG/Programs/PokemonFRLG_NamingScreen.h" #include "VideoGames/PokemonFRLG/Programs/PokemonFRLG_StartMenuNavigation.h" #include "PokemonFRLG_AutoStoryActions.h" +#include "PokemonFRLG_AutoStoryGameArgs.h" #include "PokemonFRLG_AutoStoryGenderMenu.h" #include "PokemonFRLG_AutoStoryStepInterrupts.h" #include "PokemonFRLG_AutoStoryTrainerMessage.h" @@ -440,6 +441,7 @@ int start_menu_rows(StartMenu menu){ case StartMenu::BEFORE_POKEDEX: return 6; case StartMenu::FULL: + case StartMenu::SAFARI: return 7; } return 7; @@ -451,6 +453,24 @@ int start_menu_option_row(StartMenu menu){ return start_menu_rows(menu) - 2; } +StartMenuContext start_menu_context(StartMenu menu){ + switch (menu){ + case StartMenu::BEFORE_POKEDEX: + return StartMenuContext::NO_DEX; + case StartMenu::SAFARI: + return StartMenuContext::SAFARI_ZONE; + case StartMenu::BEFORE_POKEMON: + case StartMenu::FULL: + return StartMenuContext::STANDARD; + } + return StartMenuContext::STANDARD; +} + +StartMenu step_start_menu(const Pokemon::StoryActionArgs& args){ + const bool* safari = game_arg(args, "safari"); + return safari != nullptr && *safari ? StartMenu::SAFARI : StartMenu::FULL; +} + std::optional yes_no_cursor(const ImageViewRGB32& screen){ // The box's white right of NO (x 196-212, y 92-102 on the 240x160 diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryBagUse.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryBagUse.h index 802f5c0724..3d150e2084 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryBagUse.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryBagUse.h @@ -17,6 +17,7 @@ #include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h" #include "NintendoSwitch/NintendoSwitch_ConsoleHandle.h" #include "PokemonFRLG_AutoStoryBag.h" +#include "PokemonFRLG_AutoStoryStartMenu.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -35,10 +36,10 @@ ItemUseEnd register_item_in_bag(Logger& logger, ItemUseActions& actions, std::st // failure: the walk goes on without. ItemUseEnd renew_repel(Logger& logger, ItemUseActions& actions, std::string_view item); -// The console's bag. +// The console's bag, opened from `menu`'s BAG. class ConsoleItemUseActions : public ItemUseActions{ public: - ConsoleItemUseActions(ConsoleHandle& console, ProControllerContext& context, Language language); + ConsoleItemUseActions(ConsoleHandle& console, ProControllerContext& context, Language language, StartMenu menu); virtual bool open_pocket(BagPocket pocket) override; virtual std::vector read_pocket() override; @@ -50,6 +51,7 @@ class ConsoleItemUseActions : public ItemUseActions{ ConsoleHandle& m_console; ProControllerContext& m_context; Language m_language; + StartMenu m_menu; }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp index 5fd3aafa18..9345eb5aac 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp @@ -571,7 +571,7 @@ std::optional run_abilities(StoryEnv& env, RunState& state, const Story } ); ConsoleChoiceActions choice(env.console, env.context); - StoryAbilities abilities{console_member_reader(env.console, env.context, env.language), mart, teach, grind, choice}; + StoryAbilities abilities{console_member_reader(env.console, env.context, env.language, StartMenu::FULL), mart, teach, grind, choice}; if (const std::optional plan = step.action == GRIND_CHECK_ACTION ? grind_plan_of(step.args) : std::nullopt){ if (grind_reached_already(env.console.logger(), grind, abilities.members, *plan)){ state.flags.insert(step.name); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.cpp index e8e8272d84..304f69404e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.cpp @@ -57,7 +57,10 @@ std::optional parse_fly_step(const StoryStep& step){ if (!index || !slot || !menu_row){ return std::nullopt; } - return FlyPlan{.slot = *slot, .species = species == nullptr ? "" : *species, .menu_row = *menu_row, .town = *index}; + return FlyPlan{ + .slot = *slot, .species = species == nullptr ? "" : *species, .menu_row = *menu_row, .town = *index, + .start_menu = step_start_menu(step.args), + }; } std::optional FlyPlan::party_slot(const MemberReader& reader) const{ @@ -88,6 +91,7 @@ std::vector field_move_specs(){ absent_arg("slot", StoryArgType::INTEGER, "the Fly user's party slot, from 1, when no species is named"), absent_arg("species", StoryArgType::WORD, "the Fly user by its species, e.g. \"pidgey\": the first slot whose summary reads it"), optional_arg("menu_row", StoryArgType::INTEGER, int64_t(2), "FLY's row on its menu, from 1: SUMMARY, then field moves in move order"), + optional_arg("safari", StoryArgType::BOOLEAN, false, "in the Safari Zone, whose START menu has RETIRE on top"), }}, {.kind = StoryStepKind::GAME, .name = SURF_VARIANT, .args = { required_arg("direction", StoryArgType::DIRECTION, "the way to the water, from ground beside it"), @@ -128,7 +132,7 @@ void tap_dpad(ProControllerContext& context, DpadPosition dpad, size_t count, Mi // From the overworld to the fly map: the party, the Fly user, FLY. // Returns the failure, or empty. std::string open_fly_map(ConsoleHandle& console, ProControllerContext& context, const FlyPlan& plan){ - open_party_menu_from_overworld(console, context); + open_party_menu_from_overworld(console, context, start_menu_context(plan.start_menu)); tap_dpad(context, DPAD_DOWN, plan.slot, MENU_TAP, MENU_TAP_RELEASE); PartySelectionWatcher mon_menu(COLOR_RED); context.wait_for_all_requests(); @@ -188,7 +192,7 @@ std::optional run_field_move_step( return std::nullopt; } const FlyTown& town = kanto_fly_towns()[plan->town]; - const std::optional slot = plan->party_slot(console_member_reader(console, context, language)); + const std::optional slot = plan->party_slot(console_member_reader(console, context, language, plan->start_menu)); if (!slot){ console.log(std::format("Story: no {} read in the party to Fly with.", plan->species), COLOR_RED); return Pokemon::outcome_failed("fly_no_member", plan->species); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.h index 3b61fa7ed5..6a7bb54af5 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.h @@ -25,6 +25,7 @@ #include "Pokemon/AutoStory/Types/Pokemon_StoryActionSpec.h" #include "Pokemon/AutoStory/Types/Pokemon_StoryStep.h" #include "PokemonFRLG_AutoStoryMemberInfo.h" +#include "PokemonFRLG_AutoStoryStartMenu.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -35,7 +36,8 @@ namespace PokemonFRLG{ // user (`slot`, from 1, or the first member read as `species`), FLY on its menu (`menu_row`, from 1: SUMMARY, // then its field moves in move order, so 2 when Fly is its only one; // pokefirered SetPartyMonFieldSelectionActions()), and `town` on the fly -// map (kanto_fly_towns()). It ends on the town's landing tile. +// map (kanto_fly_towns()). It ends on the town's landing tile. With +// `safari`, START opens the Safari Zone's menu (StartMenu::SAFARI). inline const std::string FLY_VARIANT = "fly"; // The GAME step that surfs onto the water `direction` of the player, on // ground beside it: A facing it, YES to "Would you like to SURF?", and @@ -51,6 +53,9 @@ struct FlyPlan{ size_t menu_row = 1; // In kanto_fly_towns(). size_t town = 0; + // The START menu the party opens from: the Safari Zone's when the + // step's "safari" arg says so (step_start_menu()). + StartMenu start_menu = StartMenu::FULL; // The party slot to fly with: `slot`, or the first member `reader` // reads as `species`; nothing if none does. diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout.cpp index a3f829a80c..d3737ddd7e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout.cpp @@ -115,6 +115,7 @@ std::vector field_action_specs(){ }}, {.kind = StoryStepKind::GAME, .name = USE_ITEM_VARIANT, .args = { required_arg("item", StoryArgType::WORD, "the item's slug, as read_item_list_name() names it"), + optional_arg("safari", StoryArgType::BOOLEAN, false, "in the Safari Zone, whose START menu has RETIRE on top"), }}, {.kind = StoryStepKind::GAME, .name = RIDE_BIKE_VARIANT, .args = {}}, {.kind = StoryStepKind::GAME, .name = REGISTER_BIKE_VARIANT, .args = {}}, @@ -208,7 +209,7 @@ std::optional run_field_game_step( OverworldWalkSteps::get_on_bike(console, context); return done(); } - ConsoleItemUseActions bag(console, context, language); + ConsoleItemUseActions bag(console, context, language, step_start_menu(step.args)); const ItemUseEnd end = step.action == REGISTER_BIKE_VARIANT ? register_item_in_bag(console.logger(), bag, "bicycle") : use_item_from_bag(console.logger(), bag, *parse_use_item_step(step)); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.cpp index 0bb925070b..01928a6573 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.cpp @@ -144,14 +144,15 @@ constexpr Milliseconds BAG_CLOSE_TIMEOUT = 30000ms; } // namespace -ConsoleItemUseActions::ConsoleItemUseActions(ConsoleHandle& console, ProControllerContext& context, Language language) +ConsoleItemUseActions::ConsoleItemUseActions(ConsoleHandle& console, ProControllerContext& context, Language language, StartMenu menu) : m_console(console) , m_context(context) , m_language(language) + , m_menu(menu) {} bool ConsoleItemUseActions::open_pocket(BagPocket pocket){ - open_bag_from_overworld(m_console, m_context); + open_bag_from_overworld(m_console, m_context, start_menu_context(m_menu)); pbf_wait(m_context, BAG_SLIDE_IN); // Left to the Items pocket, which doesn't wrap, then right to `pocket`. for (int c = 0; c < 3; c++){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.h index 18f8ab83df..8315a6e5d0 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse.h @@ -51,7 +51,8 @@ inline const std::string BIKE_VARIANT = "bike"; inline const std::string REGISTER_BIKE_VARIANT = "register_bike"; -// The item a use_item step uses, or nothing if it isn't one, the item +// The item a use_item step uses (with "safari", from the Safari Zone's +// START menu, step_start_menu()), or nothing if it isn't one, the item // isn't one the story uses from the bag, or it names a slot. std::optional parse_use_item_step(const Pokemon::StoryStep& step); // Whether `step` is one of this file's steps. diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMember.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMember.cpp index bb4a4b3eb2..31300bef8d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMember.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMember.cpp @@ -14,9 +14,9 @@ namespace NintendoSwitch{ namespace PokemonFRLG{ -MemberReader console_member_reader(ConsoleHandle& console, ProControllerContext& context, Language language){ - return [&console, &context, language](size_t slot) -> std::optional{ - const std::optional read = read_party_summary(console, context, StartMenu::FULL, language, slot); +MemberReader console_member_reader(ConsoleHandle& console, ProControllerContext& context, Language language, StartMenu menu){ + return [&console, &context, language, menu](size_t slot) -> std::optional{ + const std::optional read = read_party_summary(console, context, menu, language, slot); if (!read || read->species.empty() || !read->level || read->moves.empty()){ console.log(std::format("Party: couldn't read the member in slot {}.", slot + 1), COLOR_RED); return std::nullopt; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMemberInfo.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMemberInfo.h index 0b63760e7d..159ac00b81 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMemberInfo.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMemberInfo.h @@ -18,6 +18,7 @@ #include "CommonFramework/Language.h" #include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h" #include "NintendoSwitch/NintendoSwitch_ConsoleHandle.h" +#include "PokemonFRLG_AutoStoryStartMenu.h" #include "PokemonFRLG_AutoStoryStats.h" namespace PokemonAutomation{ @@ -48,11 +49,11 @@ struct MemberInfo{ // summary couldn't be read. using MemberReader = std::function(size_t slot)>; -// The console's reader: the member's summary, opened from the START -// menu's POKEMON, in a game in `language`. The steps that read members -// come after the Pokedex, so the START menu is the full one. A member -// whose species, level or moves aren't all read is nothing. -MemberReader console_member_reader(ConsoleHandle& console, ProControllerContext& context, Language language); +// The console's reader: the member's summary, opened from `menu`'s +// POKEMON, in a game in `language`. The steps that read members come +// after the Pokedex, so `menu` is the full one or the Safari Zone's. A +// member whose species, level or moves aren't all read is nothing. +MemberReader console_member_reader(ConsoleHandle& console, ProControllerContext& context, Language language, StartMenu menu); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h index ba9e256a21..27fc841e1e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h @@ -50,6 +50,35 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_11[] = { "11.02 walk south 1 (to wall) -> FuchsiaCity (28, 6)", "11.02 walk west 4 -> FuchsiaCity (24, 6)", "11.02 face north -> FuchsiaCity (24, 6)", + "11.03 below_safari_counter from FuchsiaCity (24, 6) facing north to FuchsiaCity_SafariZone_Entrance (4, 4) facing north", + "11.03 walk north 1 (warp) -> FuchsiaCity_SafariZone_Entrance (4, 7)", + "11.03 walk north 3 -> FuchsiaCity_SafariZone_Entrance (4, 4) [walk only]", + "11.03 center_to_east from SafariZone_Center (26, 30) facing north to SafariZone_East (9, 27) facing east", + "11.03 walk north 1 -> SafariZone_Center (26, 29)", + "11.03 walk east 16 (to wall) -> SafariZone_Center (42, 29)", + "11.03 walk north 14 (to wall) -> SafariZone_Center (42, 15)", + "11.03 walk east 2 (warp) -> SafariZone_East (8, 26)", + "11.03 walk south 1 (to wall) -> SafariZone_East (8, 27)", + "11.03 walk east 1 -> SafariZone_East (9, 27)", + "11.03 below_full_restore from SafariZone_East (37, 16) facing east to SafariZone_East (37, 16) facing north", + "11.03 face north -> SafariZone_East (37, 16)", + "11.03 into_north_area from SafariZone_East (9, 9) facing west to SafariZone_North (48, 31) facing west", + "11.03 walk west 2 (warp) -> SafariZone_North (48, 31)", + "11.03 into_west_area from SafariZone_North (11, 33) facing south to SafariZone_West (31, 5) facing south", + "11.03 walk south 2 (warp) -> SafariZone_West (31, 5)", + "11.03 below_gold_teeth from SafariZone_West (28, 15) facing west to SafariZone_West (28, 15) facing north", + "11.03 face north -> SafariZone_West (28, 15)", + "11.03 below_secret_house_attendant from SafariZone_West (28, 15) facing north to SafariZone_SecretHouse (6, 6) facing north", + "11.03 walk west 1 (to wall) -> SafariZone_West (27, 15)", + "11.03 walk north 5 -> SafariZone_West (27, 10)", + "11.03 walk west 15 -> SafariZone_West (12, 10)", + "11.03 walk north 3 (warp) -> SafariZone_SecretHouse (4, 9)", + "11.03 walk north 3 (to wall) -> SafariZone_SecretHouse (4, 6) [walk only]", + "11.03 walk east 2 -> SafariZone_SecretHouse (6, 6) [walk only]", + "11.03 face north -> SafariZone_SecretHouse (6, 6) [walk only]", + "11.03 out_of_secret_house from SafariZone_SecretHouse (6, 6) facing north to SafariZone_West (12, 8) facing south", + "11.03 walk west 2 -> SafariZone_SecretHouse (4, 6) [walk only]", + "11.03 walk south 4 (warp) -> SafariZone_West (12, 8) [walk only]", }; } // namespace PokemonFRLG 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 416b5b4b21..2f521f46bc 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h @@ -32,6 +32,8 @@ void add_tests_AutoStoryTower(UnitTestDatabase& database); void add_tests_AutoStorySnorlax(UnitTestDatabase& database); // Row 11.02 on the sims (PokemonFRLG_AutoStorySlope_Tests.cpp). void add_tests_AutoStorySlope(UnitTestDatabase& database); +// Row 11.03 on the sims (PokemonFRLG_AutoStorySafari_Tests.cpp). +void add_tests_AutoStorySafari(UnitTestDatabase& database); } // 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 ae97d65a01..ee277c2cfd 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"; +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"; 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"}, + .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"}, }, { .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"}, + .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"}, }, { .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"}, + .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"}, }, { .input = { .name = "Starter RNG first, with both on", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySafari_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySafari_Tests.cpp new file mode 100644 index 0000000000..3d67b136ed --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySafari_Tests.cpp @@ -0,0 +1,268 @@ +/* AutoStory Safari Tests + * + * From: https://github.com/PokemonAutomation/ + * + * Row 11.03 on the overworld sim: from below the Safari Zone's door into + * its entrance and onto the counter's trigger, then (the script's warp, + * where the table says it ends) through the center, the east area to the + * FULL RESTORE, the north area and the west area to the GOLD TEETH, into + * the Secret House, out, and the Fly to Fuchsia City. And the Safari + * Zone's two counts on the way the program walks: its 600 steps, and the + * Super Repel's 200, which must last to the last grass tile. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Common/Cpp/Exceptions.h" +#include "Common/Cpp/TestRunners/UnitTest.h" +#include "Pokemon/AutoStory/Pokemon_BuiltinStoryActions.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" +#include "PokemonFRLG_AutoStoryEvents.h" +#include "PokemonFRLG_AutoStoryFieldMoves.h" +#include "PokemonFRLG_AutoStoryItemUse.h" +#include "PokemonFRLG_AutoStoryRowSim.h" +#include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryStartMenu.h" +#include "PokemonFRLG_AutoStoryTable.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +namespace{ + +struct AutoStorySafariInput{ + std::string name; + std::function body; +}; + +struct AutoStorySafariExpectation{ +}; + +struct AutoStorySafariCase{ + AutoStorySafariInput input; + AutoStorySafariExpectation expectation; +}; + +class Test_AutoStorySafari : public UnitTest{ +public: + explicit Test_AutoStorySafari(AutoStorySafariCase 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: + AutoStorySafariCase m_case; +}; + +// The Safari Zone's step count (pokefirered SafariZoneTakeStep(): 600 at +// the entrance) and a Super Repel's (REPEL_STEP_COUNT for ITEM_SUPER_REPEL). +constexpr int SAFARI_STEPS = 600; +constexpr int SUPER_REPEL_STEPS = 200; + +const StoryCheckpoint& safari_row(){ + const std::vector& rows = story_checkpoints(); + const auto row = std::find_if(rows.begin(), rows.end(), [](const StoryCheckpoint& data){ return data.id == "11.03"; }); + if (row == rows.end()){ + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "No checkpoint 11.03."); + } + return *row; +} + +// The scene after the counter's YES: the script walks the player in and +// warps them to the center, where the table says. +bool warps_by_script(const StoryStep& step){ + return step.kind == StoryStepKind::MASH && step.pose_after.has_value(); +} + +bool on_grass(const MapPosition& position){ + for (const MapData& map : story_maps()){ + if (map.name == position.map){ + return map.tiles.at(position.point) == Pokemon::TileKind::TALL_GRASS; + } + } + return false; +} + +// The steps of the Safari Zone the program walks, in order from the +// center: for each, whether it is on tall grass. The Super Repel's use is +// where `repel_at` steps had been taken. +struct SafariWalk{ + std::vector grass; + std::optional repel_at; +}; + +// Each ROUTE and LEGS of 11.03 from the center on, planned or laid out as +// the program walks them (walked_route()), tile by tile. +std::optional safari_walk(std::string& failure){ + const StoryCheckpoint& row = safari_row(); + SafariWalk walk; + std::optional at; + for (const StoryStep& step : row.steps){ + if (warps_by_script(step)){ + at = story_pose(Pokemon::pose_of(*step.pose_after)); + continue; + } + if (!at){ + continue; + } + if (parse_use_item_step(step) == std::optional("super-repel")){ + walk.repel_at = walk.grass.size(); + continue; + } + if (parse_fly_step(step)){ + return walk; + } + if (step.kind != StoryStepKind::ROUTE && step.kind != StoryStepKind::LEGS){ + continue; + } + const std::optional> route = walked_route(*at, step); + if (!route){ + failure = "11.03/" + step.name + ": no route from " + to_string(MapPosition{at->map, at->tile}) + "."; + return std::nullopt; + } + MapPosition position{at->map, at->tile}; + for (const RouteStep& planned : *route){ + for (int tile = 1; tile <= planned.tiles; tile++){ + position.point = position.point.next(planned.direction); + if (tile == planned.tiles){ + position = planned.end; + } + walk.grass.push_back(on_grass(position)); + } + } + if (!route->empty()){ + at = StoryPose{route->back().end.map, route->back().end.point, route->back().facing_after}; + } + } + failure = "11.03: no Fly out of the Safari Zone."; + return std::nullopt; +} + +// 11.03 on the sim: in to the counter's trigger, then from the center the +// Safari Zone's areas to the Secret House and out, and the Fly to Fuchsia +// City, with no trainer seen and nothing in the way. +UnitTestResult test_safari(){ + const StoryCheckpoint& row = safari_row(); + StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); + auto sim = std::make_unique(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + for (const StoryStep& step : row.steps){ + if (warps_by_script(step)){ + const MapPosition trigger{"FuchsiaCity_SafariZone_Entrance", {4, 3}}; + if (!(sim->state().position == trigger)){ + return std::format("11.03: the counter's scene from {}, not its trigger {}.", to_string(sim->state().position), to_string(trigger)); + } + at = *story_pose(Pokemon::pose_of(*step.pose_after)); + sim = std::make_unique(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + continue; + } + if (const std::string failure = row_step_on_sim(*sim, at, step, row.id); !failure.empty()){ + return std::format("11.03: ended on {}; {}", to_string(sim->state().position), failure); + } + } + if (!sim->state().trainers_beaten.empty() || !sim->state().violations.empty()){ + return "11.03: a battle or a violation on the way."; + } + const MapPosition end{"FuchsiaCity", {25, 32}}; + if (!(sim->state().position == end)){ + return std::format("11.03: ended on {}, not {}.", to_string(sim->state().position), to_string(end)); + } + return true; +} + +// The way through the Safari Zone fits its 600 steps with a third to spare, +// and the one Super Repel, used before the first grass, lasts past the +// last: the lead outlevels every wild Pokemon there, so none shows. +UnitTestResult test_safari_steps(){ + std::string failure; + const std::optional walk = safari_walk(failure); + if (!walk){ + return failure; + } + if (!walk->repel_at){ + return "11.03: no Super Repel in the Safari Zone."; + } + const size_t steps = walk->grass.size(); + // A third left over: a re-anchor or a retried leg doesn't run it out. + if (steps > SAFARI_STEPS * 2 / 3){ + return std::format("11.03: {} steps in the Safari Zone; at most two thirds of its {}.", steps, SAFARI_STEPS); + } + for (size_t step = 0; step < *walk->repel_at; step++){ + if (walk->grass[step]){ + return std::format("11.03: grass on step {}, before the Super Repel (step {}).", step + 1, *walk->repel_at); + } + } + for (size_t step = *walk->repel_at + SUPER_REPEL_STEPS; step < steps; step++){ + if (walk->grass[step]){ + return std::format( + "11.03: grass on step {}, {} after the Super Repel; it lasts {}.", + step + 1, step - *walk->repel_at + 1, SUPER_REPEL_STEPS + ); + } + } + return true; +} + +// 11.03's Super Repel and Fly open the Safari Zone's START menu; the +// other rows' keep the full one. +UnitTestResult test_safari_menu(){ + if (start_menu_context(StartMenu::SAFARI) != StartMenuContext::SAFARI_ZONE + || start_menu_context(StartMenu::FULL) != StartMenuContext::STANDARD + || start_menu_context(StartMenu::BEFORE_POKEDEX) != StartMenuContext::NO_DEX + ){ + return "The START menus map to the wrong navigation contexts."; + } + for (const StoryCheckpoint& row : story_checkpoints()){ + for (const StoryStep& step : row.steps){ + const bool menu_step = parse_use_item_step(step).has_value() || parse_fly_step(step).has_value(); + if (!menu_step){ + continue; + } + const StartMenu expected = row.id == "11.03" ? StartMenu::SAFARI : StartMenu::FULL; + if (step_start_menu(step.args) != expected){ + return std::format("{}/{}: the wrong START menu.", row.id, step.name); + } + if (const std::optional fly = parse_fly_step(step); fly && fly->start_menu != expected){ + return std::format("{}/{}: the Fly's plan has the wrong START menu.", row.id, step.name); + } + } + } + return true; +} + +const AutoStorySafariCase AUTO_STORY_SAFARI_CASES[] = { + {.input = {"11.03 the Safari Zone to the Secret House, and Fly to Fuchsia", test_safari}, .expectation = {}}, + {.input = {"11.03 fits the Safari Zone's steps and the Super Repel's", test_safari_steps}, .expectation = {}}, + {.input = {"11.03 opens the Safari Zone's START menu", test_safari_menu}, .expectation = {}}, +}; + +} // namespace + + +void add_tests_AutoStorySafari(UnitTestDatabase& database){ + for (const auto& item : AUTO_STORY_SAFARI_CASES){ + database.add(item); + } +} + + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.h index 22d1ad5c1b..689eb1a3b6 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.h @@ -20,8 +20,10 @@ #include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h" #include "NintendoSwitch/NintendoSwitch_ConsoleHandle.h" #include "Pokemon/AutoStory/Pokemon_StoryStepExecutor.h" +#include "Pokemon/AutoStory/Types/Pokemon_StoryActionArg.h" #include "Pokemon/AutoStory/Types/Pokemon_StoryCheckLevel.h" #include "Pokemon/Navigation/Pokemon_Grid.h" +#include "VideoGames/PokemonFRLG/PokemonFRLG_Navigation.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -40,11 +42,15 @@ inline bool checks_screen(Pokemon::StoryCheckLevel level){ // The START menu as the story grows it. Before the starter: BAG, the // player, SAVE, OPTION, EXIT; the starter adds POKEMON on top, the Pokedex -// POKEDEX above that. +// POKEDEX above that. In the Safari Zone it is RETIRE, POKEDEX, POKEMON, +// BAG, the player, OPTION, EXIT, with no SAVE (pokefirered +// SetUpStartMenu_SafariZone()): a step there names it, a checkpoint never +// starts in it. enum class StartMenu{ BEFORE_POKEMON, BEFORE_POKEDEX, FULL, + SAFARI, }; // Total rows in the start menu. int start_menu_rows(StartMenu menu); @@ -53,6 +59,13 @@ int start_menu_save_row(StartMenu menu); // Row index of the OPTION item in the start menu. int start_menu_option_row(StartMenu menu); +// How open_party_menu_from_overworld() and open_bag_from_overworld() find +// POKEMON and BAG on `menu`. +StartMenuContext start_menu_context(StartMenu menu); +// The START menu a GAME step's `args` open: the Safari Zone's when its +// "safari" arg is true, else the full one. +StartMenu step_start_menu(const Pokemon::StoryActionArgs& args); + // Whether the overworld is up: START opens the menu only there, with no // scene running. If it opened, it is closed again. diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySummary.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySummary.cpp index 4748f8709c..4ba5e94cf7 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySummary.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySummary.cpp @@ -116,9 +116,7 @@ std::optional read_party_summary( if (menu == StartMenu::BEFORE_POKEMON){ return std::nullopt; } - open_party_menu_from_overworld( - console, context, menu == StartMenu::BEFORE_POKEDEX ? StartMenuContext::NO_DEX : StartMenuContext::STANDARD - ); + open_party_menu_from_overworld(console, context, start_menu_context(menu)); context.wait_for_all_requests(); // LEFT puts the cursor on the lead from any other slot (pokefirered // party_menu.c, MENU_DIR_LEFT); on the lead it does nothing. The menu 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 bd92ed21ef..892886227a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -282,8 +282,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() != 49 || checkpoints[0].start){ - return "Expected 49 checkpoints, the first from a new game."; + if (checkpoints.size() != 50 || checkpoints[0].start){ + return "Expected 50 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-11.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-11.03.plan.json new file mode 100644 index 0000000000..59aec1d803 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-11.03.plan.json @@ -0,0 +1,501 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "11.03", + "title": "The Safari Zone: the FULL RESTORE, the GOLD TEETH and HM03 SURF from the Secret House, and Fly back to Fuchsia City", + "start": { + "map": "FuchsiaCity", + "tiles": [ + [ + 24, + 6 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "count_full_restore_before", + "kind": "game_action", + "action": "count_items", + "args": { + "items": [ + "full-restore" + ] + }, + "why": "the Items pocket's FULL RESTOREs before the Safari Zone, where the START menu can't be trusted to the standard rows (RETIRE tops it): the one found there is confirmed against this count after the Fly back" + }, + { + "id": "below_safari_counter", + "kind": "route", + "action": "bike", + "args": { + "target": { + "map": "FuchsiaCity_SafariZone_Entrance", + "tiles": [ + [ + 4, + 4 + ] + ], + "facing": "north" + } + }, + "why": "in through the Safari Zone's door (24, 5), off the Bicycle indoors, and up to below the middle trigger (4, 3) (pokefirered FuchsiaCity_SafariZone_Entrance map.json)" + }, + { + "id": "safari_trigger", + "kind": "step", + "args": { + "direction": "north" + }, + "declared_after": { + "map": "FuchsiaCity_SafariZone_Entrance", + "tiles": [ + [ + 4, + 3 + ] + ], + "facing": "north" + }, + "why": "onto the middle trigger (4, 3), FuchsiaCity_SafariZone_Entrance_EventScript_EntryTriggerMid: \"Welcome to the SAFARI ZONE!\", the player turns right, and the money box opens" + }, + { + "id": "join_safari_game", + "kind": "answer", + "why": "YES to \"Would you like to join the hunt? That'll be 500 each\" (pokeguy pays 500, 5634 to 5134, 1:12:54..1:13:23); the party has a free slot or room in a box (CheckSpaceForMons)" + }, + { + "id": "thirty_safari_balls", + "kind": "scene", + "declared_after": { + "map": "SafariZone_Center", + "tiles": [ + [ + 26, + 30 + ] + ], + "facing": "north" + }, + "why": "\" received 30 SAFARI BALLS!\", the PA message, two steps up (EnterSafariZoneMid) and the script's warp to the Safari Zone's center (26, 30) (warp MAP_SAFARI_ZONE_CENTER, 255, 26, 30): the 600-step count starts there" + }, + { + "id": "center_to_east", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SafariZone_East", + "tiles": [ + [ + 9, + 27 + ] + ], + "facing": "east" + } + }, + "why": "pokeguy's eastern path: on foot through the center to its east exit (43, 15..17), on ground with no grass, into the east area (Area 1) at (8, 27)" + }, + { + "id": "ride_bike", + "kind": "game_action", + "action": "ride_bike", + "why": "on the BICYCLE with SELECT (registered in 08.03): the Safari Zone's areas allow it, and their edge warps keep a rider on it (allow_cycling)" + }, + { + "id": "before_east_grass", + "kind": "legs", + "action": "bike", + "args": { + "legs": [ + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 19 + } + ] + }, + "why": "along the east area's bottom row to (28, 28), the tile before its first grass (29, 28): the Super Repel's 200 steps start here, so they last to the north area's last grass (SafariZone_Tests' step count)" + }, + { + "id": "super_repel", + "kind": "game_action", + "action": "use_item", + "args": { + "item": "super-repel", + "safari": true + }, + "why": "pokeguy's one Super Repel in the Safari Zone (1:13:24..47, at 548 of 600 steps; Super Repels 6 to 5): the lead (Lv38) is above every Safari Zone wild Pokemon (Lv33 at most on land, pokefirered wild_encounters.json), so none shows for 200 steps; from the Safari menu (RETIRE, POKEDEX, POKEMON, BAG, ...)" + }, + { + "id": "to_full_restore", + "kind": "legs", + "action": "bike", + "args": { + "legs": [ + { + "direction": "east", + "tiles": 8 + }, + { + "direction": "north", + "tiles": 4 + }, + { + "direction": "west", + "tiles": 6 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "west", + "tiles": 6 + }, + { + "direction": "north", + "tiles": 15 + }, + { + "direction": "east", + "tiles": 8 + }, + { + "direction": "south", + "tiles": 3 + }, + { + "direction": "east", + "tiles": 4 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 1 + } + ] + }, + "why": "the shortest way round the east area's ledges and levels (pokefirered SafariZone_East map.json elevations) to below the FULL RESTORE's ball (37, 15), each leg a tile at a time on the Bicycle" + }, + { + "id": "below_full_restore", + "kind": "route", + "action": "bike", + "args": { + "target": { + "map": "SafariZone_East", + "tiles": [ + [ + 37, + 16 + ] + ], + "facing": "north" + } + }, + "why": "turned to the ball; the LEAF STONE (36, 17), TM11 (31, 18) and MAX POTION (13, 12) are left, as pokeguy leaves them" + }, + { + "id": "full_restore", + "kind": "talk", + "why": "pick up the FULL RESTORE (SafariZone_East_EventScript_ItemFullRestore; pokeguy 1:13:45..47)" + }, + { + "id": "to_north_area", + "kind": "legs", + "action": "bike", + "args": { + "legs": [ + { + "direction": "west", + "tiles": 1 + }, + { + "direction": "north", + "tiles": 2 + }, + { + "direction": "west", + "tiles": 1 + }, + { + "direction": "north", + "tiles": 6 + }, + { + "direction": "west", + "tiles": 14 + }, + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "west", + "tiles": 12 + } + ] + }, + "why": "west along the east area's top to (9, 9), beside its exit (8, 9)" + }, + { + "id": "into_north_area", + "kind": "route", + "action": "bike", + "args": { + "target": { + "map": "SafariZone_North", + "tiles": [ + [ + 48, + 31 + ] + ], + "facing": "west" + } + }, + "why": "through the exit into the north area (Area 2), arriving at (48, 31)" + }, + { + "id": "to_west_area", + "kind": "legs", + "action": "bike", + "args": { + "legs": [ + { + "direction": "west", + "tiles": 1 + }, + { + "direction": "north", + "tiles": 2 + }, + { + "direction": "west", + "tiles": 16 + }, + { + "direction": "north", + "tiles": 6 + }, + { + "direction": "west", + "tiles": 6 + }, + { + "direction": "south", + "tiles": 5 + }, + { + "direction": "west", + "tiles": 3 + }, + { + "direction": "north", + "tiles": 8 + }, + { + "direction": "east", + "tiles": 2 + }, + { + "direction": "north", + "tiles": 8 + }, + { + "direction": "east", + "tiles": 10 + }, + { + "direction": "north", + "tiles": 5 + }, + { + "direction": "west", + "tiles": 16 + }, + { + "direction": "south", + "tiles": 3 + }, + { + "direction": "west", + "tiles": 2 + }, + { + "direction": "south", + "tiles": 6 + }, + { + "direction": "west", + "tiles": 5 + }, + { + "direction": "south", + "tiles": 17 + } + ] + }, + "why": "the shortest way through the north area's levels with the least grass, its last grass (13..14, 9..10) the Super Repel's 193rd step, down column 11 to (11, 33), above its exit (11, 34); the PROTEIN, TM47 and QUICK CLAW are left" + }, + { + "id": "into_west_area", + "kind": "route", + "action": "bike", + "args": { + "target": { + "map": "SafariZone_West", + "tiles": [ + [ + 31, + 5 + ] + ], + "facing": "south" + } + }, + "why": "through the exit into the west area (Area 3), arriving at (31, 5)" + }, + { + "id": "to_gold_teeth", + "kind": "legs", + "action": "bike", + "args": { + "legs": [ + { + "direction": "south", + "tiles": 10 + }, + { + "direction": "west", + "tiles": 3 + } + ] + }, + "why": "down to below the GOLD TEETH's ball (28, 14) (pokeguy 1:14:07..09); the TM32, MAX POTION and MAX REVIVE are left" + }, + { + "id": "below_gold_teeth", + "kind": "route", + "action": "bike", + "args": { + "target": { + "map": "SafariZone_West", + "tiles": [ + [ + 28, + 15 + ] + ], + "facing": "north" + } + }, + "why": "turned to the ball" + }, + { + "id": "gold_teeth", + "kind": "talk", + "why": "pick up the GOLD TEETH (SafariZone_West_EventScript_ItemGoldTeeth), a key item for the Warden (14.01): its message confirms it, as the Items pocket has no row for it" + }, + { + "id": "below_secret_house_attendant", + "kind": "route", + "action": "bike", + "args": { + "target": { + "map": "SafariZone_SecretHouse", + "tiles": [ + [ + 6, + 6 + ] + ], + "facing": "north" + } + }, + "why": "west to the Secret House's door (12, 7), off the Bicycle indoors, and up to below the attendant (6, 5)" + }, + { + "id": "hm03_surf", + "kind": "talk", + "why": "the attendant: \"CONGRATULATIONS! You have found the SECRET HOUSE!\" and HM03 SURF (SafariZone_SecretHouse_EventScript_Attendant, FLAG_GOT_HM03), no YES/NO (pokeguy 1:14:15..21)" + }, + { + "id": "out_of_secret_house", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SafariZone_West", + "tiles": [ + [ + 12, + 8 + ] + ], + "facing": "south" + } + }, + "why": "out to below the Secret House's door, outdoors, where Fly works (MAP_TYPE_ROUTE)" + }, + { + "id": "fly_fuchsia", + "kind": "game_action", + "action": "fly", + "args": { + "town": "FuchsiaCity", + "species": "pidgey", + "safari": true + }, + "declared_after": { + "map": "FuchsiaCity", + "tiles": [ + [ + 25, + 32 + ] + ], + "facing": "south" + }, + "why": "the Pidgey flies out to Fuchsia City (pokeguy 1:14:22..37, rather than the steps running out or RETIRE), from the Safari menu, landing below the Pokemon Center's door; the Fly ends Safari mode" + }, + { + "id": "count_full_restore_after", + "kind": "game_action", + "action": "count_items", + "args": { + "items": [ + "full-restore" + ], + "found": true + }, + "why": "one more FULL RESTORE than before the Safari Zone: its ball was picked up" + } + ] + }, + "execution": { + "menu": "full", + "lead": "after_brock", + "notes": { + "checkpoint": [ + "From below the Safari Zone's door (11.02), pokeguy's Safari Zone (1:12:54 to 1:14:37): 500 for the game, the eastern path on foot, a Super Repel and the Bicycle, the FULL RESTORE, the GOLD TEETH, HM03 SURF from the Secret House, and Fly back to Fuchsia. No Safari Pokemon is caught, and the other item balls are left (pokefirered SafariZone_* map.json).", + "In the Safari Zone the START menu is RETIRE, POKEDEX, POKEMON, BAG, PLAYER, OPTION, EXIT (pokefirered SetUpStartMenu_SafariZone): the Super Repel and the Fly open it with the `safari` arg. There is no SAVE there, so the checkpoint ends after the Fly, saved in Fuchsia City.", + "Not measured on the console: the entrance's trigger and script timings, the Safari START menu's rows, and Fly from the Safari Zone (pokeguy flies; Overworld_ResetStateAfterFly clears Safari mode)." + ] + } + }, + "metadata": { + "phase": "testing" + } +} diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 941ebfd8a2..7bce49b289 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2105,6 +2105,7 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySlopeRun.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySlopeRun.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySlope_Tests.cpp + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySafari_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMartBuys.h From 7929a7ae75ab012e88f916e901da467dba3083bc Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 02:54:47 -0800 Subject: [PATCH 2/8] PokemonFRLG: the START menu's rows and contexts in their own file start_menu_rows() and the row helpers move unchanged from AutoStoryActions.cpp, with start_menu_context() and step_start_menu(), into AutoStoryStartMenu.cpp, next to their header; Actions.cpp was over its line limit. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG_AutoStoryActions.cpp | 39 ------------- .../PokemonFRLG_AutoStoryStartMenu.cpp | 55 +++++++++++++++++++ SerialPrograms/cmake/SourceFiles.cmake | 1 + 3 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.cpp diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp index b427679afc..850068b884 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryActions.cpp @@ -33,7 +33,6 @@ #include "VideoGames/PokemonFRLG/Programs/PokemonFRLG_NamingScreen.h" #include "VideoGames/PokemonFRLG/Programs/PokemonFRLG_StartMenuNavigation.h" #include "PokemonFRLG_AutoStoryActions.h" -#include "PokemonFRLG_AutoStoryGameArgs.h" #include "PokemonFRLG_AutoStoryGenderMenu.h" #include "PokemonFRLG_AutoStoryStepInterrupts.h" #include "PokemonFRLG_AutoStoryTrainerMessage.h" @@ -434,44 +433,6 @@ IntroNameStep intro_name_step(IntroNameScreen screen, size_t keyboards_seen, siz } -int start_menu_rows(StartMenu menu){ - switch (menu){ - case StartMenu::BEFORE_POKEMON: - return 5; - case StartMenu::BEFORE_POKEDEX: - return 6; - case StartMenu::FULL: - case StartMenu::SAFARI: - return 7; - } - return 7; -} -int start_menu_save_row(StartMenu menu){ - return start_menu_rows(menu) - 3; -} -int start_menu_option_row(StartMenu menu){ - return start_menu_rows(menu) - 2; -} - -StartMenuContext start_menu_context(StartMenu menu){ - switch (menu){ - case StartMenu::BEFORE_POKEDEX: - return StartMenuContext::NO_DEX; - case StartMenu::SAFARI: - return StartMenuContext::SAFARI_ZONE; - case StartMenu::BEFORE_POKEMON: - case StartMenu::FULL: - return StartMenuContext::STANDARD; - } - return StartMenuContext::STANDARD; -} - -StartMenu step_start_menu(const Pokemon::StoryActionArgs& args){ - const bool* safari = game_arg(args, "safari"); - return safari != nullptr && *safari ? StartMenu::SAFARI : StartMenu::FULL; -} - - std::optional yes_no_cursor(const ImageViewRGB32& screen){ // The box's white right of NO (x 196-212, y 92-102 on the 240x160 // screen). Without it the arrow alone matches the dark edge of a rock diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.cpp new file mode 100644 index 0000000000..892c91f620 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.cpp @@ -0,0 +1,55 @@ +/* AutoStory Start Menu + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include "PokemonFRLG_AutoStoryGameArgs.h" +#include "PokemonFRLG_AutoStoryStartMenu.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +int start_menu_rows(StartMenu menu){ + switch (menu){ + case StartMenu::BEFORE_POKEMON: + return 5; + case StartMenu::BEFORE_POKEDEX: + return 6; + case StartMenu::FULL: + case StartMenu::SAFARI: + return 7; + } + return 7; +} +int start_menu_save_row(StartMenu menu){ + return start_menu_rows(menu) - 3; +} +int start_menu_option_row(StartMenu menu){ + return start_menu_rows(menu) - 2; +} + +StartMenuContext start_menu_context(StartMenu menu){ + switch (menu){ + case StartMenu::BEFORE_POKEDEX: + return StartMenuContext::NO_DEX; + case StartMenu::SAFARI: + return StartMenuContext::SAFARI_ZONE; + case StartMenu::BEFORE_POKEMON: + case StartMenu::FULL: + return StartMenuContext::STANDARD; + } + return StartMenuContext::STANDARD; +} + +StartMenu step_start_menu(const Pokemon::StoryActionArgs& args){ + const bool* safari = game_arg(args, "safari"); + return safari != nullptr && *safari ? StartMenu::SAFARI : StartMenu::FULL; +} + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 7bce49b289..5c29e705c5 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2164,6 +2164,7 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaveChecks.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartFrameCompare.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartFrameStore.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStartMenu.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySummary.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySummary.h From e462f7632086f511afb4aa5ea3b0cb18a474d937 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 08:22:30 -0800 Subject: [PATCH 3/8] PokemonFRLG AutoStory: 11.03's item and attendant approaches end on their tiles The approach check (the walk before an A press ends on its tile) found three 11.03 approaches ending on held open legs: - FULL RESTORE: "east 4" along the east area's row 14 was open at (37, 14). Now held east to the wall (39, 14), south to (38, 16) above the level 4 ground, and a tile west to (37, 16). - GOLD TEETH: "south 10" and "west 3" were open. Now south 11, west to the wall (26, 16), a tile east and a tile north into the ball (28, 14), ending on (28, 15) facing it; the turn step goes. - Secret House attendant: "east 2" along row 6 was open at (7, 6). The route now ends on the door's arrival (4, 9), and a tapped walk goes north 1, east 2 and north 2 to (6, 6), facing him (as 10.06's Mr. Fuji). Golden: 11.03 below_full_restore starts facing west; below_gold_teeth leaves the route plans (now legs); into_secret_house ends at (4, 9). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG_AutoStoryPlanGolden11.h | 9 +-- .../AutoStory/StoryData/frlg-11.03.plan.json | 70 +++++++++++-------- 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h index 1dc0b2eefa..a76c3f860c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h @@ -63,22 +63,17 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_11[] = { "11.03 walk east 2 (warp) -> SafariZone_East (8, 26)", "11.03 walk south 1 (to wall) -> SafariZone_East (8, 27)", "11.03 walk east 1 -> SafariZone_East (9, 27)", - "11.03 below_full_restore from SafariZone_East (37, 16) facing east to SafariZone_East (37, 16) facing north", + "11.03 below_full_restore from SafariZone_East (37, 16) facing west to SafariZone_East (37, 16) facing north", "11.03 face north -> SafariZone_East (37, 16)", "11.03 into_north_area from SafariZone_East (9, 9) facing west to SafariZone_North (48, 31) facing west", "11.03 walk west 2 (warp) -> SafariZone_North (48, 31)", "11.03 into_west_area from SafariZone_North (11, 33) facing south to SafariZone_West (31, 5) facing south", "11.03 walk south 2 (warp) -> SafariZone_West (31, 5)", - "11.03 below_gold_teeth from SafariZone_West (28, 15) facing west to SafariZone_West (28, 15) facing north", - "11.03 face north -> SafariZone_West (28, 15)", - "11.03 below_secret_house_attendant from SafariZone_West (28, 15) facing north to SafariZone_SecretHouse (6, 6) facing north", + "11.03 into_secret_house from SafariZone_West (28, 15) facing north to SafariZone_SecretHouse (4, 9) facing north", "11.03 walk west 1 (to wall) -> SafariZone_West (27, 15)", "11.03 walk north 5 -> SafariZone_West (27, 10)", "11.03 walk west 15 -> SafariZone_West (12, 10)", "11.03 walk north 3 (warp) -> SafariZone_SecretHouse (4, 9)", - "11.03 walk north 3 (to wall) -> SafariZone_SecretHouse (4, 6) [walk only]", - "11.03 walk east 2 -> SafariZone_SecretHouse (6, 6) [walk only]", - "11.03 face north -> SafariZone_SecretHouse (6, 6) [walk only]", "11.03 out_of_secret_house from SafariZone_SecretHouse (6, 6) facing north to SafariZone_West (12, 8) facing south", "11.03 walk west 2 -> SafariZone_SecretHouse (4, 6) [walk only]", "11.03 walk south 4 (warp) -> SafariZone_West (12, 8) [walk only]", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-11.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-11.03.plan.json index 59aec1d803..e80e07e4fa 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-11.03.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-11.03.plan.json @@ -174,19 +174,19 @@ }, { "direction": "east", - "tiles": 4 + "tiles": 6 }, { "direction": "south", "tiles": 2 }, { - "direction": "east", + "direction": "west", "tiles": 1 } ] }, - "why": "the shortest way round the east area's ledges and levels (pokefirered SafariZone_East map.json elevations) to below the FULL RESTORE's ball (37, 15), each leg a tile at a time on the Bicycle" + "why": "the shortest way round the east area's ledges and levels (pokefirered SafariZone_East map.json elevations) to below the FULL RESTORE's ball (37, 15), on the Bicycle. An approach to an A press ends on its tile: held east along row 14 to the wall (39, 14) at (38, 14), south to (38, 16) above the level 4 ground (38, 17), and a tile west; held, \"east 4\" was open at (37, 14)" }, { "id": "below_full_restore", @@ -368,40 +368,30 @@ "why": "through the exit into the west area (Area 3), arriving at (31, 5)" }, { - "id": "to_gold_teeth", + "id": "below_gold_teeth", "kind": "legs", "action": "bike", "args": { "legs": [ { "direction": "south", - "tiles": 10 + "tiles": 11 }, { "direction": "west", - "tiles": 3 + "tiles": 4 + }, + { + "direction": "east", + "tiles": 1 + }, + { + "direction": "north", + "tiles": 1 } ] }, - "why": "down to below the GOLD TEETH's ball (28, 14) (pokeguy 1:14:07..09); the TM32, MAX POTION and MAX REVIVE are left" - }, - { - "id": "below_gold_teeth", - "kind": "route", - "action": "bike", - "args": { - "target": { - "map": "SafariZone_West", - "tiles": [ - [ - 28, - 15 - ] - ], - "facing": "north" - } - }, - "why": "turned to the ball" + "why": "down to below the GOLD TEETH's ball (28, 14) (pokeguy 1:14:07..09), the TM32, MAX POTION and MAX REVIVE left: west along row 16 to the wall (26, 16), a tile east, and up into the ball. An approach to an A press ends on its tile: held, \"south 10\" and \"west 3\" were open at (31, 16) and (27, 15)" }, { "id": "gold_teeth", @@ -409,7 +399,7 @@ "why": "pick up the GOLD TEETH (SafariZone_West_EventScript_ItemGoldTeeth), a key item for the Warden (14.01): its message confirms it, as the Items pocket has no row for it" }, { - "id": "below_secret_house_attendant", + "id": "into_secret_house", "kind": "route", "action": "bike", "args": { @@ -417,14 +407,36 @@ "map": "SafariZone_SecretHouse", "tiles": [ [ - 6, - 6 + 4, + 9 ] ], "facing": "north" } }, - "why": "west to the Secret House's door (12, 7), off the Bicycle indoors, and up to below the attendant (6, 5)" + "why": "west to the Secret House's door (12, 7), off the Bicycle indoors, arriving at (4, 9)" + }, + { + "id": "below_secret_house_attendant", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "north", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 2 + }, + { + "direction": "north", + "tiles": 2 + } + ] + }, + "why": "a tap a tile from the door (4, 9) up to below the attendant (6, 5): (6, 6), facing him. An approach to an A press ends on its tile: held, \"east 2\" along row 6 is open at (7, 6)" }, { "id": "hm03_surf", From fd918b4c1e84a43737d0053900e81730b0a347c2 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 09:14:47 -0800 Subject: [PATCH 4/8] PokemonFRLG overworld: RouteStep::sign_ahead, sim long holds, Safari Zone West sign tests (red) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_OverworldRoute.cpp | 11 ++++- .../PokemonFRLG_OverworldRouteSteps.h | 5 ++ .../Overworld/PokemonFRLG_OverworldSim.cpp | 8 +++- .../Overworld/PokemonFRLG_OverworldSim.h | 5 ++ .../Overworld/PokemonFRLG_OverworldSimState.h | 4 ++ .../PokemonFRLG_OverworldSim_Tests.cpp | 47 +++++++++++++++++++ 6 files changed, 77 insertions(+), 3 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp index 7c8911964b..bb913812a8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp @@ -218,6 +218,14 @@ bool warps_off_loaded_maps(const std::vector& maps, const Located& play return warp != nullptr && !take_warp(maps, warp); } +// Whether holding `direction` from `here` reads a sign: one walked into +// moving north or south shows its message (pokefirered +// TrySetUpWalkIntoSignpostScript()). +bool reads_sign_ahead(const MapData& map, TilePos here, Direction direction){ + return tile_at(map, here.next(direction)) == TileKind::SIGN + && (direction == Direction::NORTH || direction == Direction::SOUTH); +} + // Whether holding `direction` stops the player where they are: a wall, or // water they'd need to Surf onto. A leg that ends there can be // held for longer than it takes, and walked again after an interruption. A @@ -239,7 +247,7 @@ bool stops_at(const std::vector& maps, const Located& player, Direction // Held into a sign moving north or south, the game shows the sign's // message: the player stops, but the walk is interrupted (console B, // 2026-11-01, the poster on the bedroom's wall). - if (tile_at(map, ahead) == TileKind::SIGN && (direction == Direction::NORTH || direction == Direction::SOUTH)){ + if (reads_sign_ahead(map, player.state.position, direction)){ return false; } // Held into a ledge the way it faces, the player hops down it (console @@ -427,6 +435,7 @@ RouteStep to_route_step(const std::vector& maps, const Pokemon::Leg tiles = leg_tiles(maps, MapPosition{maps[leg.start.map].name, leg.start.state.position}, step); for (int c : std::views::iota(1, (int)tiles.size()) | std::views::filter([&](int n){ return tiles[n].map != tiles[n - 1].map; })){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteSteps.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteSteps.h index 73dcacaff7..3f4d90bea7 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteSteps.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteSteps.h @@ -72,6 +72,11 @@ struct RouteStep{ // tall grass or water. Elsewhere (indoors, streets) no wild battle can // start, so the walker doesn't watch for one. bool wild = false; + // WALK, open, north or south: the tile past the end is a sign. A hold + // that runs on reads it, so a message after the hold, not a battle, + // leaves the player on the end (console B, 2026-11-12, 11.03: "north 5" + // to Safari Zone West's (27, 10), below the sign on (27, 9)). + bool sign_ahead = false; // WALK: the steps (from 1) onto a connected map. The game holds the // player up a tile before each while it loads the map: a hold timed // by the tiles alone ended a tile short (console B, 2026-11-03, rows diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp index a89e0feee0..96d07b3d6f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp @@ -552,7 +552,9 @@ std::optional OverworldSim::hold( m_last_tap.reset(); }else{ const auto short_hold = m_script.short_holds.find(m_holds); - walk_hold(direction, duration, short_hold == m_script.short_holds.end() ? 0 : short_hold->second); + const auto long_hold = m_script.long_holds.find(m_holds); + const Milliseconds over = long_hold == m_script.long_holds.end() ? Milliseconds(0) : tile_time() * long_hold->second; + walk_hold(direction, duration + over, short_hold == m_script.short_holds.end() ? 0 : short_hold->second); } return watch_until(watchers, start, start + std::max(duration + release, watch)); } @@ -920,8 +922,10 @@ std::optional OverworldSimWalker::late_stop(const RouteStep& step){ return std::nullopt; } const WallClock start = sim_wall_clock(m_leg_start); + RouteStep placed = step; + placed.sign_ahead = step.sign_ahead && m_rules.place_by_sign; const LateStop stop = place_late_stop( - step, TILE_TIME, screen_event_log(m_sim.state(), m_leg_start), start, sim_wall_clock(m_sim.state().time) + placed, TILE_TIME, screen_event_log(m_sim.state(), m_leg_start), start, sim_wall_clock(m_sim.state().time) ); m_log.push_back(late_stop_line(step, stop, start)); return m_leg_dark ? std::optional(dark_stop(step, whole_leg(step))) : stop.walked; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h index a4643322f8..2a4c86864d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h @@ -301,6 +301,11 @@ struct SimWalkerRules{ // player may be anywhere on the leg: on Route 10, "east 11" was found // again from all 12 of its tiles (console B, 2026-11-09, 07.02 run 2). bool place_late_battle = true; + // A message after the hold of an open leg that ends below a sign + // (RouteStep::sign_ahead) places the player on its end. Without it + // the walker found the player at walls and held the same leg into the + // sign 9 times (console B, 2026-11-12, 11.03, Safari Zone West). + bool place_by_sign = true; // The watch for a warp's fade starts with the hold onto the warp // (Pokemon::WatchAlong), not when it ends. Without it a fade over // before the hold ended was missed, and the walk stopped on "no fade in diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h index e3b0caa11e..e985f46736 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h @@ -34,6 +34,10 @@ struct SimScript{ // The hold numbered by the key (from 1) stops this many tiles short, // with nothing on screen (the forest drift, console B, 2026-11-01). std::map short_holds; + // The hold numbered by the key (from 1) runs on this many tiles past + // its time: on the Bicycle, "north 5" to Safari Zone West's (27, 10) + // read the sign above it (console B, 2026-11-12, 11.03). + std::map long_holds; // Maps where every step can start a wild battle, also on tiles the maps // don't mark as grass: Mt. Moon B2F's tiles closed on one side ('8') // are cave floor too (console B, 2026-11-03). diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp index cc44afbe98..fc96e23d82 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp @@ -463,6 +463,51 @@ UnitTestResult test_short_leg_then_sign(){ return true; } +// 11.03 run 1 (console B, 2026-11-12), Safari Zone West: from the GOLD +// TEETH's tile (28, 15) to the Secret House, "north 5" ended below the sign +// on (27, 9), and its hold ran on into it: the sign spoke, and the walker, +// finding the player at walls, held the same leg into it 9 times. The plan +// now turns west a row lower, where no sign is ahead. +UnitTestResult test_safari_west_sign_route(){ + SimCase c{.start = at("SafariZone_West", 28, 15), .facing = Direction::NORTH, .goal = at("SafariZone_SecretHouse", 4, 9)}; + const std::vector route = planned(c); + for (const RouteStep& step : route){ + if (step.sign_ahead){ + return "Expected no open leg ending below a sign:" + describe(route); + } + } + const SimRun now = run_case(c); + if (!arrived(now, c.goal) || now.state.signs_read != 0){ + return "Expected the Secret House reached with no sign read:" + describe(now); + } + return true; +} + +// As above, to the tile below the sign itself, (27, 10): the hold runs +// on and the sign speaks. The message places the player on the leg's end; +// without that, they are found again at walls and the same leg is held +// into the sign until the walk gives up. +UnitTestResult test_safari_west_sign_read(){ + SimCase c{.start = at("SafariZone_West", 27, 15), .facing = Direction::NORTH, .goal = at("SafariZone_West", 27, 10)}; + const std::vector route = planned(c); + if (route.size() != 1 || !route[0].sign_ahead){ + return "Expected one open leg north, ending below the sign:" + describe(route); + } + c.script.long_holds = {{1, 1}}; + const SimRun now = run_case(c); + if (!arrived(now, c.goal) || now.state.signs_read != 1){ + return "Expected the sign read once and the player placed below it:" + describe(now); + } + SimCase unplaced = c; + unplaced.script.long_holds = {{1, 1}, {3, 1}, {5, 1}, {7, 1}, {9, 1}, {11, 1}}; + unplaced.rules.place_by_sign = false; + const SimRun old = run_case(unplaced); + if (old.failure.empty() || old.state.signs_read < 2){ + return "Expected the sign read again and the walk failed without the rule:" + describe(old); + } + return true; +} + // r16 (console B, 2026-11-01), Viridian Forest, a tile short instead of 2: // the hold south from (8, 28) misses the sign and stops at the wall a // column east of the plan's, with nothing on screen, so the walk was @@ -963,6 +1008,8 @@ const OverworldSimCase OVERWORLD_SIM_CASES[] = { {.input = {"no hold over a ledge", test_no_hold_over_ledge}, .expectation = {},}, {.input = {"a short leg, then a sign", test_short_leg_then_sign}, .expectation = {},}, {.input = {"a short leg, nothing seen", test_short_leg_unseen}, .expectation = {},}, + {.input = {"Safari Zone West: no leg ends below the sign", test_safari_west_sign_route}, .expectation = {},}, + {.input = {"Safari Zone West: a hold run on into the sign", test_safari_west_sign_read}, .expectation = {},}, {.input = {"a trainer on the way out of Pewter Gym", test_trainer_on_way_out}, .expectation = {},}, {.input = {"out of Viridian Mart from the clerk's scene", test_mart_exit}, .expectation = {},}, {.input = {"Mt. Moon: down the ladders to B2F", test_mt_moon_ladders}, .expectation = {},}, From 9d6bd73720916d011997de83dbdd897925fe3ec7 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 09:20:09 -0800 Subject: [PATCH 5/8] PokemonFRLG overworld: no open leg ends facing a sign; a sign's message places the player 11.03 run 1 (console B, 2026-11-12): into_secret_house's "north 5" to Safari Zone West (27, 10) ran on into the sign on (27, 9); its message left the player unplaced, and the same leg was held into the sign 9 times. The planner now costs an open north/south leg ending at a sign (RouteCost::SIGN_OVERSHOOT, 3), so the route turns west a row lower; a message after such a leg places the player on its end. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_OverworldLateBattle.cpp | 5 +++++ .../Overworld/PokemonFRLG_OverworldLateBattle.h | 3 ++- .../PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp | 4 ++++ .../Overworld/PokemonFRLG_OverworldRouteCosts.h | 8 +++++++- .../Overworld/PokemonFRLG_OverworldSim_Tests.cpp | 6 ++++-- .../AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h | 6 +++--- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.cpp index 976d1a0c85..8ccaabd823 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.cpp @@ -38,6 +38,11 @@ LateStop place_late_stop( ){ LateStop out; out.verdict = Pokemon::classify_interrupt(log, {hold_start, now}, {}); + if (out.verdict.kind == Pokemon::InterruptKind::DIALOG && step.sign_ahead){ + // The sign past the end: only a hold run on from there reads it. + out.walked = WalkedTiles{.min = step.tiles, .max = step.tiles}; + return out; + } if (out.verdict.kind != Pokemon::InterruptKind::WILD_ENCOUNTER){ return out; } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.h index b2e7634965..f64cd3cc10 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldLateBattle.h @@ -45,7 +45,8 @@ int tile_reached(Milliseconds since_hold, Milliseconds tile_time, int tiles); struct LateStop{ Pokemon::InterruptVerdict verdict; // The tiles of the leg the player may be on. Set for a wild battle - // whose step the log times. + // whose step the log times, and for a message after a leg that ends + // below a sign (RouteStep::sign_ahead): its end. std::optional walked; }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp index bb913812a8..4f809df56d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp @@ -33,6 +33,7 @@ const RouteCosts& default_route_costs(){ {RouteCost::OPEN_WILD_STOP, 300}, {RouteCost::SIGHT_TILE, 0}, {RouteCost::SIGHT_OVERSHOOT, 0}, + {RouteCost::SIGN_OVERSHOOT, 3}, }; return COSTS; } @@ -322,6 +323,9 @@ class StepModel{ return stops_at(m_maps, state, direction); } int open_stop_risk(const State& state, Direction direction) const{ + if (reads_sign_ahead(m_maps[state.map], state.state.position, direction)){ + return route_cost(m_costs, RouteCost::SIGN_OVERSHOOT); + } const std::optional past = PokemonFRLG::press(m_maps, state, direction); if (!past || !seen_by_trainer(past->next)){ return 0; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h index 08d7038260..72e7daad3d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h @@ -49,12 +49,18 @@ enum class RouteCost{ // to (19, 6), in the Grunt's line). Below SIGHT_TILE: it takes a // missed stop to cost the battle. SIGHT_OVERSHOOT, + // Extra for an open leg north or south that ends below or above a + // sign: a hold that runs on reads it, and the walk is interrupted + // (console B, 2026-11-12, 11.03: "north 5" to Safari Zone West's + // (27, 10) on the Bicycle). A tie-break more than a detour. + SIGN_OVERSHOOT, }; // Cost mapping table for path planning. using RouteCosts = std::map; // TILE 1, TURN 2, WARP 30, SURF 40, GRASS_TILE 20, OPEN_STOP 8, -// OPEN_WILD_STOP 300, SIGHT_TILE 0, SIGHT_OVERSHOOT 0. The sight costs are +// OPEN_WILD_STOP 300, SIGHT_TILE 0, SIGHT_OVERSHOOT 0, SIGN_OVERSHOOT 3. +// The sight costs are // off by default until beaten trainers and battles a story step wants are // told apart: at 100 and 10 they moved Pewter City's and Pewter Gym's // plans (the Gym's Camper is fought on the way to Brock). diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp index fc96e23d82..b47e21f6d1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim_Tests.cpp @@ -493,13 +493,15 @@ UnitTestResult test_safari_west_sign_read(){ if (route.size() != 1 || !route[0].sign_ahead){ return "Expected one open leg north, ending below the sign:" + describe(route); } - c.script.long_holds = {{1, 1}}; + // On the console every hold ran on. + for (int hold = 1; hold <= 30; hold++){ + c.script.long_holds[hold] = 1; + } const SimRun now = run_case(c); if (!arrived(now, c.goal) || now.state.signs_read != 1){ return "Expected the sign read once and the player placed below it:" + describe(now); } SimCase unplaced = c; - unplaced.script.long_holds = {{1, 1}, {3, 1}, {5, 1}, {7, 1}, {9, 1}, {11, 1}}; unplaced.rules.place_by_sign = false; const SimRun old = run_case(unplaced); if (old.failure.empty() || old.state.signs_read < 2){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h index a76c3f860c..5fbe7e8f29 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h @@ -71,9 +71,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_11[] = { "11.03 walk south 2 (warp) -> SafariZone_West (31, 5)", "11.03 into_secret_house from SafariZone_West (28, 15) facing north to SafariZone_SecretHouse (4, 9) facing north", "11.03 walk west 1 (to wall) -> SafariZone_West (27, 15)", - "11.03 walk north 5 -> SafariZone_West (27, 10)", - "11.03 walk west 15 -> SafariZone_West (12, 10)", - "11.03 walk north 3 (warp) -> SafariZone_SecretHouse (4, 9)", + "11.03 walk north 4 -> SafariZone_West (27, 11)", + "11.03 walk west 15 -> SafariZone_West (12, 11)", + "11.03 walk north 4 (warp) -> SafariZone_SecretHouse (4, 9)", "11.03 out_of_secret_house from SafariZone_SecretHouse (6, 6) facing north to SafariZone_West (12, 8) facing south", "11.03 walk west 2 -> SafariZone_SecretHouse (4, 6) [walk only]", "11.03 walk south 4 (warp) -> SafariZone_West (12, 8) [walk only]", From 9a320bf0d086afee5065b8ad41a12a3f9eddb3e1 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 09:43:23 -0800 Subject: [PATCH 6/8] FRLG ItemListReader: tests that plans' items have names (red) 11.03 counted FULL RESTOREs with a reader that had no name for them: the row matched several names, read as nothing, and the count after the Safari Zone was 0 (console B, 2026-11-12). item_list_reader_knows() names the reader's slugs; a test checks every item a plan buys, uses or counts, and the MOON STONE and NUGGET, against it, and a matcher test reads FULL RESTORE, SUPER POTION, MOON STONE and NUGGET. Both fail here. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Menus/PokemonFRLG_ItemListReader.cpp | 91 ++++++++++++++----- .../Menus/PokemonFRLG_ItemListReader.h | 5 + .../PokemonFRLG_AutoStoryItems_Tests.cpp | 78 ++++++++++++++++ 3 files changed, 151 insertions(+), 23 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp index 74b8907a9c..8f1bacae96 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp @@ -6,8 +6,10 @@ #include #include +#include #include #include +#include #include "Common/Cpp/Filesystem/Filesystem.h" #include "Common/Cpp/Json/JsonArray.h" #include "Common/Cpp/Json/JsonObject.h" @@ -38,6 +40,31 @@ constexpr double ROW_TOP = 11; constexpr double ROW_STEP = 16; constexpr double ROW_HEIGHT = 12; +// Each item's slug and its English name. +constexpr std::pair ENGLISH_ITEM_NAMES[] = { + {"potion", "Potion"}, + {"antidote", "Antidote"}, + {"parlyz-heal", "Parlyz Heal"}, + {"awakening", "Awakening"}, + {"poke-ball", "Poke Ball"}, + {"repel", "Repel"}, + {"super-repel", "Super Repel"}, + {"max-repel", "Max Repel"}, + {"escape-rope", "Escape Rope"}, + {"x-special", "X Special"}, + {"x-speed", "X Speed"}, + {"x-accuracy", "X Accuracy"}, + {"guard-spec", "Guard Spec."}, + {"bicycle", "Bicycle"}, + // Route 17's hidden items. Without them a RARE CANDY read + // "FARE CANCY" and matched CANCEL: the pocket's read ended + // above it, and 11.02 counted no RARE CANDY in a bag with 2 + // (console B, 2026-11-12). + {"rare-candy", "Rare Candy"}, + {"max-elixir", "Max Elixir"}, + {"cancel", "Cancel"}, +}; + class ItemNameMatcher : public OCR::SmallDictionaryMatcher{ public: static constexpr double MAX_LOG10P = -1.40; @@ -76,29 +103,7 @@ class ItemNameMatcher : public OCR::SmallDictionaryMatcher{ static JsonObject dictionary(){ JsonObject english; - for (const auto& [slug, name] : { - std::pair{"potion", "Potion"}, - {"antidote", "Antidote"}, - {"parlyz-heal", "Parlyz Heal"}, - {"awakening", "Awakening"}, - {"poke-ball", "Poke Ball"}, - {"repel", "Repel"}, - {"super-repel", "Super Repel"}, - {"max-repel", "Max Repel"}, - {"escape-rope", "Escape Rope"}, - {"x-special", "X Special"}, - {"x-speed", "X Speed"}, - {"x-accuracy", "X Accuracy"}, - {"guard-spec", "Guard Spec."}, - {"bicycle", "Bicycle"}, - // Route 17's hidden items. Without them a RARE CANDY read - // "FARE CANCY" and matched CANCEL: the pocket's read ended - // above it, and 11.02 counted no RARE CANDY in a bag with 2 - // (console B, 2026-11-12). - {"rare-candy", "Rare Candy"}, - {"max-elixir", "Max Elixir"}, - {"cancel", "Cancel"}, - }){ + for (const auto& [slug, name] : ENGLISH_ITEM_NAMES){ JsonArray names; names.push_back(std::string(name)); english[std::string(slug)] = std::move(names); @@ -139,6 +144,12 @@ std::string read_item_list_name(Logger& logger, Language language, const ImageVi return ItemNameMatcher::instance().read(logger, language, extract_box_reference(game_box(screen), item_list_name_box(row))); } +bool item_list_reader_knows(std::string_view item){ + return std::any_of(std::begin(ENGLISH_ITEM_NAMES), std::end(ENGLISH_ITEM_NAMES), [&](const auto& entry){ + return entry.first == item; + }); +} + BagRow read_bag_row(Logger& logger, Language language, const ImageViewRGB32& screen, int shown){ std::string item = read_item_list_name(logger, language, screen, shown); const ImageViewRGB32 count = extract_box_reference(game_box(screen), bag_item_count_box(shown)); @@ -242,6 +253,39 @@ class Test_Route17ItemNames : public UnitTest{ } }; +// 11.03's count (console B, 2026-11-12): the FULL RESTORE's row matched +// several names with no Full Restore in the dictionary, read as nothing, +// and the count saw 0 after the Safari Zone's ball was picked up. The +// other names the story counts or buys, and those it keeps rows for, +// are each read as themselves, and the shorter names they contain stay +// apart. +class Test_StoryItemNames : public UnitTest{ +public: + Test_StoryItemNames() + : UnitTest("PokemonFRLG::ItemListReader - 11.03 the FULL RESTORE's row is read") + {} + + virtual UnitTestResult run(Logger&, CancellableScope&) const override{ + const ItemNameMatcher& matcher = ItemNameMatcher::instance(); + for (const auto& [text, expected] : { + std::pair{"FULL RESTORE", "full-restore"}, + {"SUPER POTION", "super-potion"}, + {"MOON STONE", "moon-stone"}, + {"NUGGET", "nugget"}, + {"POTION", "potion"}, + {"REPEL", "repel"}, + {"SUPER REPEL", "super-repel"}, + {"MAX REPEL", "max-repel"}, + }){ + const std::string item = matcher.match(Language::English, std::string(text)); + if (item != expected){ + return std::format("Expected \"{}\" read as {}, got \"{}\".", text, expected, item); + } + } + return true; + } +}; + // A capture of a Mart's BUY list, read from the top to its CANCEL. Its // golden file holds each row's item, one per line. class Test_MartList : public ImageUnitTest{ @@ -285,6 +329,7 @@ void add_tests_ItemListReader(UnitTestDatabase& database){ // The Viridian Mart's BUY list, the same day, the cursor on POTION. database.add("PokemonFRLG/ItemListReader/MartBuyList_eng.png"); database.add(); + database.add(); } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h index 1b9c63a277..1fc5e770b1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h @@ -14,6 +14,7 @@ #define PokemonAutomation_PokemonFRLG_ItemListReader_H #include +#include #include #include "Common/Cpp/Logging/AbstractLogger.h" #include "Common/Cpp/TestRunners/UnitTestDatabase.h" @@ -40,6 +41,10 @@ ImageFloatBox item_list_name_box(int row); // reader has no names for. std::string read_item_list_name(Logger& logger, Language language, const ImageViewRGB32& screen, int row); +// Whether read_item_list_name() has a name for `item`, a slug as it gives +// them, in English. +bool item_list_reader_knows(std::string_view item); + // A single item entry in the bag pocket. struct BagRow{ // The item's slug, as read_item_list_name() gives it; empty if its name diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp index d587034b75..5a510ec55a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "Common/Cpp/Color.h" #include "Common/Cpp/Exceptions.h" @@ -28,13 +29,19 @@ #include "Tests/TestUtils.h" #include "VideoGames/PokemonFRLG/Inference/PokemonFRLG_BattleHpBarReader.h" #include "VideoGames/PokemonFRLG/Inference/PokemonFRLG_BattleScreenDetector.h" +#include "VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h" #include "VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" #include "PokemonFRLG_AutoStoryActions.h" #include "PokemonFRLG_AutoStoryBattle.h" #include "PokemonFRLG_AutoStoryBattleDecisions.h" +#include "PokemonFRLG_AutoStoryItemUse.h" +#include "PokemonFRLG_AutoStoryMartPlan.h" #include "PokemonFRLG_AutoStoryNewMembers.h" +#include "PokemonFRLG_AutoStorySlopeRun.h" +#include "PokemonFRLG_AutoStoryTable.h" +#include "PokemonFRLG_AutoStoryViridianMart.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -303,6 +310,73 @@ UnitTestResult test_unread_language(Logger& logger){ return true; } +// The step's arg `key`, if it has one of type `Type`. +template +const Type* step_arg(const StoryStep& step, std::string_view key){ + const auto found = step.args.find(key); + return found == step.args.end() ? nullptr : std::get_if(&found->second); +} + +// The items a step finds in the bag or in a Mart's list by name: those it +// buys, uses or counts. Nothing for a step that reads no item's name. +std::vector items_read_by(const StoryStep& step){ + std::vector items; + if (step.kind == StoryStepKind::SHOP){ + if (const auto* lines = step_arg>(step, "items")){ + for (const MartOrder& order : viridian_mart_orders(*lines).value_or(std::vector())){ + items.emplace_back(order.item); + } + } + }else if (step.action == MART_ACTION){ + if (const std::optional plan = mart_plan_of(step.args)){ + for (const MartLine& line : plan->lines){ + items.push_back(line.item); + } + } + }else if (step.action == USE_ITEM_VARIANT){ + if (const auto* item = step_arg(step, "item")){ + items.push_back(*item); + } + }else if (step.action == COUNT_ITEMS_VARIANT){ + if (const auto* counted = step_arg>(step, "items")){ + items.insert(items.end(), counted->begin(), counted->end()); + } + } + if (const auto* used = step_arg>(step, "use_items")){ + for (const Pokemon::StoryItem& item : *used){ + items.push_back(item.item); + } + } + return items; +} + +// 11.03 counted its FULL RESTOREs with a reader that had no name for +// them: the row read as nothing, and the count was 0 after the Safari +// Zone's ball was picked up (console B, 2026-11-12). Every item a plan +// buys, uses or counts has a name in the reader, and so do the MOON STONE +// and the NUGGET, which sit above the story's items in the pocket. +UnitTestResult test_plan_items_readable(Logger&){ + std::string missing; + for (const std::string_view item : {"moon-stone", "nugget"}){ + if (!item_list_reader_knows(item)){ + missing += std::format("\n the bag: {}", item); + } + } + for (const StoryCheckpoint& checkpoint : story_checkpoints()){ + for (const StoryStep& step : checkpoint.steps){ + for (const std::string& item : items_read_by(step)){ + if (!item_list_reader_knows(item)){ + missing += std::format("\n {}/{}: {}", checkpoint.id, step.name, item); + } + } + } + } + if (!missing.empty()){ + return "The item list reader has no name for:" + missing; + } + return true; +} + // The open leg through Route 1's grass on the way from Viridian Mart to // Oak's Lab ("south 20"), and the tile it starts from. struct GrassLeg{ @@ -613,6 +687,10 @@ const AutoStoryItemsTestCase AUTO_STORY_ITEMS_CASES[] = { .input = {.name = "unread bag counts count as some", .body = test_unread_counts}, .expectation = {.description = "treats unread quantities as holding at least one"}, }, + { + .input = {.name = "every item a plan reads has a name in the reader", .body = test_plan_items_readable}, + .expectation = {.description = "the item list reader names each item a plan buys, uses or counts"}, + }, { .input = {.name = "no item names read in a language without them", .body = test_unread_language}, .expectation = {.description = "handles unsupported languages gracefully"}, From 2dd261ce0f85fb0ebbb6434639a9761490885479 Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 09:45:09 -0800 Subject: [PATCH 7/8] FRLG ItemListReader: names for Full Restore, Super Potion, Moon Stone, Nugget 11.03's FULL RESTORE row matched several names and read as nothing, so count_full_restore_after saw 0 (console B, 2026-11-12). The reader now has every item a plan buys, uses or counts, and the MOON STONE and NUGGET above them in the pocket. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Inference/Menus/PokemonFRLG_ItemListReader.cpp | 13 +++++++++++-- .../Inference/Menus/PokemonFRLG_ItemListReader.h | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp index 8f1bacae96..e09313cee1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.cpp @@ -43,6 +43,7 @@ constexpr double ROW_HEIGHT = 12; // Each item's slug and its English name. constexpr std::pair ENGLISH_ITEM_NAMES[] = { {"potion", "Potion"}, + {"super-potion", "Super Potion"}, {"antidote", "Antidote"}, {"parlyz-heal", "Parlyz Heal"}, {"awakening", "Awakening"}, @@ -62,6 +63,13 @@ constexpr std::pair ENGLISH_ITEM_NAMES[] = { // (console B, 2026-11-12). {"rare-candy", "Rare Candy"}, {"max-elixir", "Max Elixir"}, + // The Safari Zone's FULL RESTORE, which 11.03 counts. Without it its + // row matched several names and read as nothing (console B, + // 2026-11-12). + {"full-restore", "Full Restore"}, + // Mt. Moon's, which top the pocket above the story's items. + {"moon-stone", "Moon Stone"}, + {"nugget", "Nugget"}, {"cancel", "Cancel"}, }; @@ -323,8 +331,9 @@ void add_tests_ItemListReader(UnitTestDatabase& database){ // the 3 read as nothing before the digit templates. database.add("PokemonFRLG/ItemListReader/ItemsPocket_eng.png"); // Console B, 2026-11-03, the save before Cerulean's rival: a MOON STONE, - // which the reader has no name for, above the PARLYZ HEAL and 15 POTIONs. - // Stopping at it read nothing, and the rival was fought with 0 Potions. + // which the reader had no name for then, above the PARLYZ HEAL and 15 + // POTIONs. Stopping at it read nothing, and the rival was fought with 0 + // Potions. database.add("PokemonFRLG/ItemListReader/ItemsPocketMoonStone_eng.png"); // The Viridian Mart's BUY list, the same day, the cursor on POTION. database.add("PokemonFRLG/ItemListReader/MartBuyList_eng.png"); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h index 1fc5e770b1..6f5b3fbbfb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h @@ -5,8 +5,8 @@ * Reads the item lists of the bag's pockets and of a Mart's BUY menu, * which the game draws alike: rows 16 pixels apart from y 13, names from * x 97 (pokefirered: the list window at tile (11, 1), item_X 9). It knows - * the names of the items a new game meets before the Boulder Badge, in - * English only so far: in another language a name is never read. + * the names of the items the story buys, uses or counts, in English only + * so far: in another language a name is never read. * */ @@ -66,7 +66,7 @@ std::vector read_bag_pocket(Logger& logger, Language language, const Ima // the CANCEL (not included). A row whose name can't be read stays, with an // empty item, so the rows below keep their places: stopping there read // nothing below a MOON STONE, and the rival was fought with 0 of the bag's -// 15 Potions (console B, 2026-11-03). Unread rows after the last name read +// 15 Potions (console B, 2026-11-03), before it had a name. Unread rows after the last name read // are dropped. Empty if no name is read, as in a language the reader has // no names for. std::vector pocket_rows(std::vector reads); From d6cfe389e94a6b781678c95ab4fa85ff59e6ee8a Mon Sep 17 00:00:00 2001 From: dayfine Date: Thu, 12 Nov 2026 09:45:41 -0800 Subject: [PATCH 8/8] FRLG ItemListReader: code health (header symbols tag, std::format) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h | 1 + .../Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h index 6f5b3fbbfb..066ac65a64 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_ItemListReader.h @@ -9,6 +9,7 @@ * so far: in another language a name is never read. * */ +// code-health: allow header_symbols -- the plans' item check needs which names the reader has; a header for one query splits the reader's single concern #ifndef PokemonAutomation_PokemonFRLG_ItemListReader_H #define PokemonAutomation_PokemonFRLG_ItemListReader_H diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp index 5a510ec55a..a56f61de6c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp @@ -372,7 +372,7 @@ UnitTestResult test_plan_items_readable(Logger&){ } } if (!missing.empty()){ - return "The item list reader has no name for:" + missing; + return std::format("The item list reader has no name for:{}", missing); } return true; }