diff --git a/.github/workflows/cpp-ci-serial-programs-base.yml b/.github/workflows/cpp-ci-serial-programs-base.yml index 54fd7032fb..b546fd3048 100644 --- a/.github/workflows/cpp-ci-serial-programs-base.yml +++ b/.github/workflows/cpp-ci-serial-programs-base.yml @@ -22,9 +22,16 @@ on: type: boolean default: false + # The build job's limit; GitHub's default is 360. The fork's draft CI + # passes 60, so a test that hangs fails the run instead of holding a runner. + timeout-minutes: + type: number + default: 360 + jobs: build: runs-on: ${{inputs.os}} + timeout-minutes: ${{inputs.timeout-minutes}} steps: - name: Set variables diff --git a/.github/workflows/fork-draft-ci.yml b/.github/workflows/fork-draft-ci.yml index 41e5b528ff..84c95408ab 100644 --- a/.github/workflows/fork-draft-ci.yml +++ b/.github/workflows/fork-draft-ci.yml @@ -19,3 +19,5 @@ jobs: compiler: default run-clang-query: true run-tests: true + # The build takes ~5 minutes with ccache; a run past an hour has a test hanging. + timeout-minutes: 60 diff --git a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_GatedPlanner.h b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_GatedPlanner.h index 1528831b52..583cf55233 100644 --- a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_GatedPlanner.h +++ b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_GatedPlanner.h @@ -24,8 +24,10 @@ * MapPlace place_of(const State&) const; * * and may have open_stop_risk(const State&, Direction, const GateState&) - * const and tap_stop_risk() with the same parameters, as plan_legs()'s - * model may have them without the gates. + * const and tap_stop_risk() with the same parameters, and + * open_check_risk(const State&, Direction, int, std::optional, + * const GateState&) const, as plan_legs()'s model may have them without + * the gates. * * press() reads each tile with resolved_tile(), which makes a closed gate a * wall. One-way warps (MapWarp::one_way) are the game's to take as any warp: @@ -113,6 +115,13 @@ class GatedModel{ std::optional tap_stop_risk(const State& state, Direction direction) const requires HasTapStopRisk{ return m_inner.tap_stop_risk(state.inner, direction, state.gates); } + int open_check_risk(const State& state, Direction direction, int run, std::optional next) const + requires requires (const Inner& inner, const InnerState& at, Direction way, int tiles, std::optional then, const GateState& gates){ + inner.open_check_risk(at, way, tiles, then, gates); + } + { + return m_inner.open_check_risk(state.inner, direction, run, next, state.gates); + } private: static Step carry(const Step& walked, const GateState& gates){ diff --git a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_LegPlanner.h b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_LegPlanner.h index 043b7e5306..50268cd987 100644 --- a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_LegPlanner.h +++ b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_LegPlanner.h @@ -41,7 +41,14 @@ * interruption stopping it would leave the player is no guess: e.g. on * open water, a hold to a wall and a tile on starts a leg down a column * with no wall of its own. Once a route: a run of them, wall to wall, - * would weave round the open stops it can't avoid. + * would weave round the open stops it can't avoid. And + * + * int open_check_risk(const State& state, Direction direction, int run, std::optional next) const; + * + * the extra cost of such a leg, `run` tiles long (counted up to + * MAX_COUNTED_RUN), followed by a leg `next` (none: the walk ends there), + * when the walk can't tell from that leg where the open one ended and has + * to find the player at walls. * */ @@ -150,6 +157,10 @@ namespace LegPlannerInternal{ // wild step, whether it is one step from where a hold to a wall ended, and // whether such a step was stopped after earlier (see tap_stop_risk() at // the top of this file). +// How far a node counts the tiles of the leg it is in (Node::run): what +// open_check_risk() tells apart. +constexpr int MAX_COUNTED_RUN = 3; + template struct Node{ State state; @@ -158,6 +169,8 @@ struct Node{ bool wild = false; bool tap_from_wall = false; bool tapped = false; + // The tiles of the leg so far, up to MAX_COUNTED_RUN. + int run = 0; bool operator==(const Node& other) const = default; }; @@ -166,8 +179,8 @@ struct Node{ template struct NodeHash{ size_t operator()(const Node& node) const{ - return StateHash()(node.state) * 80 + node.facing * 16 + (node.moving ? 8 : 0) + (node.wild ? 4 : 0) - + (node.tap_from_wall ? 2 : 0) + (node.tapped ? 1 : 0); + return (StateHash()(node.state) * 80 + node.facing * 16 + (node.moving ? 8 : 0) + (node.wild ? 4 : 0) + + (node.tap_from_wall ? 2 : 0) + (node.tapped ? 1 : 0)) * (MAX_COUNTED_RUN + 1) + node.run; } }; @@ -179,9 +192,10 @@ struct Move{ Step step; }; -// Cost incurred when stopping at a node. +// Cost incurred when stopping at a node, before a leg `next` (none: the +// walk ends there). template -int stop_cost(const Model& model, const Node& node, const LegCosts& costs){ +int stop_cost(const Model& model, const Node& node, const LegCosts& costs, std::optional next){ if (!node.moving || model.held_at(node.state, (Direction)node.facing)){ return 0; } @@ -196,6 +210,9 @@ int stop_cost(const Model& model, const Node& node, const LegCosts& costs if constexpr (requires { model.open_stop_risk(node.state, Direction::NORTH); }){ cost += model.open_stop_risk(node.state, (Direction)node.facing); } + if constexpr (requires { model.open_check_risk(node.state, Direction::NORTH, /*run=*/0, next); }){ + cost += model.open_check_risk(node.state, (Direction)node.facing, node.run, next); + } return cost; } @@ -283,11 +300,12 @@ void expand( const bool from_wall = current.moving && model.held_at(current.state, (Direction)current.facing); const Node next{ step->next, (int)step->facing, continues, (extends && current.wild) || step->wild, - !extends && from_wall, current.tapped || (!extends && current.tap_from_wall) + !extends && from_wall, current.tapped || (!extends && current.tap_from_wall), + extends ? std::min(current.run + 1, MAX_COUNTED_RUN) : 1 }; int step_cost = costs.per_tile + step->extra_cost; if (current.facing != (int)direction){ - step_cost += costs.per_turn + stop_cost(model, current, costs); + step_cost += costs.per_turn + stop_cost(model, current, costs, std::optional(direction)); } relax(next, cost + step_cost, Move{current, direction, *step}, search); } @@ -300,7 +318,7 @@ int arrival_cost( const Model& model, const Node& node, std::optional goal_facing, const LegCosts& costs ){ - int cost = stop_cost(model, node, costs); + int cost = stop_cost(model, node, costs, std::nullopt); if (goal_facing && node.facing != (int)*goal_facing){ cost += costs.per_turn; } @@ -382,7 +400,7 @@ std::optional>> plan_legs( using State = typename Model::State; using Node = LegPlannerInternal::Node; - const Node first{start, start_facing ? (int)*start_facing : 4, false, false, false, false}; + const Node first{start, start_facing ? (int)*start_facing : 4, false, false, false, false, 0}; LegPlannerInternal::Search search; const std::optional end = LegPlannerInternal::search_goal(model, first, at_goal, goal_facing, costs, search); if (!end){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_BikeSpinPresses.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_BikeSpinPresses.h index e58d996e90..f459eb2d1a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_BikeSpinPresses.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_BikeSpinPresses.h @@ -43,6 +43,20 @@ inline constexpr Milliseconds BIKE_SELECT_SETTLE(1200); // last frames and the facing it leaves. Not measured. inline constexpr Milliseconds SPIN_STOP_SETTLE(300); +// After a leg onto a spinner, the walker compares shots of the screen this +// far apart until two show the same: the slide is over. Longer than a +// tile of the slide (SPIN_TILE_TIME), so two shots taken while it goes on +// never match. +inline constexpr Milliseconds SLIDE_STILL_POLL(200); + +// How long the walker waits for a slide of `tiles` to end before it fails: +// twice the slide's time and its settle, as SPIN_TILE_TIME is the +// decompilation's, not measured on the console. +constexpr Milliseconds slide_wait_limit(int tiles){ + return 2 * SPIN_TILE_TIME * tiles + SPIN_STOP_SETTLE; +} +static_assert(SLIDE_STILL_POLL > SPIN_TILE_TIME); + static_assert(BIKE_TAP_PERIOD > BIKE_TAP_PERIOD_WORKED && BIKE_TAP_PERIOD_WORKED > BIKE_TAP_DROP_PERIOD); static_assert(BIKE_TAP < BIKE_TILE_TIME && BIKE_TAP <= LONGEST_TAP); static_assert(BIKE_SELECT_SETTLE > BIKE_SELECT_TIME); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.cpp index 704994c2da..748a4a40ff 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.cpp @@ -51,23 +51,6 @@ Pokemon::RouteLogLeg route_log_leg(const RouteStep& step){ return leg; } -// The farthest sight of the trainers on `maps` but those `beaten` names -// who may see `tile`; 0 if none does. -int sight_onto(const std::vector& maps, const MapPosition& tile, const std::set& beaten){ - int sight = 0; - for (const MapData& map : maps){ - if (map.name != tile.map){ - continue; - } - for (const MapObject& object : map.objects){ - if (trainer_may_see(map, object, tile.point) && !beaten.contains(trainer_id(map, object))){ - sight = std::max(sight, object.trainer->sight); - } - } - } - return sight; -} - // How far the holds that find the player after an open leg, and the way // back, may walk, per tile of the leg. 2 left Rocket Hideout B3F's "west // 7" off the stairs unchecked: the hold to its west wall and back walk up @@ -113,16 +96,24 @@ bool is_slide(const RouteStep& next){ return next.action == RouteAction::WALK && next.spin_tiles && !next.warps; } -// Whether `next`, a hold to a wall, ends on its planned tile from each of -// `candidates`: then it finds the player itself. -bool hold_finds(const std::vector& maps, const std::vector& candidates, const RouteStep& next){ +// The tiles of `candidates` `next`, a hold to a wall, moves nothing from (seen if `told_apart`), if from +// each other one it ends on its tile; else nothing. Viridian Gym's "south 3 (to wall)" from (7, 3) moves +// from no tile short of it (console B, 2026-11-15 21:39: walls found, and walked back to (7, 3)). +std::optional> hold_finds( + const std::vector& maps, const std::vector& candidates, const RouteStep& next, bool told_apart +){ + std::vector unmoved; for (const StopCandidate& candidate : candidates){ const std::optional hold = hold_to_wall(maps, candidate.player, false, next.direction); - if (!hold || !(hold->end == next.end)){ - return false; + if (hold && hold->end == next.end){ + continue; } + if (!told_apart || !hold || hold->tiles != 0){ + return std::nullopt; + } + unmoved.push_back(candidate); } - return true; + return unmoved; } // The route's lines in the route log the games share, as BDSP's walker @@ -221,7 +212,7 @@ class CheckedSteps{ return outcome; } if (outcome.end == StepEnd::DONE && crossing && m_calls.watch_for_trainer){ - outcome = StepOutcome{.end = m_calls.watch_for_trainer(step, *crossing), .walked = std::nullopt}; + outcome = StepOutcome{.end = m_calls.watch_for_trainer(step, *crossing), .walked = std::nullopt, .movement = outcome.movement}; // kept: a bump into Takashi passed for walked (17.03, 2026-11-15) } m_last = leg; m_last_late = outcome.end == StepEnd::LATE; @@ -334,13 +325,13 @@ class RouteRun{ } private: - // After `step` ended as planned: false, the route failed, if it lands - // the player and they are still on the water. + // After `step` ended as planned: false (failed) if its slide went on too long, or it left them surfing. bool after_done(const RouteStep& step, HoldMovement movement){ - if (step.lands_after > 0 && m_calls.landed_on && !m_calls.landed_on(step.end)){ + const bool sliding = step.spin_tiles && m_calls.wait_out_slide && !m_calls.wait_out_slide(step); + if (sliding || (step.lands_after > 0 && m_calls.landed_on && !m_calls.landed_on(step.end))){ m_calls.fail(std::format( - "walk_overworld_route(): still surfing after {}: the player didn't land on {}.", - to_string(step), to_string(step.end) + "walk_overworld_route(): {} after {}: the player isn't on {}.", + sliding ? "the slide still went on" : "still surfing", to_string(step), to_string(step.end) )); return false; } @@ -497,6 +488,7 @@ class RouteRun{ // moved nothing at the wall). StepOutcome judge_movement(const RouteStep& step, StepOutcome outcome){ const bool held_again = std::exchange(m_held_again, false); + const std::vector short_unmoved = std::exchange(m_short_unmoved, {}); if (outcome.end != StepEnd::DONE || step.action != RouteAction::WALK || step.warps){ return outcome; } @@ -504,6 +496,11 @@ class RouteRun{ m_unmoved.clear(); return outcome; } + if (!short_unmoved.empty()){ + m_calls.log(std::format("Route: {} moved the screen not at all: the open leg before it ended short.", to_string(step))); + m_unmoved_starts = short_unmoved; + return StepOutcome{.end = StepEnd::STOPPED, .walked = WalkedTiles{.min = 0, .max = 0}, .movement = HoldMovement::NONE}; + } const int expected = held_again && step.to_wall ? 0 : expected_tiles(step); if (expected < 1){ m_calls.log("Route: " + to_string(step) + " moved the screen not at all, as a bump into the wall it may stand at already; taken as walked."); @@ -527,6 +524,9 @@ class RouteRun{ m_calls.fail("walk_overworld_route(): " + leg + " moved nothing twice in a row: the player is not walking."); return false; } + if (!m_unmoved_starts.empty() && maps() != nullptr){ + return rejoin(step, std::exchange(m_unmoved_starts, {}), WalkedTiles{.min = 0, .max = 0}); + } if (!start || maps() == nullptr){ return after_unmoved_hold(step); } @@ -774,7 +774,12 @@ class RouteRun{ return; } const std::vector candidates = short_candidates(*maps(), *start, step, movement); - if (candidates.size() < 2 || (!last && is_wall_hold(m_plan[m_next]) && hold_finds(*maps(), candidates, m_plan[m_next]))){ + if (candidates.size() < 2){ + return; + } + std::optional> unmoved; + if (!last && is_wall_hold(m_plan[m_next]) && (unmoved = hold_finds(*maps(), candidates, m_plan[m_next], movement == HoldMovement::MOVED))){ + m_short_unmoved = std::move(*unmoved); // a hold that moves nothing started on one of them return; } const std::optional anchor = plan_reanchor(*maps(), candidates, step, m_planning->costs, last && !(m_calls.riding && m_calls.riding(step)) ? std::optional(step.facing_after) : std::nullopt); @@ -926,6 +931,8 @@ class RouteRun{ std::vector> m_walk_on_starts; // after walking on: where each of the plan's first steps may start std::vector m_hold_from; // the tiles the first hold of the plan may start from std::string m_unmoved; // the leg that moved nothing last, until another walks + std::vector m_short_unmoved; // check_open_leg(): the tiles the next hold moves nothing from + std::vector m_unmoved_starts; // that hold moved nothing: it started on one of these bool m_held_again = false; // the next walk holds a leg to a wall again after something seen after it OpenLegDrift m_drift; // the ways the player may be a tile off since the last open legs }; @@ -936,67 +943,6 @@ WalkedTiles walked_before_warp(const RouteStep& step){ return WalkedTiles{.min = 1, .max = step.tiles - 1}; } -std::optional trainer_crossing( - const std::vector& maps, const MapPosition& start, const RouteStep& step, - const std::set& beaten -){ - if (step.action != RouteAction::WALK){ - return std::nullopt; - } - TrainerCrossing crossing; - const std::vector tiles = leg_tiles(maps, start, step); - for (size_t c = 1; c < tiles.size(); c++){ - const int sight = sight_onto(maps, tiles[c], beaten); - if (sight > 0){ - crossing.seen.push_back(tiles[c]); - crossing.approach_tiles = std::max(crossing.approach_tiles, sight); - crossing.tiles_after_seen = (int)(tiles.size() - 1 - c); - } - } - if (crossing.seen.empty()){ - return std::nullopt; - } - return crossing; -} - -std::vector beaten_trainers_crossed( - const std::vector& maps, const MapPosition& start, const RouteStep& step, - const std::set& beaten -){ - std::vector crossed; - if (step.action != RouteAction::WALK || beaten.empty()){ - return crossed; - } - const std::vector tiles = leg_tiles(maps, start, step); - for (size_t c = 1; c < tiles.size(); c++){ - for (const MapData& map : maps){ - if (map.name != tiles[c].map){ - continue; - } - for (const MapObject& object : map.objects){ - if (!object.trainer){ - continue; - } - const std::string id = trainer_id(map, object); - const bool listed = std::find(crossed.begin(), crossed.end(), id) != crossed.end(); - if (!listed && beaten.contains(id) && trainer_may_see(map, object, tiles[c].point)){ - crossed.push_back(id); - } - } - } - } - return crossed; -} - -Milliseconds trainer_full_watch(int approach_tiles){ - return TRAINER_NOTICE + MovementMechanics::TILE_TIME * approach_tiles + TRAINER_SPEAKS; -} - -Milliseconds trainer_first_look(const TrainerCrossing& crossing){ - const Milliseconds held_on = MovementMechanics::RUN_TILE_TIME * crossing.tiles_after_seen; - return std::max(TRAINER_FIRST_LOOK, trainer_full_watch(crossing.approach_tiles) - held_on); -} - void run_route( const std::vector& route, std::optional facing, const RoutePlanning* planning, const RouteCalls& calls diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.h index d1018d0f73..6436600fc1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.h @@ -23,7 +23,9 @@ * (walked_before_warp()), and the way back goes on through the warp; * - an open leg that ended with nothing seen may still have ended up to * OPEN_LEG_SHORTFALL tiles short. When the next step is a hold to a - * wall that doesn't end on its tile from each of those, or a step onto + * wall that doesn't end on its tile from each of those (or, where the + * hold's movement is seen, move nothing at all from them: its hold + * then shows where the player is), or a step onto * a spinner (which a short start misses), the player is * found at walls the same way and walked back to the leg's end first. * When no holds find them, the leg is taken as walked, as before. @@ -122,6 +124,14 @@ struct RouteCalls{ // if not. The console reads only whether they surf. Not set: not // checked. std::function landed_on; + // After a leg onto a spinner (RouteStep::spin_tiles) that ended as + // planned: waits until the slide is over, and says whether it ended + // within slide_wait_limit(); false fails the route. The game loses a + // press made during the slide: 17.03's second "north 1", held while the + // slide up Viridian Gym's column 19 went on, left the player on the stop + // (19, 3), and the walk ended as arrived at (11, 2) (console B, + // 2026-11-15 21:12). Not set: not waited. + std::function wait_out_slide; // Whether the player rides the Bicycle after `step`, the route's last // leg. A way back to its end after a re-anchor then ends with no turn // to its facing: there a tap steps a tile diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp index b85ebd7e65..3213f47839 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp @@ -398,6 +398,28 @@ HoldMovement measure_movement( return hold_movement(change); } +// RouteCalls::wait_out_slide(): shots of the game screen SLIDE_STILL_POLL +// apart until two match, for up to slide_wait_limit(). While the slide goes +// on the map scrolls a tile per SPIN_TILE_TIME, so no two match. +bool wait_out_slide(ConsoleHandle& console, ProControllerContext& context, const RouteStep& step){ + const int tiles = step.spin_tiles.value_or(0); + const Milliseconds limit = slide_wait_limit(tiles); + const ImageFloatBox& game = GameSettings::instance().GAME_BOX; + context.wait_for_all_requests(); + VideoSnapshot last = console.video().snapshot(); + for (Milliseconds waited(0); waited < limit; waited += SLIDE_STILL_POLL){ + context.wait_for(SLIDE_STILL_POLL); + VideoSnapshot now = console.video().snapshot(); + if (last && now && ImageMatch::pixel_RMSD(extract_box_reference(*last.frame, game), extract_box_reference(*now.frame, game)) <= HOLD_UNMOVED_RMSD){ + console.log(std::format("[Speed] slide: {} tiles, the screen still {} ms after the leg.", tiles, (waited + SLIDE_STILL_POLL).count())); + return true; + } + last = std::move(now); + } + console.log(std::format("Route: the slide of {} tiles after {} still moved the screen {} ms after the leg.", tiles, to_string(step), limit.count()), COLOR_RED); + return false; +} + // One WALK step: turned first when it should, then its hold, and the warp // it ends on; for a hold not onto a warp, whether the screen moved. StepWalk walk_hold_step( @@ -843,6 +865,7 @@ void walk_overworld_route_with_recovery( }; calls.landed_on = [&](const MapPosition&){ return stands_on_foot(console, context, player); }; calls.riding = [&](const RouteStep&){ return riding; }; + calls.wait_out_slide = [&](const RouteStep& step){ return wait_out_slide(console, context, step); }; run_route(route, facing, &planning, calls); context.wait_for_all_requests(); } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery_Tests.cpp index 10b16aa3f0..cf8c08c530 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery_Tests.cpp @@ -834,6 +834,24 @@ UnitTestResult test_trainer_stops_leg(){ return true; } +// A hold across Robin's sight that moved the screen not at all, with +// nothing seen in the watch for her after it: the player never moved, and +// the leg is walked again from its start, as any hold that moved nothing. +// The watch had dropped the hold's movement, so "north 2 (open)" from +// (10, 5), into Takashi on (10, 4), was taken as walked to (10, 3), and +// the next leg moved nothing (console B, 2026-11-15 16:52, 17.03 +// below_giovanni). +UnitTestResult test_unmoved_leg_in_sight(){ + const std::vector maps{parse_map(TEST_ROBIN_JSON, "Robin")}; + const RouteStep open = walk(Direction::EAST, 4, robin(4, 1)); + const RoutePlanning planning{.maps = &maps, .costs = default_route_costs(), .start = robin(0, 1), .label = "Route", .wall_check = WallCheck::SKIP, .open_leg_check = OpenLegCheck::TRUST}; + ScriptedRoute script; + script.ends[0] = no_movement(); + if (script.run({open}, &planning) || script.walked.size() != 2){ + return std::format("Expected the leg walked again after its hold moved nothing, walked {}: {}", script.walked.size(), script.failure); + } + return expect_logged(script.logs, {"the player never moved", "stopped 0 to 0 tiles in"}); +} // On the grass a stop past Robin's column may be a wild battle's anywhere // on the leg, or hers on (3, 1), after which she stands on (3, 2): the @@ -923,6 +941,10 @@ const OverworldRecoveryTestCase OVERWORLD_RECOVERY_CASES[] = { .input = {.name = "a trainer stops a leg", .body = test_trainer_stops_leg}, .expectation = {.description = "handles forced stop and battle start from trainer challenge"}, }, + { + .input = {.name = "a hold in a trainer's sight that moved nothing", .body = test_unmoved_leg_in_sight}, + .expectation = {.description = "walked again from its start, not taken as walked"}, + }, { .input = {.name = "a stop on the grass in a trainer's sight", .body = test_grass_in_sight}, .expectation = {.description = "handles wild encounter in trainer sight line"}, diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp index 126d41dea0..bca12033ae 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.cpp @@ -20,6 +20,7 @@ #include "PokemonFRLG_OverworldObjects.h" #include "PokemonFRLG_OverworldRoute.h" #include "PokemonFRLG_OverworldSpin.h" +#include "PokemonFRLG_OverworldStepChecks.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -39,6 +40,7 @@ const RouteCosts& default_route_costs(){ {RouteCost::SIGHT_OVERSHOOT, 0}, {RouteCost::SIGN_OVERSHOOT, 3}, {RouteCost::OPEN_WATER_STOP, 1000}, + {RouteCost::OPEN_CHECK, 10}, }; return COSTS; } @@ -235,8 +237,13 @@ bool reads_sign_ahead(const MapData& map, TilePos here, Direction direction){ // 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 -// person in the way doesn't count, since they may have wandered off, and -// neither does an edge to a map that isn't loaded. +// person who stands on their tile (no wander box) counts: Giovanni on +// (2, 2) stops a hold up Viridian Gym's column 2 on (2, 3), and the walk +// checked "north 3" to him as an open leg that might have ended short +// (console B, 2026-11-15 21:39). One who may wander off doesn't, nor a +// trainer not yet beaten (with_trainers_beaten()), whose line a hold to +// them walks up (17.03's right_of_takashi would go up column 10 into +// Takashi's), and neither does an edge to a map that isn't loaded. bool stops_at(const std::vector& maps, const Located& player, Direction direction){ const std::optional transition = press(maps, player, direction); if (transition){ @@ -264,7 +271,8 @@ bool stops_at(const std::vector& maps, const Located& player, Direction return false; } if (in_bounds(map, ahead)){ - return object_at(map, ahead) == nullptr; + const MapObject* object = object_at(map, ahead); + return object == nullptr || (!object->wander && !object->trainer); } for (const MapConnection& connection : map.connections){ if (connection.side == direction){ @@ -372,6 +380,40 @@ class StepModel{ return past && seen_by_trainer(past->next) ? route_cost(m_costs, RouteCost::SIGHT_OVERSHOOT) : 0; } + // RouteCost::OPEN_CHECK for an open leg of `run` tiles to `stop`, walked + // `facing`, before a leg `next` (none: the walk ends): the walk finds + // the player at walls after it unless the leg after it places them + // from each tile it may have ended on, up to OPEN_LEG_SHORTFALL short. + // Not on the water, which OPEN_WATER_STOP weighs. + int open_check_risk(const State& stop, Direction facing, int run, std::optional next) const{ + if (run < 2 || stop.state.surfing){ + return 0; + } + const int cost = route_cost(m_costs, RouteCost::OPEN_CHECK); + if (!next){ + return cost; + } + const std::optional ahead = PokemonFRLG::press(m_maps, stop, *next); + if (ahead && ahead->spin){ + return cost; + } + const std::string& map = m_maps[stop.map].name; + const std::optional hold = hold_to_wall(m_maps, MapPosition{map, stop.state.position}, /*surfing=*/false, *next); + if (!hold){ + return 0; + } + const Direction behind = (Direction)(((int)facing + 2) % 4); + TilePos back = stop.state.position; + for (int c = 1; c < run && c <= OPEN_LEG_SHORTFALL; c++){ + back = back.next(behind); + const std::optional from = hold_to_wall(m_maps, MapPosition{map, back}, /*surfing=*/false, *next); + if (!from || !(from->end == hold->end || from->tiles == 0)){ + return cost; + } + } + return 0; + } + static constexpr int ACTION_SURF = 1; private: @@ -437,6 +479,9 @@ class GatedStepModel{ std::optional tap_stop_risk(const State& state, Direction direction, const Pokemon::GateState& gates) const{ return StepModel(m_maps.at(gates), m_costs).tap_stop_risk(state, direction); } + int open_check_risk(const State& stop, Direction facing, int run, std::optional next, const Pokemon::GateState& gates) const{ + return StepModel(m_maps.at(gates), m_costs).open_check_risk(stop, facing, run, next); + } Pokemon::MapPlace place_of(const State& state) const{ return Pokemon::MapPlace{(size_t)state.map, state.state.position}; } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.h index 605e61f49d..f8c2ca5b85 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.h @@ -50,8 +50,9 @@ struct WallHold{ bool walk_only = false; }; // Nothing unless every step on the way is a plain walk: a warp, Surf, a -// ledge, a person, a sign that would speak, or the edge of the loaded maps -// comes first. +// ledge, a person who may wander, a sign that would speak, or the edge of +// the loaded maps comes first. A person who stands still, but a trainer +// not yet beaten, ends it as a wall does. std::optional hold_to_wall( const std::vector& maps, const MapPosition& from, bool surfing, Direction direction diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h index 007703bbd6..3fe9394aa2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteCosts.h @@ -62,13 +62,23 @@ enum class RouteCost{ // is held to its bank finds the player, so Route 21 is crossed sand // bar to sand bar (the user's design, 2026-11-13). OPEN_WATER_STOP, + // Extra for an open leg of 2 tiles or more the walk can't place by the + // leg after it, and so finds the player at walls and walks back + // (run_route()'s open-leg check): one that ends the walk, or before a + // hold to a wall that ends elsewhere from a tile up to + // OPEN_LEG_SHORTFALL short of it (and moves at all from there), or + // before a step onto a spinner. About what those holds and the way + // back cost: below_giovanni's "west 3 (open)" to (7, 3) before "south + // 3 (to wall)" was followed by "west 4 (to wall)" and "east 2" back + // (console B, 2026-11-15 21:39). + OPEN_CHECK, }; // 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, SIGN_OVERSHOOT 3, -// OPEN_WATER_STOP 1000. +// OPEN_WATER_STOP 1000, OPEN_CHECK 10. // 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 diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp index fe734dc20b..b5fa8b1fa9 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp @@ -518,6 +518,8 @@ std::optional OverworldSim::hold( count_bike_leg(direction, duration); if (m_state.screen != SimScreen::OVERWORLD || m_frozen){ stuck_hold(direction); + }else if (start < m_state.slide_end){ + lose_press_in_slide(direction, start + duration); }else if (m_state.on_bike && duration <= MovementMechanics::LONGEST_TAP && drops_bike_tap(start)){ // Dropped: no step. }else if (duration <= MovementMechanics::LONGEST_TAP && m_state.facing == direction){ @@ -539,6 +541,9 @@ void OverworldSim::tap(Direction direction, Milliseconds duration, Milliseconds if (m_state.screen != SimScreen::OVERWORLD || m_frozen || start < m_battle_lockout_end){ stuck_hold(direction); m_last_tap.reset(); + }else if (start < m_state.slide_end){ + lose_press_in_slide(direction, start + duration); + m_last_tap.reset(); }else if (m_last_tap && m_last_tap->direction == direction && m_last_tap->end == start){ hold_on(direction, start + duration); }else if (m_state.on_bike && drops_bike_tap(start)){ @@ -748,12 +753,6 @@ size_t OverworldSimWalker::clear_late(const std::vector& interrupts, } } -void OverworldSimWalker::wait_out_slide(const RouteStep& step){ - if (step.spin_tiles){ - m_sim.watch({}, SPIN_TILE_TIME * *step.spin_tiles + SPIN_STOP_SETTLE); - } -} - void OverworldSimWalker::check_overworld(const RouteStep& step){ const SimScreen screen = m_sim.state().screen; if (m_rules.check_overworld && (screen == SimScreen::START_MENU || screen == SimScreen::MESSAGE)){ @@ -842,7 +841,6 @@ std::optional OverworldSimWalker::walk_step(const RouteStep& step, if (result.stopped){ return dark_stop(step, walked_near(step, result.tiles, TILE_TIME)); } - wait_out_slide(step); const Milliseconds fade_watched_from = m_rules.watch_fade_along_hold ? m_leg_start : m_sim.state().time; if (step.warps && !after_warp(step, warps_before, fade_watched_from)){ if (!m_rules.find_player_after_warp_battle){ @@ -868,6 +866,7 @@ StepOutcome OverworldSimWalker::walk_ridden(const RouteStep& step, std::optional } check_overworld(step); const MapPosition before = m_sim.state().position; + const bool sliding = m_sim.state().time < m_sim.state().slide_end; // scrolls the screen through the hold const bool tapped = counts_step_taps(step) || (m_rules.count_bike_taps && counts_bike_taps(step, m_speed)); if (tapped){ if (counts_step_taps(step) && turns_first(step, m_speed, facing)){ // as walk_and_watch() turns first @@ -887,7 +886,7 @@ StepOutcome OverworldSimWalker::walk_ridden(const RouteStep& step, std::optional // Counted taps saw each tap move, and measure nothing more. HoldMovement movement = HoldMovement::UNMEASURED; if (step.action == RouteAction::WALK && !step.warps && !tapped){ - movement = m_sim.state().position == before ? HoldMovement::NONE : HoldMovement::MOVED; + movement = m_sim.state().position == before && !sliding ? HoldMovement::NONE : HoldMovement::MOVED; } size_t late = clear_late(interrupts(step), step.wild ? m_rules.after_wild_leg_watch : AFTER_LEG_WATCH, MAX_INTERRUPTIONS_PER_LEG); if (late == 0){ @@ -991,6 +990,7 @@ RouteCalls OverworldSimWalker::calls(){ // As the console: the walking sprite shows, not where. calls.landed_on = [this](const MapPosition&){ return !m_sim.state().surfing; }; calls.riding = [this](const RouteStep&){ return m_sim.state().on_bike; }; + calls.wait_out_slide = [this](const RouteStep& step){ return wait_out_slide(step); }; return calls; } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h index 959790383b..5ed59f6a62 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h @@ -176,6 +176,7 @@ class OverworldSim{ void step_tap(Direction direction, Milliseconds duration); void hold_on(Direction direction, Milliseconds end); void stuck_hold(Direction direction); + void lose_press_in_slide(Direction direction, Milliseconds end); void bump(Direction direction, Milliseconds pressed); std::optional press(Direction direction) const; std::optional take_warp(int map_index, const TilePos& tile) const; @@ -506,8 +507,8 @@ class OverworldSimWalker{ StepEnd watch_for_trainer(const RouteStep& step, const TrainerCrossing& crossing); bool moved_past_wall(const RouteStep& step); void check_overworld(const RouteStep& step); - // After a leg onto a spinner: the slide's time. - void wait_out_slide(const RouteStep& step); + // RouteCalls::wait_out_slide(). + bool wait_out_slide(const RouteStep& step); const std::vector& interrupts(const RouteStep& step) const; std::vector watchers(const std::vector& interrupts) const; [[noreturn]] void fail(const std::string& message); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimField.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimField.cpp index 60ac9fe7a0..f3bbc40b8e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimField.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimField.cpp @@ -89,6 +89,33 @@ Milliseconds OverworldSim::after_slide(const Step& step){ return MovementMechanics::SPIN_TILE_TIME * step.spin->tiles; } +// A press that starts while a slide goes on (SimState::slide_end): the +// game reads none of it until the slide's end, and a press held past it +// walks on from there. +void OverworldSim::lose_press_in_slide(Direction direction, Milliseconds end){ + if (end <= m_state.slide_end){ + m_state.presses_in_slide++; + note(std::format("the D-pad pressed {} during the slide is lost.", direction_name(direction))); + return; + } + advance_to(m_state.slide_end); + walk_hold(direction, end - m_state.slide_end, /*short_by=*/0); +} + +// The console's wait_out_slide(): shots SLIDE_STILL_POLL apart until two +// match, which is a poll after the slide's end. +bool OverworldSimWalker::wait_out_slide(const RouteStep& step){ + const Milliseconds limit = MovementMechanics::slide_wait_limit(step.spin_tiles.value_or(0)); + const Milliseconds left = std::max(m_sim.state().slide_end - m_sim.state().time, Milliseconds(0)); + const int polls = (int)(left / MovementMechanics::SLIDE_STILL_POLL) + 1; + if (MovementMechanics::SLIDE_STILL_POLL * polls > limit){ + m_sim.watch({}, limit); + return false; + } + m_sim.watch({}, MovementMechanics::SLIDE_STILL_POLL * polls); + return true; +} + std::optional OverworldSim::lift_warp(int map_index) const{ const auto lift = m_script.lift_floors.find(m_maps[map_index].name); if (lift == m_script.lift_floors.end() || !m_lift_floor){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h index 1c6f895a35..a4ad367d85 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimState.h @@ -18,6 +18,7 @@ #include #include "Common/Cpp/Time.h" #include "CommonTools/ScreenEvents/ScreenEvents.h" +#include "PokemonFRLG_HideoutLiftRoom.h" #include "PokemonFRLG_OverworldRoute.h" #include "PokemonFRLG_OverworldSimScreens.h" @@ -136,9 +137,13 @@ struct SimScript{ // A lift's map, and where its door lets the player out for each floor // on its panel's menu, top first (pokefirered setdynamicwarp in // RocketHideout_Elevator's scripts): the door's own warp is the - // game's placeholder. The hideout's: rocket_hideout_lift_room() under - // LIFT_MAP, with rocket_hideout_lift_exits(). - std::map> lift_floors = {}; + // game's placeholder. The game's two lifts by default: a sim whose maps + // hold a lift's coded room (rocket_hideout_lift_room(), + // department_store_lift_room(); story_maps() has both) rides it. + std::map> lift_floors = { + {std::string(LIFT_MAP), rocket_hideout_lift_exits()}, + {std::string(DEPT_STORE_LIFT_MAP), department_store_lift_exits()}, + }; // The fade out of a lift only dims the screen, never black (console B, // 2026-11-10, 00.32 lift_to_b4f): no FADE shows for it. bool lift_exit_dims = true; @@ -195,6 +200,15 @@ struct SimState{ int step_taps_ignored = 0; // Walker step taps that moved the player (SimScript::unseen_step_taps). int moved_step_taps = 0; + // When the last spinner slide ends, on the sim's clock. Until then the + // game keeps the player in its forced movement and the D-pad does + // nothing (pokefirered TryUpdatePlayerSpinDirection()): 17.03's second + // "north 1", pressed during the slide up Viridian Gym's column 19, was + // lost and left the player on the stop (19, 3) (console B, 2026-11-15 + // 21:12). + Milliseconds slide_end{0}; + // D-pad presses lost in a slide. + int presses_in_slide = 0; // Legs on the Bicycle counted out a tap at a time: taps on it, each // a way other than the last's, or after another press // (SimScript::off_bike_at_legs). diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp index 84681172b9..432a02bb4f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp @@ -63,6 +63,10 @@ void OverworldSim::take_steps(Direction direction, Milliseconds pressed, Millise m_state.facing = *step->facing; } pressed += after_slide(*step); + if (step->spin){ + // The step onto the arrow, then the slide. + m_state.slide_end = pressed + tile; + } if (after_step(*step, pressed)){ return; } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTrainerCrossing.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTrainerCrossing.cpp new file mode 100644 index 0000000000..accf695c6a --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTrainerCrossing.cpp @@ -0,0 +1,102 @@ +/* Overworld Trainer Crossing + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include +#include "PokemonFRLG_MovementMechanics.h" +#include "PokemonFRLG_OverworldObjects.h" +#include "PokemonFRLG_OverworldTrainerCrossing.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +namespace{ + +// The farthest sight of the trainers on `maps` but those `beaten` names +// who may see `tile`; 0 if none does. +int sight_onto(const std::vector& maps, const MapPosition& tile, const std::set& beaten){ + int sight = 0; + for (const MapData& map : maps){ + if (map.name != tile.map){ + continue; + } + for (const MapObject& object : map.objects){ + if (trainer_may_see(map, object, tile.point) && !beaten.contains(trainer_id(map, object))){ + sight = std::max(sight, object.trainer->sight); + } + } + } + return sight; +} + +} // namespace + +std::optional trainer_crossing( + const std::vector& maps, const MapPosition& start, const RouteStep& step, + const std::set& beaten +){ + if (step.action != RouteAction::WALK){ + return std::nullopt; + } + TrainerCrossing crossing; + const std::vector tiles = leg_tiles(maps, start, step); + for (size_t c = 1; c < tiles.size(); c++){ + const int sight = sight_onto(maps, tiles[c], beaten); + if (sight > 0){ + crossing.seen.push_back(tiles[c]); + crossing.approach_tiles = std::max(crossing.approach_tiles, sight); + crossing.tiles_after_seen = (int)(tiles.size() - 1 - c); + } + } + if (crossing.seen.empty()){ + return std::nullopt; + } + return crossing; +} + +std::vector beaten_trainers_crossed( + const std::vector& maps, const MapPosition& start, const RouteStep& step, + const std::set& beaten +){ + std::vector crossed; + if (step.action != RouteAction::WALK || beaten.empty()){ + return crossed; + } + const std::vector tiles = leg_tiles(maps, start, step); + for (size_t c = 1; c < tiles.size(); c++){ + for (const MapData& map : maps){ + if (map.name != tiles[c].map){ + continue; + } + for (const MapObject& object : map.objects){ + if (!object.trainer){ + continue; + } + const std::string id = trainer_id(map, object); + const bool listed = std::find(crossed.begin(), crossed.end(), id) != crossed.end(); + if (!listed && beaten.contains(id) && trainer_may_see(map, object, tiles[c].point)){ + crossed.push_back(id); + } + } + } + } + return crossed; +} + +Milliseconds trainer_full_watch(int approach_tiles){ + return TRAINER_NOTICE + MovementMechanics::TILE_TIME * approach_tiles + TRAINER_SPEAKS; +} + +Milliseconds trainer_first_look(const TrainerCrossing& crossing){ + const Milliseconds held_on = MovementMechanics::RUN_TILE_TIME * crossing.tiles_after_seen; + return std::max(TRAINER_FIRST_LOOK, trainer_full_watch(crossing.approach_tiles) - held_on); +} + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp index 23e218aa51..04905bec4a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp @@ -57,6 +57,7 @@ #include "Programs/AutoStory/PokemonFRLG_AutoStoryRngLoop.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryPartyRoster.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryFlyToCenter_Tests.h" +#include "Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStorySurf_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryHealing.h" @@ -144,6 +145,7 @@ static void add_tests_AutoStoryRows(UnitTestDatabase& database){ add_tests_OverworldGateMaps(database); add_tests_AutoStorySaffronGym(database); add_tests_AutoStoryFlyToCenter(database); + add_tests_AutoStoryStepLint(database); } // The detectors and readers of battle, box, party and dialog screens. diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ConsoleFailures/17.03-21-12-takashi-press-lost-in-slide.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ConsoleFailures/17.03-21-12-takashi-press-lost-in-slide.json new file mode 100644 index 0000000000..e00c505d17 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ConsoleFailures/17.03-21-12-takashi-press-lost-in-slide.json @@ -0,0 +1,18 @@ +{ + "about": "lab-B 2026-11-15 21:12, FRLG 17.03 right_of_takashi (lab build b3c27976f, 3 of 3 attempts the same): from Warren's (15, 7) the legs east 1 to the wall, south 6 down the arrow (16, 13) to the stop (16, 15) and east 3 to the wall ended as planned. \"north 1\" stepped onto the up arrow (19, 14), which slides the player 11 tiles up column 19 to the stop (19, 3); the walker let go of its 133ms hold and, with no wait for the slide (walk_hold_step() has none), held the next \"north 1\" 1.1 s later, while the slide still went on (its shot shows the player half-way up the column). The game lost that press: the player stayed on the stop (19, 3) under the left arrow (19, 2) (the leg's shot), the walk logged \"arrived at (11, 2)\" and A beside Takashi met nothing. No fault is injected: the overworld simulation loses a press made during a slide, as the game does, and the walk must arrive on (11, 2).", + "checkpoint": "17.03", + "start": {"map": "ViridianCity_Gym", "tile": [15, 7], "facing": "north"}, + "walk": { + "event": "right_of_takashi", + "legs": [["east", 1], ["south", 6], ["east", 3], ["north", 1], ["north", 1]] + }, + "faults": [], + "failed": {"step": "challenge_takashi", "error": "no_message: talk: A opened no message; nothing to talk to or pick up here. class=screen_unread"}, + "frame": "20261115-211214915419-17.03-1_right_of_takashi-north_1_open_.png", + "evidence": [ + "[Route] right_of_takashi: north 1 (open): ended at ViridianCity_Gym (19, 3) (walked).", + "[Route] right_of_takashi: north 1 (open): ended at ViridianCity_Gym (11, 2) (walked).", + "[Route] right_of_takashi: arrived at ViridianCity_Gym (11, 2).", + "[Event] 17.03/3 challenge_takashi: failed: no_message: talk: A opened no message; nothing to talk to or pick up here. class=screen_unread" + ] +} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryConsoleFailure_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryConsoleFailure_Tests.cpp index 5e3b496b20..b498d89d07 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryConsoleFailure_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryConsoleFailure_Tests.cpp @@ -204,6 +204,14 @@ const ReplayCase CONSOLE_FAILURE_CASES[] = { .arrives = true, }, }, + { + .name = "17.03-21-12-takashi-press-lost-in-slide", + .input = {}, + .expectation = { + .description = "the leg after a hold onto a spinner waits for the slide to end, so its press isn't lost", + .arrives = true, + }, + }, }; } // namespace diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp index 6cbca764fa..9e69a12149 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp @@ -767,7 +767,7 @@ ConsoleAction console_action_of(StoryActionId id){ case StoryActionId::LEGS: return walk_legs; case StoryActionId::STEP: - return take_step; + return [](StoryEnv& env, RunState& state, const StoryStep& step){ const Outcome outcome = take_step(env, state, step); note_line_trainer(env.console.logger(), step, outcome, state.flags); return outcome; }; case StoryActionId::TALK: return [](StoryEnv& env, RunState&, const StoryStep& step){ if (!talk_until_message(env.console, env.context, step)){ @@ -822,7 +822,7 @@ StoryExecutor::StoryExecutor(StoryEnv& env) } Outcome StoryExecutor::run(const StoryStep& step, RunState& state){ - return regrow_on_warp(story_maps(), [&]{ return m_executor.run(step, state); }, state); + return trainers_back_on_warp([&]{ return regrow_on_warp(story_maps(), [&]{ return m_executor.run(step, state); }, state); }, state); } bool StoryExecutor::master_ball_skipped(bool take_master_ball, Pokemon::StoryCheckLevel checks){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.h index f3242020ce..c86d8dac51 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.h @@ -42,6 +42,7 @@ #include "PokemonFRLG_AutoStoryStepInterrupts.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryCheckpoints.h" +#include "PokemonFRLG_AutoStoryLineTrainer.h" #include "PokemonFRLG_AutoStoryPacedRoute.h" #include "PokemonFRLG_AutoStoryPartyRoster.h" diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp index 9ff539b5c6..d9891e960d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp @@ -103,12 +103,8 @@ const std::map KNOWN_FAILING{ "Rocket Hideout's arrow maze: an unseen tap leaves the player on the leg's start or its end, and from what the screen shows the two look alike: a test tap toward a tile blocked from one but not the other tells them apart"}, {"PokemonFRLG::AutoStory - Fault sweep: 04.05, clean run", "route4_east plans no legs from Mt. Moon B2F (14, 8), past the helix gap: the planner's way out of B2F over story_maps(), not yet looked at"}, - {"PokemonFRLG::AutoStory - Fault sweep: 06.02, clean run", - "below_gym_tree walks onto the gym's door warp and sees no fade (VermilionCity_Gym (4, 12)): the door's warp on the sim after trash_cans, which the sim stubs, not yet looked at"}, {"PokemonFRLG::AutoStory - Fault sweep: 09.02, clean run", "b2f_arrows_to_lift_room moves nothing twice from RocketHideout_B2F (1, 4) after moon_stone, a talk the sim stubs: the arrow tiles' spin from that tile on the sim, not yet looked at"}, - {"PokemonFRLG::AutoStory - Fault sweep: 17.03, clean run", - "Takashi (10, 2) walks up to (10, 4) when he sees the player on (10, 5) and stays there after the battle, so below_giovanni's way north up column 10 is blocked (moved nothing twice); on the console too: the route after a line battle planned with the trainer who walked up as a wall (with_trainers()), or a way to Takashi from row 3"}, {"PokemonFRLG::AutoStory - Fault sweep: 08.03, mount lost", "riding with no fault, route7_underground_exit's warp to UndergroundPath_EastEntrance is not confirmed on the sim (the screen after the fade reads as before the hold): the sim's warp off the Bicycle, before this class can sweep 08.03"}, }; @@ -216,13 +212,6 @@ std::vector row_maps(const StoryCheckpoint& row){ return maps; } -// `script` with the lifts' floors, for sweep_maps()' lift rooms. -SimScript with_lifts(SimScript script){ - script.lift_floors[std::string(LIFT_MAP)] = rocket_hideout_lift_exits(); - script.lift_floors[std::string(DEPT_STORE_LIFT_MAP)] = department_store_lift_exits(); - return script; -} - // Whether the overworld sim plays `step` (OverworldStepSim): the rest is stubbed. bool sim_plays(const StoryStep& step){ switch (step.kind){ @@ -234,7 +223,7 @@ bool sim_plays(const StoryStep& step){ case StoryStepKind::GAME: // A Fly lands on its town's landing tile, as the sim plays it; a // lift's warp lets out on its floor's tile (sweep_maps()' lift - // rooms, with_lifts()). A boulder's push leaves the player behind + // rooms, SimScript::lift_floors). A boulder's push leaves the player behind // it, as the sim plays it. return step.action == CUT_TREE_VARIANT || step.action == PUSH_BOULDER_VARIANT || is_field_move_step(step) || parse_lift_floor_step(step).has_value(); default: @@ -263,6 +252,9 @@ struct RowRun{ Milliseconds in_wild_battles{0}; int moved_step_taps = 0; int bike_legs = 0; + // The run flags as the steps so far left them: the row's start_flags, + // and a trainer who walked up to the player (TRAINER_AT_FLAG). + std::set flags; }; // Where a stubbed step leaves the player instead of its pose_after: by step index. @@ -308,6 +300,20 @@ bool hide_talk_battle_trainer(std::vector& maps, const StoryStep& step) return true; } +// Beats in `maps` the trainers `step`'s flags_after name (TRAINER_BEATEN_FLAG), +// a battle a talk starts, and adds its flags_after to `run_flags`, as the +// program's run state takes them after it: Takashi, fought from his right +// in 17.03, sees no one on column 10 after. Returns whether it named any. +bool beat_talk_battle_trainers(const StoryStep& step, std::vector& maps, std::set& run_flags){ + const std::set beaten = beaten_trainers(std::set(step.flags_after.begin(), step.flags_after.end())); + if (beaten.empty()){ + return false; + } + maps = with_trainers_beaten(std::move(maps), beaten); + run_flags.insert(step.flags_after.begin(), step.flags_after.end()); + return true; +} + // Row `row`'s step `c` on `sim` from `at`, recorded in `out`. Returns // whether it failed as unscripted() and was let pass (run_row()). bool run_row_step( @@ -318,7 +324,7 @@ bool run_row_step( out.facing_before.emplace(c, sim.state().facing); out.gates_before.emplace(c, sim.state().gates); const size_t warps_before = sim.state().warped_from.size(); - out.failure = row_step_on_sim(sim, at, row.steps[c], row.id, start_flag_set(row)); + out.failure = row_step_carrying_flags(sim, at, row.steps[c], row.id, out.flags); const std::vector& warped = sim.state().warped_from; out.warped_from[c].assign(warped.begin() + warps_before, warped.end()); const bool let_pass = unscripted(out.failure) && (!scripted || scripted->contains(c)); @@ -368,8 +374,9 @@ RowRun run_row( const StoryCheckpoint& row, const SimScript& row_script, const Landings& landings = {}, const std::optional>& scripted = std::nullopt ){ - const SimScript script = with_lifts(with_row_start(row_script, row)); + const SimScript script = with_row_start(row_script, row); RowRun out; + out.flags = start_flag_set(row); std::optional off_maps; StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); std::vector maps = row_maps(row); @@ -391,6 +398,7 @@ RowRun run_row( } at = *story_pose(Pokemon::pose_of(*step.pose_after)); const bool hidden = let_pass && hide_talk_battle_trainer(maps, step); + const bool beaten = let_pass && beat_talk_battle_trainers(step, maps, out.flags); const auto landing = landings.find(c); const MapPosition land{at.map, landing == landings.end() ? at.tile : landing->second}; if (!map_loaded(land.map)){ @@ -399,7 +407,7 @@ RowRun run_row( out.failure = walks_after(row, c) ? std::format("{}/{}: ends on {}, which has no map, with a walk after it.", row.id, step.name, land.map) : ""; break; } - if (!(sim->state().position == land) || hidden){ + if (!(sim->state().position == land) || hidden || beaten){ add(sim->state()); sim = std::make_unique(maps, land, at.facing.value_or(sim->state().facing), carried_over(script, *sim)); } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFlyToCenter_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFlyToCenter_Tests.cpp index 25d9e855b2..73a709ef75 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFlyToCenter_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFlyToCenter_Tests.cpp @@ -42,8 +42,8 @@ constexpr std::string_view FIRST_FLY_ROW = "10.01"; // about 10 s of menus and animation, more than 20 tiles of running, but // the long walks are the ones that re-planned and failed on console B // (2026-11-15: 18.02b's 80 tiles round Saffron's blocks). 20 keeps a walk -// down one street (Fuchsia's Warden's house to its Center, 8 tiles) and -// flags every walk across a town (Viridian Gym to its Center, 58 tiles). +// down one street and flags every walk across a town (Viridian Gym to +// its Center, 58 tiles). constexpr int MAX_WALK_TO_CENTER = 20; // The story's maps from 10.01 on that let an Escape Rope work (pokefirered diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp index f17b50290c..76b08c5bac 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp @@ -179,10 +179,8 @@ std::string lift_on_sim(){ hideout_floor("RocketHideout_B4F", exits[2].point.next(Direction::NORTH)), rocket_hideout_lift_room(), }; - SimScript script; - script.lift_floors[std::string(LIFT_MAP)] = exits; const MapPosition below_door = exits[1]; - OverworldSim sim(maps, below_door, Direction::NORTH, script); + OverworldSim sim(maps, below_door, Direction::NORTH); StoryPose at{below_door.map, below_door.point, Direction::NORTH}; const std::string failure = row_step_on_sim(sim, at, lift_floor_step("lift_to_b4f", "B2F", "B4F"), "09.02"); if (!failure.empty()){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp index 70686976f6..e68adde227 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp @@ -777,8 +777,7 @@ UnitTestResult test_hideout_giovanni_row(Logger&){ if (std::none_of(maps.begin(), maps.end(), [](const MapData& map){ return map.name == LIFT_MAP; })){ maps.push_back(rocket_hideout_lift_room()); } - SimScript script; - script.lift_floors[std::string(LIFT_MAP)] = rocket_hideout_lift_exits(); + const SimScript script{}; auto sim = std::make_unique(maps, MapPosition{at.map, at.tile}, *at.facing, script); for (const StoryStep& step : row.steps){ if (step.kind == StoryStepKind::BATTLE){ @@ -1003,8 +1002,7 @@ UnitTestResult test_hideout_giovanni_row_no_tile_twice(Logger&){ if (std::none_of(maps.begin(), maps.end(), [](const MapData& map){ return map.name == LIFT_MAP; })){ maps.push_back(rocket_hideout_lift_room()); } - SimScript script; - script.lift_floors[std::string(LIFT_MAP)] = rocket_hideout_lift_exits(); + const SimScript script{}; auto sim = std::make_unique(maps, MapPosition{at.map, at.tile}, *at.facing, script); std::vector walked{{at.map, at.tile}}; for (const StoryStep& step : row.steps){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.cpp new file mode 100644 index 0000000000..0a0e755efa --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.cpp @@ -0,0 +1,52 @@ +/* AutoStory Line Trainer + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include +#include +#include "Pokemon/AutoStory/Pokemon_TilePose.h" +#include "PokemonFRLG_AutoStoryLineTrainer.h" +#include "PokemonFRLG_AutoStoryPacedRoute.h" +#include "PokemonFRLG_AutoStoryTrainerLine.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +std::optional note_trainer_walked_up(const MapPosition& tile, std::set& run_flags){ + const std::optional move = trainer_walking_up(run_story_maps(run_flags), tile, beaten_trainers(run_flags)); + if (move){ + run_flags.insert(trainer_at_flag(*move)); + } + return move; +} + +void note_line_trainer(Logger& logger, const StoryStep& step, const Pokemon::Outcome& outcome, std::set& run_flags){ + const bool line = step.action == TRAINER_LINE_VARIANT || step.action == TRAINER_WAIT_VARIANT; + const std::vector tiles = line && outcome.succeeded() && outcome.pose ? Pokemon::tiles_of(*outcome.pose) : std::vector(); + if (tiles.size() != 1){ + return; + } + const MapPosition tile{outcome.pose->map, tiles[0]}; + if (const std::optional move = note_trainer_walked_up(tile, run_flags)){ + logger.log(std::format("Story: {}: {} walked up to ({}, {}) and stays there.", step.name, move->trainer, move->x, move->y)); + }else{ + logger.log(std::format("Story: {}: where the trainer who saw the player on {} stands now isn't known.", step.name, to_string(tile)), COLOR_ORANGE); + } +} + + +Pokemon::Outcome trainers_back_on_warp(const std::function& run, Pokemon::RunState& state){ + const std::string map_before = state.pose.map; + Pokemon::Outcome outcome = run(); + trainers_back_after_map_change(map_before, state.pose.map, state.flags); + return outcome; +} + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.h new file mode 100644 index 0000000000..ad667cf153 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.h @@ -0,0 +1,54 @@ +/* AutoStory Line Trainer + * + * From: https://github.com/PokemonAutomation/ + * + * The trainer who saw the player on a step into their line: they walk up, + * and stand beside the player from then on. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryLineTrainer_H +#define PokemonAutomation_PokemonFRLG_AutoStoryLineTrainer_H + +#include +#include +#include +#include +#include "Common/Cpp/Logging/AbstractLogger.h" +#include "Pokemon/AutoStory/Pokemon_StoryOutcome.h" +#include "Pokemon/AutoStory/Pokemon_StoryPose.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteSteps.h" +#include "PokemonFRLG_AutoStoryMovedTrainers.h" +#include "PokemonFRLG_AutoStoryPoses.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// The trainer who saw the player on `tile` walked up to them, and stands +// beside them from now on: adds the TRAINER_AT_FLAG that says so to +// `run_flags`, so the routes after the battle plan around them and over +// the tile they left (trainer_walking_up() on run_story_maps(), the +// trainers beaten_trainers() names seeing no one). Returns the move, or +// nothing, leaving `run_flags` as they were, if where they stand isn't known. +std::optional note_trainer_walked_up(const MapPosition& tile, std::set& run_flags); + +// note_trainer_walked_up() after `step`, a step into a trainer's line +// (TRAINER_LINE_VARIANT, TRAINER_WAIT_VARIANT) that ended on `outcome`'s +// tile, logged. Any other step, or one that failed: nothing. Planned on +// the map's tiles, 17.03's below_giovanni went north from (10, 5) through +// Takashi, who had walked up to (10, 4) (console B, 2026-11-15 16:52). +void note_line_trainer(Logger& logger, const StoryStep& step, const Pokemon::Outcome& outcome, std::set& run_flags); + +// Runs a step (`run`) on `state`; if it left the map it started on, the +// trainers who walked up stand on their own tiles again, beaten +// (trainers_back_after_map_change() on `state.flags`). +Pokemon::Outcome trainers_back_on_warp(const std::function& run, Pokemon::RunState& state); + + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.cpp index 92579cfeb0..c0758bfd32 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.cpp @@ -11,6 +11,7 @@ #include "Common/Cpp/Exceptions.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldObjects.h" #include "PokemonFRLG_AutoStoryMovedTrainers.h" +#include "PokemonFRLG_AutoStoryPacedRoute.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -37,6 +38,14 @@ std::optional> parse_tile(std::string_view text){ return std::pair{x, y}; } +// The way from `from` to `to`, on the same row or column. +Direction towards(const TilePos& from, const TilePos& to){ + if (to.x == from.x){ + return to.y < from.y ? Direction::NORTH : Direction::SOUTH; + } + return to.x < from.x ? Direction::WEST : Direction::EAST; +} + } // namespace @@ -57,6 +66,42 @@ std::vector moved_trainers(const std::set& run_flags){ return moved; } +void trainers_back_after_map_change(std::string_view map_before, std::string_view map_after, std::set& run_flags){ + if (map_before == map_after){ + return; + } + for (const TrainerMove& move : moved_trainers(run_flags)){ + run_flags.erase(trainer_at_flag(move)); + run_flags.insert(std::format("{}{}", TRAINER_BEATEN_FLAG, move.trainer)); + } +} + +std::string trainer_at_flag(const TrainerMove& move){ + return std::format("{}{}={},{}", TRAINER_AT_FLAG, move.trainer, move.x, move.y); +} + +std::optional trainer_walking_up( + const std::vector& maps, const MapPosition& tile, const std::set& beaten +){ + const MapData* map = nullptr; + for (const MapData& candidate : maps){ + map = candidate.name == tile.map ? &candidate : map; + } + std::optional move; + for (size_t c = 0; map != nullptr && c < map->objects.size(); c++){ + const Pokemon::MapObject& object = map->objects[c]; + if (!trainer_may_see(*map, object, tile.point) || beaten.contains(trainer_id(*map, object))){ + continue; + } + if (move || object.wander){ + return std::nullopt; + } + const TilePos beside = tile.point.next(towards(tile.point, TilePos{object.x, object.y})); + move = TrainerMove{.trainer = trainer_id(*map, object), .x = beside.x, .y = beside.y}; + } + return move; +} + std::vector with_trainers_moved(std::vector maps, const std::vector& moved){ for (const TrainerMove& move : moved){ for (MapData& map : maps){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.h index e357cbde9b..85406069fd 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMovedTrainers.h @@ -9,11 +9,13 @@ #ifndef PokemonAutomation_PokemonFRLG_AutoStoryMovedTrainers_H #define PokemonAutomation_PokemonFRLG_AutoStoryMovedTrainers_H +#include #include #include #include #include #include "Pokemon/Navigation/Pokemon_MapData.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRouteSteps.h" namespace PokemonAutomation{ @@ -46,11 +48,37 @@ inline constexpr std::string_view TRAINER_AT_FLAG = "trainer_at:"; // A flag that doesn't parse throws ParseException. std::vector moved_trainers(const std::set& run_flags); +// The TRAINER_AT_FLAG that says `move`. +std::string trainer_at_flag(const TrainerMove& move); + +// The trainer who walks up to the player seen on `tile` of `maps` (a step +// into their line, step_until_seen()), and the tile beside the player they +// stop on, toward where they stood. Trainers `beaten` +// names (trainer_id()) see no one. Nothing if no trainer may see the +// player there, or if where they stop isn't known to one tile: two +// trainers may see it, or one who wanders may come from either side. +// Takashi, facing south on Viridian Gym's (10, 2), saw the player on +// (10, 5) and walked to (10, 4), where 17.03's way north went (console B, +// 2026-11-15 16:52). +std::optional trainer_walking_up( + const std::vector& maps, const MapPosition& tile, const std::set& beaten +); + // `maps` with each trainer of `moved` standing on its new tile, no longer // a trainer: they fought the player when they walked up, and they stop // no one. A trainer not found is left as is. std::vector with_trainers_moved(std::vector maps, const std::vector& moved); +// After a step from `map_before` that ended on `map_after`: if the player +// left the map, every trainer who walked up stands on their own tile +// again, beaten: their TRAINER_AT_FLAG in `run_flags` becomes a +// TRAINER_BEATEN_FLAG (PokemonFRLG_AutoStoryPacedRoute.h). The game +// places a map's people from its object events each time it loads the +// map. Jeff walked up to Route 6's (11, 33) in 05.10, and the run went on +// to Vermilion City; back in 06.03 he stands on (13, 33) again, and the +// leg north onto (11, 33) is open. +void trainers_back_after_map_change(std::string_view map_before, std::string_view map_after, std::set& run_flags); + } // namespace PokemonFRLG diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPacedRoute.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPacedRoute.cpp index ec4b6d3b24..3ada1a2ccb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPacedRoute.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPacedRoute.cpp @@ -9,6 +9,7 @@ #include #include #include "Common/Cpp/Concurrency/Mutex.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_HideoutLiftRoom.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" #include "PokemonFRLG_AutoStoryMovedTrainers.h" #include "PokemonFRLG_AutoStoryPacedRoute.h" @@ -40,7 +41,12 @@ std::vector make_story_maps(bool silph_cleared){ flags.insert("FLAG_HIDE_SILPH_ROCKETS"); flags.insert("FLAG_HIDE_SAFFRON_ROCKETS"); } - return overworld_maps(flags); + std::vector maps = overworld_maps(flags); + // The lifts' rooms, coded rather than mapped: a lift_floor step rides + // them on the sim (SimScript::lift_floors has their floors). + maps.push_back(rocket_hideout_lift_room()); + maps.push_back(department_store_lift_room()); + return maps; } } // namespace diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h index 369cafaf4c..4cf32482fe 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden.h @@ -24,7 +24,8 @@ namespace PokemonFRLG{ // The stored plan lines, in the order the simulation plans them. inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "01.03 front_door from PalletTown_PlayersHouse_2F (6, 6) facing north to PalletTown (6, 8)", - "01.03 walk east 4 -> PalletTown_PlayersHouse_2F (10, 6) [walk only]", + "01.03 walk east 5 (to wall) -> PalletTown_PlayersHouse_2F (11, 6) [walk only]", + "01.03 walk west 1 -> PalletTown_PlayersHouse_2F (10, 6) [walk only]", "01.03 walk north 4 (to wall) -> PalletTown_PlayersHouse_2F (10, 2) [walk only]", "01.03 walk west 1 (warp) -> PalletTown_PlayersHouse_1F (10, 2) [walk only]", "01.03 walk west 6 -> PalletTown_PlayersHouse_1F (4, 2) [walk only]", @@ -48,49 +49,52 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "02.01 walk west 4 -> PalletTown (12, 14)", "02.01 walk north 22 -> Route1 (12, 32) [wild] [connection 15]", "02.01 walk west 4 -> Route1 (8, 32) [wild]", - "02.01 walk north 3 -> Route1 (8, 29)", - "02.01 walk east 4 -> Route1 (12, 29)", - "02.01 walk north 8 -> Route1 (12, 21) [wild]", + "02.01 walk north 2 -> Route1 (8, 30)", + "02.01 walk east 4 -> Route1 (12, 30)", + "02.01 walk north 9 -> Route1 (12, 21) [wild]", "02.01 walk west 2 -> Route1 (10, 21)", - "02.01 walk north 3 -> Route1 (10, 18)", - "02.01 walk east 6 -> Route1 (16, 18)", - "02.01 walk north 16 (to wall) -> Route1 (16, 2) [wild]", - "02.01 walk west 6 -> Route1 (10, 2)", - "02.01 walk north 22 -> ViridianCity (22, 20) [connection 3]", - "02.01 walk east 14 -> ViridianCity (36, 20)", - "02.01 face north -> ViridianCity (36, 20)", + "02.01 walk north 4 (to wall) -> Route1 (10, 17)", + "02.01 walk south 1 -> Route1 (10, 18)", + "02.01 walk east 11 (to wall) -> Route1 (21, 18)", + "02.01 walk north 16 (to wall) -> Route1 (21, 2) [wild]", + "02.01 walk west 11 -> Route1 (10, 2)", + "02.01 walk north 21 -> ViridianCity (22, 21) [connection 3]", + "02.01 walk east 14 -> ViridianCity (36, 21)", + "02.01 walk north 1 -> ViridianCity (36, 20)", "02.02 below_oak from ViridianCity_Mart (4, 3) facing west to PalletTown_ProfessorOaksLab (6, 4) facing north", "02.02 walk south 5 (warp) -> ViridianCity (36, 20) [walk only]", "02.02 walk west 14 -> ViridianCity (22, 20)", "02.02 walk south 24 -> Route1 (10, 4) [connection 20]", "02.02 walk east 6 -> Route1 (16, 4)", - "02.02 walk south 15 -> Route1 (16, 19) [wild]", - "02.02 walk west 6 -> Route1 (10, 19)", - "02.02 walk south 4 -> Route1 (10, 23)", + "02.02 walk south 13 -> Route1 (16, 17) [wild]", + "02.02 walk west 6 -> Route1 (10, 17)", + "02.02 walk south 7 (to wall) -> Route1 (10, 24)", + "02.02 walk north 1 -> Route1 (10, 23)", "02.02 walk east 2 -> Route1 (12, 23)", "02.02 walk south 4 -> Route1 (12, 27) [wild]", "02.02 walk west 4 -> Route1 (8, 27)", "02.02 walk south 8 (to wall) -> Route1 (8, 35) [wild]", - "02.02 walk east 3 -> Route1 (11, 35)", - "02.02 walk north 1 -> Route1 (11, 34)", - "02.02 walk east 1 -> Route1 (12, 34)", + "02.02 walk east 1 -> Route1 (9, 35)", + "02.02 walk north 1 -> Route1 (9, 34)", + "02.02 walk east 3 -> Route1 (12, 34)", "02.02 walk south 20 -> PalletTown (12, 14) [wild] [connection 6]", "02.02 walk east 4 -> PalletTown (16, 14)", "02.02 walk north 1 (warp) -> PalletTown_ProfessorOaksLab (6, 12)", - "02.02 walk north 8 -> PalletTown_ProfessorOaksLab (6, 4) [walk only]", + "02.02 walk north 8 (to wall) -> PalletTown_ProfessorOaksLab (6, 4) [walk only]", "02.03 mart_clerk from PalletTown_ProfessorOaksLab (6, 4) facing south to ViridianCity_Mart (4, 3) facing west", "02.03 walk south 9 (warp) -> PalletTown (16, 14) [walk only]", "02.03 walk west 4 -> PalletTown (12, 14)", "02.03 walk north 22 -> Route1 (12, 32) [wild] [connection 15]", "02.03 walk west 4 -> Route1 (8, 32) [wild]", - "02.03 walk north 3 -> Route1 (8, 29)", - "02.03 walk east 4 -> Route1 (12, 29)", - "02.03 walk north 8 -> Route1 (12, 21) [wild]", + "02.03 walk north 2 -> Route1 (8, 30)", + "02.03 walk east 4 -> Route1 (12, 30)", + "02.03 walk north 9 -> Route1 (12, 21) [wild]", "02.03 walk west 2 -> Route1 (10, 21)", - "02.03 walk north 3 -> Route1 (10, 18)", - "02.03 walk east 6 -> Route1 (16, 18)", - "02.03 walk north 16 (to wall) -> Route1 (16, 2) [wild]", - "02.03 walk west 6 -> Route1 (10, 2)", + "02.03 walk north 4 (to wall) -> Route1 (10, 17)", + "02.03 walk south 1 -> Route1 (10, 18)", + "02.03 walk east 11 (to wall) -> Route1 (21, 18)", + "02.03 walk north 16 (to wall) -> Route1 (21, 2) [wild]", + "02.03 walk west 11 -> Route1 (10, 2)", "02.03 walk north 22 -> ViridianCity (22, 20) [connection 3]", "02.03 walk east 14 -> ViridianCity (36, 20)", "02.03 walk north 1 (warp) -> ViridianCity_Mart (4, 7)", @@ -98,9 +102,10 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "02.03 face west -> ViridianCity_Mart (4, 3) [walk only]", "02.03 viridian_nurse from ViridianCity_Mart (4, 3) facing west to ViridianCity_PokemonCenter_1F (7, 4) facing north", "02.03 walk south 5 (warp) -> ViridianCity (36, 20) [walk only]", - "02.03 walk south 9 -> ViridianCity (36, 29)", - "02.03 walk west 10 -> ViridianCity (26, 29)", - "02.03 walk north 3 (warp) -> ViridianCity_PokemonCenter_1F (7, 8)", + "02.03 walk west 7 -> ViridianCity (29, 20)", + "02.03 walk south 7 -> ViridianCity (29, 27)", + "02.03 walk west 3 -> ViridianCity (26, 27)", + "02.03 walk north 1 (warp) -> ViridianCity_PokemonCenter_1F (7, 8)", "02.03 walk north 4 (to wall) -> ViridianCity_PokemonCenter_1F (7, 4) [walk only]", "02.03 below_old_man_trigger from ViridianCity_PokemonCenter_1F (7, 4) facing north to ViridianCity (20, 9) facing north", "02.03 walk south 5 (warp) -> ViridianCity (26, 27) [walk only]", @@ -128,42 +133,49 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "03.01 walk north 4 (warp) -> Route2_ViridianForest_NorthEntrance (7, 10)", "03.01 pewter_nurse from Route2_ViridianForest_NorthEntrance (7, 10) facing north to PewterCity_PokemonCenter_1F (7, 4) facing north", "03.01 walk north 9 (warp) -> Route2 (5, 13)", - "03.01 walk north 4 -> Route2 (5, 9)", - "03.01 walk east 6 (to wall) -> Route2 (11, 9)", - "03.01 walk north 23 -> PewterCity (23, 26) [connection 10]", - "03.01 walk west 6 -> PewterCity (17, 26)", - "03.01 walk north 1 (warp) -> PewterCity_PokemonCenter_1F (7, 8)", + "03.01 walk north 1 -> Route2 (5, 12)", + "03.01 walk east 4 -> Route2 (9, 12)", + "03.01 walk north 23 (to wall) -> PewterCity (21, 29) [connection 13]", + "03.01 walk west 4 -> PewterCity (17, 29)", + "03.01 walk north 4 (warp) -> PewterCity_PokemonCenter_1F (7, 8)", "03.01 walk north 4 (to wall) -> PewterCity_PokemonCenter_1F (7, 4) [walk only]", "03.02 below_liam_line from PewterCity_PokemonCenter_1F (7, 4) facing north to PewterCity_Gym (6, 9) facing north", "03.02 walk south 5 (warp) -> PewterCity (17, 26) [walk only]", - "03.02 walk east 8 (to wall) -> PewterCity (25, 26)", - "03.02 walk north 14 -> PewterCity (25, 12)", - "03.02 walk west 17 -> PewterCity (8, 12)", - "03.02 walk south 7 (to wall) -> PewterCity (8, 19)", + "03.02 walk east 5 -> PewterCity (22, 26)", + "03.02 walk north 14 -> PewterCity (22, 12)", + "03.02 walk west 16 (to wall) -> PewterCity (6, 12)", + "03.02 walk south 2 (to wall) -> PewterCity (6, 14)", + "03.02 walk east 2 (to wall) -> PewterCity (8, 14)", + "03.02 walk south 5 (to wall) -> PewterCity (8, 19)", "03.02 walk east 7 -> PewterCity (15, 19)", "03.02 walk north 3 (warp) -> PewterCity_Gym (6, 14)", "03.02 walk north 5 -> PewterCity_Gym (6, 9) [walk only]", "03.02 ready_for_brock from PewterCity_Gym (6, 8) facing north to PewterCity_PokemonCenter_1F (7, 4) facing north", "03.02 walk south 7 (warp) -> PewterCity (15, 17) [walk only]", - "03.02 walk west 7 -> PewterCity (8, 17)", - "03.02 walk north 5 -> PewterCity (8, 12)", + "03.02 walk west 9 (to wall) -> PewterCity (6, 17)", + "03.02 walk north 1 (to wall) -> PewterCity (6, 16)", + "03.02 walk east 2 (to wall) -> PewterCity (8, 16)", + "03.02 walk north 4 -> PewterCity (8, 12)", "03.02 walk east 14 -> PewterCity (22, 12)", "03.02 walk south 14 -> PewterCity (22, 26)", "03.02 walk west 5 -> PewterCity (17, 26)", "03.02 walk north 1 (warp) -> PewterCity_PokemonCenter_1F (7, 8)", "03.02 walk north 4 (to wall) -> PewterCity_PokemonCenter_1F (7, 4) [walk only]", "03.02 before_brock from PewterCity_Gym (6, 8) facing north to PewterCity_Gym (6, 6) facing north", - "03.02 walk north 2 -> PewterCity_Gym (6, 6) [walk only]", + "03.02 walk north 2 (to wall) -> PewterCity_Gym (6, 6) [walk only]", "03.03 before_aide_trigger from PewterCity_Gym (6, 6) facing north to PewterCity (45, 21) facing east", "03.03 walk south 9 (warp) -> PewterCity (15, 17) [walk only]", - "03.03 walk west 7 -> PewterCity (8, 17)", - "03.03 walk north 5 -> PewterCity (8, 12)", - "03.03 walk east 30 -> PewterCity (38, 12)", - "03.03 walk south 9 -> PewterCity (38, 21)", - "03.03 walk east 7 -> PewterCity (45, 21)", + "03.03 walk west 9 (to wall) -> PewterCity (6, 17)", + "03.03 walk north 1 (to wall) -> PewterCity (6, 16)", + "03.03 walk east 2 (to wall) -> PewterCity (8, 16)", + "03.03 walk north 4 -> PewterCity (8, 12)", + "03.03 walk east 14 -> PewterCity (22, 12)", + "03.03 walk south 9 -> PewterCity (22, 21)", + "03.03 walk east 23 -> PewterCity (45, 21)", "03.03 below_pewter_center from PewterCity (46, 21) facing north to PewterCity (17, 26) facing south", - "03.03 walk west 24 -> PewterCity (22, 21)", - "03.03 walk south 5 -> PewterCity (22, 26)", + "03.03 walk south 1 -> PewterCity (46, 22)", + "03.03 walk west 24 (to wall) -> PewterCity (22, 22)", + "03.03 walk south 4 -> PewterCity (22, 26)", "03.03 walk west 5 -> PewterCity (17, 26)", "03.03 face south -> PewterCity (17, 26)", "04.01 pewter_nurse from PewterCity (17, 26) facing south to PewterCity_PokemonCenter_1F (7, 4) facing north", @@ -183,19 +195,22 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "04.02 walk east 13 (to wall) -> Route3 (60, 7)", "04.02 walk south 4 -> Route3 (60, 11)", "04.02 walk east 9 (to wall) -> Route3 (69, 11)", - "04.02 walk north 2 -> Route3 (69, 9)", - "04.02 walk east 3 (to wall) -> Route3 (72, 9)", - "04.02 walk north 24 (warp) -> Route4_PokemonCenter_1F (7, 8) [connection 10]", + "04.02 walk north 1 -> Route3 (69, 10)", + "04.02 walk east 3 -> Route3 (72, 10)", + "04.02 walk north 25 (warp) -> Route4_PokemonCenter_1F (7, 8) [connection 11]", "04.02 walk north 4 (to wall) -> Route4_PokemonCenter_1F (7, 4) [walk only]", "04.02 before_salesman from Route4_PokemonCenter_1F (7, 4) facing north to Route4_PokemonCenter_1F (2, 3) facing west", "04.02 walk south 2 -> Route4_PokemonCenter_1F (7, 6) [walk only]", - "04.02 walk west 5 -> Route4_PokemonCenter_1F (2, 6) [walk only]", - "04.02 walk north 3 -> Route4_PokemonCenter_1F (2, 3) [walk only]", - "04.02 face west -> Route4_PokemonCenter_1F (2, 3) [walk only]", + "04.02 walk west 4 -> Route4_PokemonCenter_1F (3, 6) [walk only]", + "04.02 walk north 4 (to wall) -> Route4_PokemonCenter_1F (3, 2) [walk only]", + "04.02 walk south 1 -> Route4_PokemonCenter_1F (3, 3) [walk only]", + "04.02 walk west 1 (to wall) -> Route4_PokemonCenter_1F (2, 3) [walk only]", "04.04 pc_front from Route4_PokemonCenter_1F (2, 3) facing west to Route4_PokemonCenter_1F (11, 2) facing north", "04.04 walk south 5 (to wall) -> Route4_PokemonCenter_1F (2, 8) [walk only]", - "04.04 walk east 11 -> Route4_PokemonCenter_1F (13, 8) [walk only]", - "04.04 walk north 6 (to wall) -> Route4_PokemonCenter_1F (13, 2) [walk only]", + "04.04 walk east 12 (to wall) -> Route4_PokemonCenter_1F (14, 8) [walk only]", + "04.04 walk north 3 (to wall) -> Route4_PokemonCenter_1F (14, 5) [walk only]", + "04.04 walk west 1 (to wall) -> Route4_PokemonCenter_1F (13, 5) [walk only]", + "04.04 walk north 3 (to wall) -> Route4_PokemonCenter_1F (13, 2) [walk only]", "04.04 walk west 2 (to wall) -> Route4_PokemonCenter_1F (11, 2) [walk only]", "04.04 face north -> Route4_PokemonCenter_1F (11, 2) [walk only]", "04.05 route4_nurse from Route4_PokemonCenter_1F (11, 2) facing north to Route4_PokemonCenter_1F (7, 4) facing north", @@ -243,9 +258,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "04.05 walk east 23 (to wall) -> MtMoon_1F (39, 8) [wild]", "04.05 walk south 5 (to wall) -> MtMoon_1F (39, 13) [wild]", "04.05 walk west 5 (to wall) -> MtMoon_1F (34, 13) [wild]", - "04.05 walk south 2 -> MtMoon_1F (34, 15) [wild]", - "04.05 walk west 10 (to wall) -> MtMoon_1F (24, 15) [wild]", - "04.05 walk south 13 (to wall) -> MtMoon_1F (24, 28) [wild]", + "04.05 walk south 1 -> MtMoon_1F (34, 14) [wild]", + "04.05 walk west 10 (to wall) -> MtMoon_1F (24, 14) [wild]", + "04.05 walk south 14 (to wall) -> MtMoon_1F (24, 28) [wild]", "04.05 walk west 6 -> MtMoon_1F (18, 28) [wild]", "04.05 walk south 10 (warp) -> Route4 (19, 6) [wild]", "04.05 walk west 7 -> Route4 (12, 6)", @@ -254,13 +269,13 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "04.05 route4_east from MtMoon_B2F (14, 7) facing north to Route4 (32, 6) facing south", "04.05 walk north 4 (to wall) -> MtMoon_B2F (14, 3) [wild]", "04.05 walk west 11 (to wall) -> MtMoon_B2F (3, 3) [wild]", - "04.05 walk south 7 -> MtMoon_B2F (3, 10) [wild]", + "04.05 walk south 7 (to wall) -> MtMoon_B2F (3, 10) [wild]", "04.05 walk east 2 (warp) -> MtMoon_B1F (39, 4) [wild]", "04.05 walk east 6 (warp) -> Route4 (32, 6) [wild]", "04.06 mega_kick_tutor from Route4 (32, 6) facing south to Route4 (50, 4) facing north", - "04.06 walk east 17 -> Route4 (49, 6)", - "04.06 walk north 2 -> Route4 (49, 4)", - "04.06 walk east 1 -> Route4 (50, 4)", + "04.06 walk east 16 -> Route4 (48, 6)", + "04.06 walk north 2 -> Route4 (48, 4)", + "04.06 walk east 2 -> Route4 (50, 4)", "04.06 face north -> Route4 (50, 4)", "04.06 above_ledge from Route4 (50, 4) facing north to Route4 (93, 8) facing south", "04.06 walk west 2 -> Route4 (48, 4)", @@ -303,7 +318,8 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.01 walk east 21 -> CeruleanCity (7, 22) [connection 14]", "05.01 walk south 9 (to wall) -> CeruleanCity (7, 31)", "05.01 walk east 12 -> CeruleanCity (19, 31)", - "05.01 walk north 11 -> CeruleanCity (19, 20)", + "05.01 walk north 13 (to wall) -> CeruleanCity (19, 18)", + "05.01 walk south 2 -> CeruleanCity (19, 20)", "05.01 walk east 3 -> CeruleanCity (22, 20)", "05.01 walk north 1 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", "05.01 walk north 4 (to wall) -> CeruleanCity_PokemonCenter_1F (7, 4) [walk only]", @@ -350,7 +366,8 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.03 walk east 21 -> CeruleanCity (7, 22) [connection 14]", "05.03 walk south 9 (to wall) -> CeruleanCity (7, 31)", "05.03 walk east 12 -> CeruleanCity (19, 31)", - "05.03 walk north 11 -> CeruleanCity (19, 20)", + "05.03 walk north 13 (to wall) -> CeruleanCity (19, 18)", + "05.03 walk south 2 -> CeruleanCity (19, 20)", "05.03 walk east 3 -> CeruleanCity (22, 20)", "05.03 walk north 1 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", "05.03 walk north 4 (to wall) -> CeruleanCity_PokemonCenter_1F (7, 4) [walk only]", @@ -360,18 +377,21 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.03 walk south 11 (to wall) -> CeruleanCity (17, 31)", "05.03 walk west 10 (to wall) -> CeruleanCity (7, 31)", "05.03 walk north 11 (to wall) -> CeruleanCity (7, 20)", - "05.03 walk east 2 -> CeruleanCity (9, 20)", - "05.03 walk north 8 (to wall) -> CeruleanCity (9, 12)", - "05.03 walk east 14 -> CeruleanCity (23, 12)", + "05.03 walk east 1 -> CeruleanCity (8, 20)", + "05.03 walk north 8 (to wall) -> CeruleanCity (8, 12)", + "05.03 walk east 15 -> CeruleanCity (23, 12)", "05.03 walk north 5 -> CeruleanCity (23, 7)", "05.05 cerulean_nurse from CeruleanCity (23, 6) facing south to CeruleanCity_PokemonCenter_1F (7, 4) facing north", - "05.05 walk south 8 -> CeruleanCity (23, 14)", - "05.05 walk west 15 (to wall) -> CeruleanCity (8, 14)", - "05.05 walk south 7 -> CeruleanCity (8, 21)", - "05.05 walk west 1 -> CeruleanCity (7, 21)", - "05.05 walk south 10 (to wall) -> CeruleanCity (7, 31)", + "05.05 walk south 9 (to wall) -> CeruleanCity (23, 15)", + "05.05 walk west 3 (to wall) -> CeruleanCity (20, 15)", + "05.05 walk north 3 (to wall) -> CeruleanCity (20, 12)", + "05.05 walk west 12 (to wall) -> CeruleanCity (8, 12)", + "05.05 walk south 8 -> CeruleanCity (8, 20)", + "05.05 walk west 1 -> CeruleanCity (7, 20)", + "05.05 walk south 11 (to wall) -> CeruleanCity (7, 31)", "05.05 walk east 12 -> CeruleanCity (19, 31)", - "05.05 walk north 11 -> CeruleanCity (19, 20)", + "05.05 walk north 13 (to wall) -> CeruleanCity (19, 18)", + "05.05 walk south 2 -> CeruleanCity (19, 20)", "05.05 walk east 3 -> CeruleanCity (22, 20)", "05.05 walk north 1 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", "05.05 walk north 4 (to wall) -> CeruleanCity_PokemonCenter_1F (7, 4) [walk only]", @@ -381,18 +401,21 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.05 walk south 11 (to wall) -> CeruleanCity (17, 31)", "05.05 walk west 10 (to wall) -> CeruleanCity (7, 31)", "05.05 walk north 11 (to wall) -> CeruleanCity (7, 20)", - "05.05 walk east 2 -> CeruleanCity (9, 20)", - "05.05 walk north 8 (to wall) -> CeruleanCity (9, 12)", - "05.05 walk east 14 -> CeruleanCity (23, 12)", + "05.05 walk east 1 -> CeruleanCity (8, 20)", + "05.05 walk north 8 (to wall) -> CeruleanCity (8, 12)", + "05.05 walk east 15 -> CeruleanCity (23, 12)", "05.05 walk north 20 -> Route24 (11, 32) [connection 13]", "05.05 ready_for_rocket from Route24 (11, 19) facing north to CeruleanCity_PokemonCenter_1F (7, 4) facing north", - "05.05 walk south 35 -> CeruleanCity (23, 14) [connection 21]", - "05.05 walk west 15 (to wall) -> CeruleanCity (8, 14)", - "05.05 walk south 7 -> CeruleanCity (8, 21)", - "05.05 walk west 1 -> CeruleanCity (7, 21)", - "05.05 walk south 10 (to wall) -> CeruleanCity (7, 31)", + "05.05 walk south 36 (to wall) -> CeruleanCity (23, 15) [connection 21]", + "05.05 walk west 3 (to wall) -> CeruleanCity (20, 15)", + "05.05 walk north 3 (to wall) -> CeruleanCity (20, 12)", + "05.05 walk west 12 (to wall) -> CeruleanCity (8, 12)", + "05.05 walk south 8 -> CeruleanCity (8, 20)", + "05.05 walk west 1 -> CeruleanCity (7, 20)", + "05.05 walk south 11 (to wall) -> CeruleanCity (7, 31)", "05.05 walk east 12 -> CeruleanCity (19, 31)", - "05.05 walk north 11 -> CeruleanCity (19, 20)", + "05.05 walk north 13 (to wall) -> CeruleanCity (19, 18)", + "05.05 walk south 2 -> CeruleanCity (19, 20)", "05.05 walk east 3 -> CeruleanCity (22, 20)", "05.05 walk north 1 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", "05.05 walk north 4 (to wall) -> CeruleanCity_PokemonCenter_1F (7, 4) [walk only]", @@ -401,17 +424,18 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.06 below_franklin_line from Route24 (11, 15) facing east to Route25 (15, 5) facing north", "05.06 walk north 7 -> Route24 (11, 8)", "05.06 walk east 25 (to wall) -> Route25 (12, 8) [connection 13]", - "05.06 walk north 3 -> Route25 (12, 5)", - "05.06 walk east 3 (to wall) -> Route25 (15, 5)", + "05.06 walk north 6 (to wall) -> Route25 (12, 2)", + "05.06 walk east 2 (to wall) -> Route25 (14, 2)", + "05.06 walk south 3 (to wall) -> Route25 (14, 5)", + "05.06 walk east 1 (to wall) -> Route25 (15, 5)", "05.06 face north -> Route25 (15, 5)", "05.06 sea_cottage from Route25 (42, 8) facing north to Route25_SeaCottage (7, 8) facing north", "05.06 walk east 9 -> Route25 (51, 8)", "05.06 walk north 4 (warp) -> Route25_SeaCottage (7, 9)", "05.06 walk north 1 -> Route25_SeaCottage (7, 8) [walk only]", "05.07 below_bill_clefairy from Route25_SeaCottage (7, 8) facing north to Route25_SeaCottage (10, 7) facing north", - "05.07 walk north 1 -> Route25_SeaCottage (7, 7) [walk only]", - "05.07 walk east 3 -> Route25_SeaCottage (10, 7) [walk only]", - "05.07 face north -> Route25_SeaCottage (10, 7) [walk only]", + "05.07 walk east 3 -> Route25_SeaCottage (10, 8) [walk only]", + "05.07 walk north 1 (to wall) -> Route25_SeaCottage (10, 7) [walk only]", "05.07 pc_front from Route25_SeaCottage (10, 7) facing north to Route25_SeaCottage (4, 6) facing north", "05.07 walk west 6 -> Route25_SeaCottage (4, 7) [walk only]", "05.07 walk north 1 (to wall) -> Route25_SeaCottage (4, 6) [walk only]", @@ -424,13 +448,15 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.08 walk west 50 -> Route24 (15, 11) [connection 42]", "05.08 walk south 29 -> CeruleanCity (27, 0) [connection 29]", "05.08 cerulean_nurse from CeruleanCity (27, 2) facing south to CeruleanCity_PokemonCenter_1F (7, 4) facing north", - "05.08 walk south 12 -> CeruleanCity (27, 14)", - "05.08 walk west 19 (to wall) -> CeruleanCity (8, 14)", - "05.08 walk south 7 -> CeruleanCity (8, 21)", - "05.08 walk west 1 -> CeruleanCity (7, 21)", - "05.08 walk south 10 (to wall) -> CeruleanCity (7, 31)", + "05.08 walk south 10 -> CeruleanCity (27, 12)", + "05.08 walk east 3 (to wall) -> CeruleanCity (30, 12)", + "05.08 walk west 22 (to wall) -> CeruleanCity (8, 12)", + "05.08 walk south 8 -> CeruleanCity (8, 20)", + "05.08 walk west 1 -> CeruleanCity (7, 20)", + "05.08 walk south 11 (to wall) -> CeruleanCity (7, 31)", "05.08 walk east 12 -> CeruleanCity (19, 31)", - "05.08 walk north 11 -> CeruleanCity (19, 20)", + "05.08 walk north 13 (to wall) -> CeruleanCity (19, 18)", + "05.08 walk south 2 -> CeruleanCity (19, 20)", "05.08 walk east 3 -> CeruleanCity (22, 20)", "05.08 walk north 1 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", "05.08 walk north 4 (to wall) -> CeruleanCity_PokemonCenter_1F (7, 4) [walk only]", @@ -446,10 +472,10 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.09 oddish_patch from CeruleanCity_Mart (4, 3) facing west to Route24 (3, 19)", "05.09 walk south 5 (warp) -> CeruleanCity (29, 29) [walk only]", "05.09 walk west 22 (to wall) -> CeruleanCity (7, 29)", - "05.09 walk north 9 (to wall) -> CeruleanCity (7, 20)", - "05.09 walk east 2 -> CeruleanCity (9, 20)", - "05.09 walk north 8 (to wall) -> CeruleanCity (9, 12)", - "05.09 walk east 14 -> CeruleanCity (23, 12)", + "05.09 walk north 8 -> CeruleanCity (7, 21)", + "05.09 walk east 1 -> CeruleanCity (8, 21)", + "05.09 walk north 9 (to wall) -> CeruleanCity (8, 12)", + "05.09 walk east 15 -> CeruleanCity (23, 12)", "05.09 walk north 37 -> Route24 (11, 15) [connection 13]", "05.09 walk west 6 -> Route24 (5, 15)", "05.09 walk south 3 -> Route24 (5, 18)", @@ -459,14 +485,17 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.09 walk west 5 (to wall) (lands after 3) -> Route24 (3, 19) [surfing] [wild]", "05.09 cerulean_nurse from Route24 (3, 19) facing west to CeruleanCity_PokemonCenter_1F (7, 4) facing north", "05.09 walk north 4 -> Route24 (3, 15)", - "05.09 walk east 8 -> Route24 (11, 15)", - "05.09 walk south 39 -> CeruleanCity (23, 14) [connection 25]", - "05.09 walk west 15 (to wall) -> CeruleanCity (8, 14)", - "05.09 walk south 7 -> CeruleanCity (8, 21)", - "05.09 walk west 1 -> CeruleanCity (7, 21)", - "05.09 walk south 10 (to wall) -> CeruleanCity (7, 31)", + "05.09 walk east 8 (to wall) -> Route24 (11, 15)", + "05.09 walk south 40 (to wall) -> CeruleanCity (23, 15) [connection 25]", + "05.09 walk west 3 (to wall) -> CeruleanCity (20, 15)", + "05.09 walk north 3 (to wall) -> CeruleanCity (20, 12)", + "05.09 walk west 12 (to wall) -> CeruleanCity (8, 12)", + "05.09 walk south 8 -> CeruleanCity (8, 20)", + "05.09 walk west 1 -> CeruleanCity (7, 20)", + "05.09 walk south 11 (to wall) -> CeruleanCity (7, 31)", "05.09 walk east 12 -> CeruleanCity (19, 31)", - "05.09 walk north 11 -> CeruleanCity (19, 20)", + "05.09 walk north 13 (to wall) -> CeruleanCity (19, 18)", + "05.09 walk south 2 -> CeruleanCity (19, 20)", "05.09 walk east 3 -> CeruleanCity (22, 20)", "05.09 walk north 1 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", "05.09 walk north 4 (to wall) -> CeruleanCity_PokemonCenter_1F (7, 4) [walk only]", @@ -476,23 +505,22 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "05.10 walk south 11 (to wall) -> CeruleanCity (17, 31)", "05.10 walk west 10 (to wall) -> CeruleanCity (7, 31)", "05.10 walk north 11 (to wall) -> CeruleanCity (7, 20)", - "05.10 walk east 2 -> CeruleanCity (9, 20)", - "05.10 walk north 8 (to wall) -> CeruleanCity (9, 12)", - "05.10 walk east 21 -> CeruleanCity (30, 12)", + "05.10 walk east 1 -> CeruleanCity (8, 20)", + "05.10 walk north 8 (to wall) -> CeruleanCity (8, 12)", + "05.10 walk east 22 (to wall) -> CeruleanCity (30, 12)", "05.10 walk north 1 (warp) -> CeruleanCity_House2 (3, 7)", - "05.10 walk north 1 (to wall) -> CeruleanCity_House2 (3, 6) [walk only]", - "05.10 walk east 2 -> CeruleanCity_House2 (5, 6) [walk only]", - "05.10 walk north 4 (to wall) -> CeruleanCity_House2 (5, 2) [walk only]", - "05.10 walk west 1 -> CeruleanCity_House2 (4, 2) [walk only]", - "05.10 walk north 1 (warp) -> CeruleanCity (31, 8) [walk only]", + "05.10 walk west 2 (to wall) -> CeruleanCity_House2 (1, 7) [walk only]", + "05.10 walk north 4 (to wall) -> CeruleanCity_House2 (1, 3) [walk only]", + "05.10 walk east 3 -> CeruleanCity_House2 (4, 3) [walk only]", + "05.10 walk north 2 (warp) -> CeruleanCity (31, 8) [walk only]", "05.10 walk east 1 (to wall) -> CeruleanCity (32, 8)", "05.10 walk north 1 -> CeruleanCity (32, 7)", "05.10 face east -> CeruleanCity (32, 7)", "05.10 route6_column15 from CeruleanCity (33, 7) facing north to Route6 (15, 14)", "05.10 walk east 4 -> CeruleanCity (37, 7)", - "05.10 walk south 10 -> CeruleanCity (37, 17)", - "05.10 walk east 3 (to wall) -> CeruleanCity (40, 17)", - "05.10 walk south 17 (to wall) -> CeruleanCity (40, 34)", + "05.10 walk south 4 -> CeruleanCity (37, 11)", + "05.10 walk east 3 (to wall) -> CeruleanCity (40, 11)", + "05.10 walk south 23 (to wall) -> CeruleanCity (40, 34)", "05.10 walk west 11 -> CeruleanCity (29, 34)", "05.10 walk south 38 -> Route5 (29, 32) [connection 6]", "05.10 walk east 2 (to wall) -> Route5 (31, 32)", @@ -516,12 +544,13 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "06.01 walk south 5 (warp) -> VermilionCity (15, 7) [walk only]", "06.01 walk east 12 -> VermilionCity (27, 7)", "06.01 walk south 7 (to wall) -> VermilionCity (27, 14)", - "06.01 walk west 2 -> VermilionCity (25, 14)", - "06.01 walk south 11 (to wall) -> VermilionCity (25, 25)", - "06.01 surf south -> VermilionCity (25, 26) [wild]", - "06.01 walk south 4 (to wall) (lands after 2) -> VermilionCity (25, 30) [surfing] [wild]", - "06.01 walk west 2 -> VermilionCity (23, 30)", - "06.01 walk south 2 -> VermilionCity (23, 32)", + "06.01 walk west 1 -> VermilionCity (26, 14)", + "06.01 walk south 11 (to wall) -> VermilionCity (26, 25)", + "06.01 walk west 2 (to wall) -> VermilionCity (24, 25)", + "06.01 surf south -> VermilionCity (24, 26) [wild]", + "06.01 walk south 6 (to wall) (lands after 2) -> VermilionCity (24, 32) [surfing] [wild]", + "06.01 walk west 1 -> VermilionCity (23, 32)", + "06.01 face south -> VermilionCity (23, 32)", "06.01 aboard from VermilionCity (23, 33) facing east to SSAnne_1F_Corridor (19, 2) facing south", "06.01 walk south 2 (warp) -> SSAnne_Exterior (32, 5)", "06.01 walk south 10 (warp) -> SSAnne_1F_Corridor (19, 2)", @@ -531,20 +560,22 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "06.01 walk south 8 (to wall) -> SSAnne_2F_Corridor (1, 10)", "06.01 walk east 3 (to wall) -> SSAnne_2F_Corridor (4, 10)", "06.01 walk south 4 (to wall) -> SSAnne_2F_Corridor (4, 14)", - "06.01 walk east 26 -> SSAnne_2F_Corridor (30, 14)", - "06.01 walk north 7 -> SSAnne_2F_Corridor (30, 7)", + "06.01 walk east 28 (to wall) -> SSAnne_2F_Corridor (32, 14)", + "06.01 walk north 7 -> SSAnne_2F_Corridor (32, 7)", + "06.01 walk west 2 (to wall) -> SSAnne_2F_Corridor (30, 7)", + "06.01 face north -> SSAnne_2F_Corridor (30, 7)", "06.01 behind_captain from SSAnne_2F_Corridor (30, 6) facing north to SSAnne_CaptainsOffice (5, 5) facing north", "06.01 walk north 4 (to wall) -> SSAnne_2F_Corridor (30, 2)", "06.01 walk east 1 (warp) -> SSAnne_CaptainsOffice (3, 7)", - "06.01 walk north 2 (to wall) -> SSAnne_CaptainsOffice (3, 5)", - "06.01 walk east 2 -> SSAnne_CaptainsOffice (5, 5)", - "06.01 face north -> SSAnne_CaptainsOffice (5, 5)", + "06.01 walk east 2 -> SSAnne_CaptainsOffice (5, 7)", + "06.01 walk north 2 (to wall) -> SSAnne_CaptainsOffice (5, 5)", "06.01 off_2f from SSAnne_CaptainsOffice (5, 5) facing north to SSAnne_1F_Corridor (13, 8)", "06.01 walk south 2 -> SSAnne_CaptainsOffice (5, 7)", "06.01 walk west 3 (warp) -> SSAnne_2F_Corridor (30, 2)", - "06.01 walk south 9 -> SSAnne_2F_Corridor (30, 11)", - "06.01 walk west 27 (to wall) -> SSAnne_2F_Corridor (3, 11)", - "06.01 walk north 7 (to wall) -> SSAnne_2F_Corridor (3, 4)", + "06.01 walk south 12 (to wall) -> SSAnne_2F_Corridor (30, 14)", + "06.01 walk north 1 -> SSAnne_2F_Corridor (30, 13)", + "06.01 walk west 27 (to wall) -> SSAnne_2F_Corridor (3, 13)", + "06.01 walk north 9 (to wall) -> SSAnne_2F_Corridor (3, 4)", "06.01 walk west 2 (to wall) -> SSAnne_2F_Corridor (1, 4)", "06.01 walk north 2 (to wall) -> SSAnne_2F_Corridor (1, 2)", "06.01 walk east 2 (warp) -> SSAnne_1F_Corridor (3, 8)", @@ -554,7 +585,8 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "06.01 vermilion_nurse from VermilionCity (23, 32) facing north to VermilionCity_PokemonCenter_1F (7, 4) facing north", "06.01 walk north 4 (to wall) -> VermilionCity (23, 28)", "06.01 walk east 14 (to wall) -> VermilionCity (37, 28)", - "06.01 walk north 9 -> VermilionCity (37, 19)", + "06.01 walk north 10 (to wall) -> VermilionCity (37, 18)", + "06.01 walk south 1 -> VermilionCity (37, 19)", "06.01 walk west 11 -> VermilionCity (26, 19)", "06.01 walk north 7 -> VermilionCity (26, 12)", "06.01 walk east 1 -> VermilionCity (27, 12)", @@ -566,7 +598,8 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "06.02 walk south 5 (warp) -> VermilionCity (15, 7) [walk only]", "06.02 walk east 12 -> VermilionCity (27, 7)", "06.02 walk south 7 (to wall) -> VermilionCity (27, 14)", - "06.02 walk west 5 -> VermilionCity (22, 14)", + "06.02 walk west 7 (to wall) -> VermilionCity (20, 14)", + "06.02 walk east 2 -> VermilionCity (22, 14)", "06.02 walk south 8 (to wall) -> VermilionCity (22, 22)", "06.02 walk west 4 (to wall) -> VermilionCity (18, 22)", "06.02 walk south 1 (to wall) -> VermilionCity (18, 23)", @@ -577,12 +610,12 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "06.02 walk west 5 -> VermilionCity (14, 28)", "06.02 walk north 3 (warp) -> VermilionCity_Gym (5, 19)", "06.02 below_gym_tree from VermilionCity_Gym (5, 8) facing north to VermilionCity (19, 25) facing north", - "06.02 walk east 1 -> VermilionCity_Gym (6, 8) [walk only]", - "06.02 walk south 11 (to wall) -> VermilionCity_Gym (6, 19) [walk only]", - "06.02 walk west 1 -> VermilionCity_Gym (5, 19) [walk only] [tapped]", + "06.02 walk west 5 (to wall) -> VermilionCity_Gym (0, 8) [walk only]", + "06.02 walk south 11 (to wall) -> VermilionCity_Gym (0, 19) [walk only]", + "06.02 walk east 5 -> VermilionCity_Gym (5, 19) [walk only] [tapped]", "06.02 walk south 1 (warp) -> VermilionCity (14, 26) [walk only]", "06.02 walk east 5 (to wall) -> VermilionCity (19, 26)", - "06.02 walk north 1 -> VermilionCity (19, 25)", + "06.02 walk north 1 (to wall) -> VermilionCity (19, 25)", "06.02 vermilion_nurse from VermilionCity (19, 24) facing north to VermilionCity_PokemonCenter_1F (7, 4) facing north", "06.02 walk north 2 -> VermilionCity (19, 22)", "06.02 walk east 7 (to wall) -> VermilionCity (26, 22)", @@ -599,15 +632,17 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "06.03 west_on_row_31 from Route6 (13, 31) facing east to Route6 (7, 31)", "06.03 walk west 6 (to wall) -> Route6 (7, 31)", "06.03 vermilion_nurse from Route6 (11, 33) facing east to VermilionCity_PokemonCenter_1F (7, 4) facing north", - "06.03 walk south 14 -> VermilionCity (23, 7) [connection 7]", - "06.03 walk west 8 -> VermilionCity (15, 7)", + "06.03 walk west 1 -> Route6 (10, 33)", + "06.03 walk south 14 -> VermilionCity (22, 7) [connection 7]", + "06.03 walk west 7 -> VermilionCity (15, 7)", "06.03 walk north 1 (warp) -> VermilionCity_PokemonCenter_1F (7, 8)", "06.03 walk north 4 (to wall) -> VermilionCity_PokemonCenter_1F (7, 4) [walk only]", "06.03 above_gym_tree from VermilionCity_PokemonCenter_1F (7, 4) facing north to VermilionCity (19, 23) facing south", "06.03 walk south 5 (warp) -> VermilionCity (15, 7) [walk only]", "06.03 walk east 12 -> VermilionCity (27, 7)", "06.03 walk south 7 (to wall) -> VermilionCity (27, 14)", - "06.03 walk west 5 -> VermilionCity (22, 14)", + "06.03 walk west 7 (to wall) -> VermilionCity (20, 14)", + "06.03 walk east 2 -> VermilionCity (22, 14)", "06.03 walk south 8 (to wall) -> VermilionCity (22, 22)", "06.03 walk west 4 (to wall) -> VermilionCity (18, 22)", "06.03 walk south 1 (to wall) -> VermilionCity (18, 23)", @@ -618,59 +653,64 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "06.03 walk west 5 -> VermilionCity (14, 28)", "06.03 walk north 3 (warp) -> VermilionCity_Gym (5, 19)", "06.03 walk north 4 (to wall) -> VermilionCity_Gym (5, 15) [walk only]", - "06.03 walk east 1 -> VermilionCity_Gym (6, 15) [walk only]", - "06.03 walk north 12 -> VermilionCity_Gym (6, 3) [walk only]", - "06.03 walk west 1 -> VermilionCity_Gym (5, 3) [walk only]", - "06.03 face north -> VermilionCity_Gym (5, 3) [walk only]", + "06.03 walk west 1 -> VermilionCity_Gym (4, 15) [walk only]", + "06.03 walk north 7 -> VermilionCity_Gym (4, 8) [walk only]", + "06.03 walk east 1 -> VermilionCity_Gym (5, 8) [walk only]", + "06.03 walk north 5 (to wall) -> VermilionCity_Gym (5, 3) [walk only]", "06.04 below_gym_tree from VermilionCity_Gym (5, 3) facing north to VermilionCity (19, 25) facing north", "06.04 walk east 1 -> VermilionCity_Gym (6, 3) [walk only]", "06.04 walk south 16 (to wall) -> VermilionCity_Gym (6, 19) [walk only]", "06.04 walk west 1 -> VermilionCity_Gym (5, 19) [walk only] [tapped]", "06.04 walk south 1 (warp) -> VermilionCity (14, 26) [walk only]", "06.04 walk east 5 (to wall) -> VermilionCity (19, 26)", - "06.04 walk north 1 -> VermilionCity (19, 25)", + "06.04 walk north 1 (to wall) -> VermilionCity (19, 25)", "06.04 below_oaks_aide from VermilionCity (19, 24) facing north to VermilionCity (14, 10)", - "06.04 walk north 2 -> VermilionCity (19, 22)", - "06.04 walk east 7 (to wall) -> VermilionCity (26, 22)", - "06.04 walk north 10 -> VermilionCity (26, 12)", - "06.04 walk east 1 -> VermilionCity (27, 12)", - "06.04 walk north 2 -> VermilionCity (27, 10)", - "06.04 walk west 13 (to wall) -> VermilionCity (14, 10)", + "06.04 walk north 1 -> VermilionCity (19, 23)", + "06.04 walk west 1 (to wall) -> VermilionCity (18, 23)", + "06.04 walk north 5 (to wall) -> VermilionCity (18, 18)", + "06.04 walk west 1 -> VermilionCity (17, 18)", + "06.04 walk north 3 (to wall) -> VermilionCity (17, 15)", + "06.04 surf north -> VermilionCity (17, 14) [wild]", + "06.04 walk north 4 (to wall) (lands after 3) -> VermilionCity (17, 10) [surfing] [wild]", + "06.04 walk west 3 (to wall) -> VermilionCity (14, 10)", "06.04 vermilion_nurse from VermilionCity (14, 10) facing west to VermilionCity_PokemonCenter_1F (7, 4) facing north", "06.04 walk east 1 -> VermilionCity (15, 10)", "06.04 walk north 4 (warp) -> VermilionCity_PokemonCenter_1F (7, 8)", "06.04 walk north 4 (to wall) -> VermilionCity_PokemonCenter_1F (7, 4) [walk only]", "07.01 below_center from VermilionCity_PokemonCenter_1F (7, 4) facing north to VermilionCity (14, 10)", "07.01 walk south 5 (warp) -> VermilionCity (15, 7) [walk only]", - "07.01 walk south 3 -> VermilionCity (15, 10)", - "07.01 walk west 1 (to wall) -> VermilionCity (14, 10)", - "07.01 beside_chairman from VermilionCity (14, 10) facing west to VermilionCity_PokemonFanClub (4, 4) facing east", - "07.01 walk east 13 -> VermilionCity (27, 10)", - "07.01 walk south 4 (to wall) -> VermilionCity (27, 14)", - "07.01 walk west 5 -> VermilionCity (22, 14)", - "07.01 walk south 4 -> VermilionCity (22, 18)", - "07.01 walk west 10 -> VermilionCity (12, 18)", - "07.01 walk north 1 (warp) -> VermilionCity_PokemonFanClub (5, 10)", + "07.01 walk south 4 (to wall) -> VermilionCity (15, 11)", + "07.01 walk west 1 (to wall) -> VermilionCity (14, 11)", + "07.01 walk north 1 -> VermilionCity (14, 10)", + "07.01 beside_chairman from VermilionCity (14, 10) facing north to VermilionCity_PokemonFanClub (4, 4) facing east", + "07.01 walk south 1 (to wall) -> VermilionCity (14, 11)", + "07.01 walk east 2 -> VermilionCity (16, 11)", + "07.01 surf south -> VermilionCity (16, 12) [wild]", + "07.01 walk south 9 (to wall) (lands after 3) -> VermilionCity (16, 21) [surfing] [wild]", + "07.01 walk west 4 -> VermilionCity (12, 21)", + "07.01 walk north 4 (warp) -> VermilionCity_PokemonFanClub (5, 10)", "07.01 walk north 3 (to wall) -> VermilionCity_PokemonFanClub (5, 7) [walk only]", - "07.01 walk west 4 (to wall) -> VermilionCity_PokemonFanClub (1, 7) [walk only]", - "07.01 walk north 3 -> VermilionCity_PokemonFanClub (1, 4) [walk only]", - "07.01 walk east 3 -> VermilionCity_PokemonFanClub (4, 4) [walk only]", + "07.01 walk west 2 -> VermilionCity_PokemonFanClub (3, 7) [walk only]", + "07.01 walk north 3 -> VermilionCity_PokemonFanClub (3, 4) [walk only]", + "07.01 walk east 1 (to wall) -> VermilionCity_PokemonFanClub (4, 4) [walk only]", "07.01 west_of_oaks_aide from VermilionCity_PokemonFanClub (4, 4) facing east to VermilionCity (22, 10)", "07.01 walk west 3 (to wall) -> VermilionCity_PokemonFanClub (1, 4) [walk only]", "07.01 walk south 6 (to wall) -> VermilionCity_PokemonFanClub (1, 10) [walk only]", "07.01 walk east 4 -> VermilionCity_PokemonFanClub (5, 10) [walk only] [tapped]", "07.01 walk south 1 (warp) -> VermilionCity (12, 18) [walk only]", - "07.01 walk east 14 -> VermilionCity (26, 18)", - "07.01 walk north 6 -> VermilionCity (26, 12)", - "07.01 walk east 1 -> VermilionCity (27, 12)", - "07.01 walk north 2 -> VermilionCity (27, 10)", - "07.01 walk west 5 -> VermilionCity (22, 10)", - "07.01 route6_south_path from VermilionCity (22, 10) facing west to Route6 (11, 34) facing north", + "07.01 walk east 4 -> VermilionCity (16, 18)", + "07.01 walk north 3 (to wall) -> VermilionCity (16, 15)", + "07.01 walk east 1 (to wall) -> VermilionCity (17, 15)", + "07.01 surf north -> VermilionCity (17, 14) [wild]", + "07.01 walk north 4 (to wall) (lands after 3) -> VermilionCity (17, 10) [surfing] [wild]", + "07.01 walk east 5 -> VermilionCity (22, 10)", + "07.01 route6_south_path from VermilionCity (22, 10) facing east to Route6 (11, 34) facing north", "07.01 walk east 1 -> VermilionCity (23, 10)", "07.01 walk north 16 -> Route6 (11, 34) [connection 11]", "07.01 below_cerulean_tree from Route6 (16, 12) facing north to CeruleanCity (26, 33) facing north", - "07.01 walk south 2 -> Route6 (16, 14)", - "07.01 walk east 3 -> Route6 (19, 14)", + "07.01 walk east 1 (to wall) -> Route6 (17, 12)", + "07.01 walk south 2 -> Route6 (17, 14)", + "07.01 walk east 2 -> Route6 (19, 14)", "07.01 walk north 1 (warp) -> UndergroundPath_SouthEntrance (6, 8)", "07.01 walk north 2 (to wall) -> UndergroundPath_SouthEntrance (6, 6)", "07.01 walk east 2 (to wall) -> UndergroundPath_SouthEntrance (8, 6)", @@ -689,9 +729,11 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "07.01 walk north 3 (to wall) -> CeruleanCity (26, 29)", "07.01 walk west 12 -> CeruleanCity (14, 29)", "07.01 walk north 1 (warp) -> CeruleanCity_BikeShop (5, 8)", - "07.01 walk east 2 -> CeruleanCity_BikeShop (7, 8) [walk only]", - "07.01 walk north 5 -> CeruleanCity_BikeShop (7, 3) [walk only]", - "07.01 face east -> CeruleanCity_BikeShop (7, 3) [walk only]", + "07.01 walk north 2 (to wall) -> CeruleanCity_BikeShop (5, 6) [walk only]", + "07.01 walk east 1 -> CeruleanCity_BikeShop (6, 6) [walk only]", + "07.01 walk north 4 (to wall) -> CeruleanCity_BikeShop (6, 2) [walk only]", + "07.01 walk south 1 -> CeruleanCity_BikeShop (6, 3) [walk only]", + "07.01 walk east 1 (to wall) -> CeruleanCity_BikeShop (7, 3) [walk only]", "07.01 mart_clerk from CeruleanCity_BikeShop (7, 3) facing east to CeruleanCity_Mart (4, 3) facing west", "07.01 walk south 5 (to wall) -> CeruleanCity_BikeShop (7, 8) [walk only]", "07.01 walk west 2 -> CeruleanCity_BikeShop (5, 8) [walk only] [tapped]", @@ -702,16 +744,18 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "07.01 face west -> CeruleanCity_Mart (4, 3) [walk only]", "07.01 cerulean_nurse from CeruleanCity_Mart (4, 3) facing west to CeruleanCity_PokemonCenter_1F (7, 4) facing north", "07.01 walk south 5 (warp) -> CeruleanCity (29, 29) [walk only]", - "07.01 walk west 10 -> CeruleanCity (19, 29)", - "07.01 walk north 9 -> CeruleanCity (19, 20)", - "07.01 walk east 3 -> CeruleanCity (22, 20)", - "07.01 walk north 1 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", + "07.01 walk south 2 (to wall) -> CeruleanCity (29, 31)", + "07.01 walk east 8 (to wall) -> CeruleanCity (37, 31)", + "07.01 walk north 8 -> CeruleanCity (37, 23)", + "07.01 walk west 15 -> CeruleanCity (22, 23)", + "07.01 walk north 4 (warp) -> CeruleanCity_PokemonCenter_1F (7, 8)", "07.01 walk north 4 (to wall) -> CeruleanCity_PokemonCenter_1F (7, 4) [walk only]", "07.02 above_cerulean_tree from CeruleanCity_PokemonCenter_1F (7, 4) facing north to CeruleanCity (26, 31) facing south", "07.02 walk south 5 (warp) -> CeruleanCity (22, 20) [walk only]", - "07.02 walk west 4 -> CeruleanCity (18, 20)", - "07.02 walk south 11 (to wall) -> CeruleanCity (18, 31)", - "07.02 walk east 8 -> CeruleanCity (26, 31)", + "07.02 walk south 5 (to wall) -> CeruleanCity (22, 25)", + "07.02 walk east 15 (to wall) -> CeruleanCity (37, 25)", + "07.02 walk south 6 (to wall) -> CeruleanCity (37, 31)", + "07.02 walk west 11 -> CeruleanCity (26, 31)", "07.02 face south -> CeruleanCity (26, 31)", "07.02 west_of_route9_tree from CeruleanCity (26, 32) facing south to Route9 (1, 8) facing east", "07.02 walk south 1 -> CeruleanCity (26, 33)", @@ -730,8 +774,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "07.02 walk east 32 (to wall) -> Route9 (52, 13)", "07.02 walk north 5 -> Route9 (52, 8)", "07.02 route10_ledge_end from Route9 (70, 8) facing east to Route10 (17, 11) facing east", - "07.02 walk east 7 -> Route10 (5, 8) [connection 2]", - "07.02 walk south 3 -> Route10 (5, 11)", + "07.02 walk south 2 (to wall) -> Route9 (70, 10)", + "07.02 walk east 7 -> Route10 (5, 10) [connection 2]", + "07.02 walk south 1 -> Route10 (5, 11)", "07.02 walk east 12 (to wall) -> Route10 (17, 11)", "07.02 route10_nurse from Route10 (13, 21) facing east to Route10_PokemonCenter_1F (7, 4) facing north", "07.02 walk north 1 (warp) -> Route10_PokemonCenter_1F (7, 8)", @@ -799,14 +844,15 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "08.03 pidgey_grass from Route7 (7, 15) facing south to Route7 (14, 6) facing east", "08.03 walk east 3 -> Route7 (10, 15)", "08.03 walk north 6 (to wall) -> Route7 (10, 9)", - "08.03 walk east 4 -> Route7 (14, 9)", + "08.03 walk east 5 (to wall) -> Route7 (15, 9)", + "08.03 walk west 1 -> Route7 (14, 9)", "08.03 walk north 3 -> Route7 (14, 6) [wild]", "08.03 face east -> Route7 (14, 6)", "08.03 celadon_below_center from Route7 (14, 6) facing east to CeladonCity (48, 12) facing north", "08.03 walk south 3 -> Route7 (14, 9)", - "08.03 walk west 8 -> Route7 (6, 9)", - "08.03 walk north 7 (to wall) -> Route7 (6, 2)", - "08.03 walk west 18 -> CeladonCity (48, 12) [connection 7]", + "08.03 walk west 7 -> Route7 (7, 9)", + "08.03 walk north 7 (to wall) -> Route7 (7, 2)", + "08.03 walk west 19 -> CeladonCity (48, 12) [connection 8]", "08.03 face north -> CeladonCity (48, 12)", "09.01 celadon_below_game_corner from CeladonCity_PokemonCenter_1F (7, 4) facing north to CeladonCity (34, 22) facing north", "09.01 walk south 5 (warp) -> CeladonCity (48, 12) [walk only]", @@ -818,7 +864,7 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "09.01 walk north 1 (warp) -> CeladonCity_GameCorner (9, 13)", "09.01 walk north 9 (to wall) -> CeladonCity_GameCorner (9, 4) [walk only]", "09.01 walk east 2 -> CeladonCity_GameCorner (11, 4) [walk only]", - "09.01 walk north 1 -> CeladonCity_GameCorner (11, 3) [walk only]", + "09.01 walk north 1 (to wall) -> CeladonCity_GameCorner (11, 3) [walk only]", "09.01 b2f_east_of_grunt from CeladonCity_GameCorner (11, 2) facing north to RocketHideout_B2F (23, 4) facing west", "09.01 walk east 5 (warp) -> RocketHideout_B1F (12, 2) [walk only]", "09.01 walk east 6 (warp) -> RocketHideout_B2F (28, 2)", @@ -854,7 +900,8 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "09.02 face east -> RocketHideout_B4F (19, 5)", "09.03 above_tea_woman from CeladonCity (34, 22) facing south to CeladonCity_Condominiums_1F (2, 8) facing south", "09.03 walk east 7 -> CeladonCity (41, 22)", - "09.03 walk north 10 (to wall) -> CeladonCity (41, 12)", + "09.03 walk south 3 (to wall) -> CeladonCity (41, 25)", + "09.03 walk north 13 (to wall) -> CeladonCity (41, 12)", "09.03 walk west 11 -> CeladonCity (30, 12)", "09.03 walk north 1 (warp) -> CeladonCity_Condominiums_1F (12, 18)", "09.03 walk north 4 -> CeladonCity_Condominiums_1F (12, 14) [walk only]", @@ -869,9 +916,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "09.03 walk south 5 (warp) -> CeladonCity (30, 12) [walk only]", "09.03 walk east 21 -> CeladonCity (51, 12)", "09.03 walk north 6 (to wall) -> CeladonCity (51, 6)", - "09.03 walk west 13 -> CeladonCity (38, 6)", - "09.03 walk north 4 (to wall) -> CeladonCity (38, 2)", - "09.03 walk west 8 -> CeladonCity (30, 2)", + "09.03 walk west 12 -> CeladonCity (39, 6)", + "09.03 walk north 4 (to wall) -> CeladonCity (39, 2)", + "09.03 walk west 9 -> CeladonCity (30, 2)", "09.03 walk south 3 (warp) -> CeladonCity_Condominiums_1F (2, 2)", "09.03 walk east 3 (warp) -> CeladonCity_Condominiums_2F (4, 2) [walk only]", "09.03 walk west 3 (warp) -> CeladonCity_Condominiums_3F (2, 2) [walk only]", @@ -881,9 +928,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN[] = { "09.03 walk south 9 (to wall) -> CeladonCity_Condominiums_Roof (6, 14) [walk only]", "09.03 walk west 4 -> CeladonCity_Condominiums_Roof (2, 14) [walk only]", "09.03 walk north 2 (warp) -> CeladonCity_Condominiums_RoofRoom (4, 7) [walk only]", - "09.03 walk north 2 (to wall) -> CeladonCity_Condominiums_RoofRoom (4, 5) [walk only]", - "09.03 walk east 3 -> CeladonCity_Condominiums_RoofRoom (7, 5) [walk only]", - "09.03 walk north 1 -> CeladonCity_Condominiums_RoofRoom (7, 4) [walk only]", + "09.03 walk east 4 (to wall) -> CeladonCity_Condominiums_RoofRoom (8, 7) [walk only]", + "09.03 walk west 1 -> CeladonCity_Condominiums_RoofRoom (7, 7) [walk only]", + "09.03 walk north 3 (to wall) -> CeladonCity_Condominiums_RoofRoom (7, 4) [walk only]", }; } // namespace PokemonFRLG diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden10.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden10.h index f1a4689f48..5beede848e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden10.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden10.h @@ -32,22 +32,22 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_10[] = { "10.01 walk east 3 (warp) -> CeladonCity_Condominiums_1F (4, 2) [walk only]", "10.01 walk west 2 -> CeladonCity_Condominiums_1F (2, 2) [walk only]", "10.01 walk north 1 (warp) -> CeladonCity (30, 4) [walk only]", - "10.01 walk north 2 (to wall) -> CeladonCity (30, 2)", - "10.01 walk east 9 -> CeladonCity (39, 2)", - "10.01 walk south 5 (to wall) -> CeladonCity (39, 7)", - "10.01 walk east 12 (to wall) -> CeladonCity (51, 7)", - "10.01 walk south 6 -> CeladonCity (51, 13)", - "10.01 walk west 28 -> CeladonCity (23, 13)", - "10.01 walk south 3 (to wall) -> CeladonCity (23, 16)", - "10.01 walk west 8 -> CeladonCity (15, 16)", - "10.01 walk north 2 (warp) -> CeladonCity_DepartmentStore_1F (10, 14)", + "10.01 walk north 1 -> CeladonCity (30, 3)", + "10.01 walk east 8 -> CeladonCity (38, 3)", + "10.01 walk south 4 (to wall) -> CeladonCity (38, 7)", + "10.01 walk east 13 (to wall) -> CeladonCity (51, 7)", + "10.01 walk south 7 -> CeladonCity (51, 14)", + "10.01 walk west 12 (to wall) -> CeladonCity (39, 14)", + "10.01 walk south 1 -> CeladonCity (39, 15)", + "10.01 walk west 24 -> CeladonCity (15, 15)", + "10.01 walk north 1 (warp) -> CeladonCity_DepartmentStore_1F (10, 14)", "10.01 walk north 9 (to wall) -> CeladonCity_DepartmentStore_1F (10, 5) [walk only]", "10.01 walk west 4 -> CeladonCity_DepartmentStore_1F (6, 5) [walk only]", "10.01 walk north 3 -> CeladonCity_DepartmentStore_1F (6, 2) [walk only]", "10.01 x_items_clerk from CeladonCity_DepartmentStore_5F (6, 2) facing south to CeladonCity_DepartmentStore_5F (3, 7) facing west", - "10.01 walk south 4 -> CeladonCity_DepartmentStore_5F (6, 6) [walk only]", - "10.01 walk west 3 (to wall) -> CeladonCity_DepartmentStore_5F (3, 6) [walk only]", - "10.01 walk south 1 -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", + "10.01 walk south 1 -> CeladonCity_DepartmentStore_5F (6, 3) [walk only]", + "10.01 walk west 3 (to wall) -> CeladonCity_DepartmentStore_5F (3, 3) [walk only]", + "10.01 walk south 4 -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", "10.01 face west -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", "10.01 below_5f_lift from CeladonCity_DepartmentStore_5F (3, 7) facing west to CeladonCity_DepartmentStore_5F (6, 2) facing north", "10.01 walk north 5 (to wall) -> CeladonCity_DepartmentStore_5F (3, 2) [walk only]", @@ -58,15 +58,16 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_10[] = { "10.01 walk west 4 -> CeladonCity_DepartmentStore_1F (2, 7) [walk only]", "10.01 walk south 8 (warp) -> CeladonCity (11, 15) [walk only]", "10.01 route16_below_cut_tree from CeladonCity (11, 15) facing south to Route16 (41, 12) facing north", - "10.01 walk west 7 (to wall) -> CeladonCity (4, 15)", - "10.01 walk south 7 -> CeladonCity (4, 22)", - "10.01 walk west 11 -> Route16 (41, 12) [connection 5]", - "10.01 face north -> Route16 (41, 12)", + "10.01 walk south 2 (to wall) -> CeladonCity (11, 17)", + "10.01 walk west 7 (to wall) -> CeladonCity (4, 17)", + "10.01 walk south 7 (to wall) -> CeladonCity (4, 24)", + "10.01 walk west 11 -> Route16 (41, 14) [connection 5]", + "10.01 walk north 2 (to wall) -> Route16 (41, 12)", "10.01 east_of_north_gate from Route16 (41, 11) facing north to Route16 (28, 6) facing west", - "10.01 walk north 3 -> Route16 (41, 8)", - "10.01 walk west 13 -> Route16 (28, 8)", - "10.01 walk north 2 -> Route16 (28, 6)", - "10.01 face west -> Route16 (28, 6)", + "10.01 walk north 1 -> Route16 (41, 10)", + "10.01 walk west 11 (to wall) -> Route16 (30, 10)", + "10.01 walk north 4 -> Route16 (30, 6)", + "10.01 walk west 2 -> Route16 (28, 6)", "10.01 below_fly_woman from Route16 (28, 6) facing west to Route16_House (4, 4) facing north", "10.01 walk west 2 (warp) -> Route16_NorthEntrance_1F (11, 3)", "10.01 walk west 11 (warp) -> Route16 (20, 6)", @@ -86,11 +87,15 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_10[] = { "10.02 walk north 2 (warp) -> PokemonTower_1F (11, 18)", "10.02 walk north 9 -> PokemonTower_1F (11, 9) [walk only]", "10.02 walk east 8 (warp) -> PokemonTower_2F (18, 10) [walk only]", - "10.02 walk north 4 -> PokemonTower_2F (18, 6) [walk only]", - "10.02 walk west 1 -> PokemonTower_2F (17, 6) [walk only]", + "10.02 walk north 5 (to wall) -> PokemonTower_2F (18, 5) [walk only]", + "10.02 walk west 1 (to wall) -> PokemonTower_2F (17, 5) [walk only]", + "10.02 walk south 1 -> PokemonTower_2F (17, 6) [walk only]", + "10.02 face west -> PokemonTower_2F (17, 6) [walk only]", "10.04 tower_3f_column_7 from PokemonTower_2F (16, 6) facing north to PokemonTower_3F (7, 7) facing east", - "10.04 walk west 12 -> PokemonTower_2F (4, 6) [walk only] [tapped]", - "10.04 walk south 4 -> PokemonTower_2F (4, 10) [walk only] [tapped]", + "10.04 walk west 10 -> PokemonTower_2F (6, 6) [walk only]", + "10.04 walk south 2 (to wall) -> PokemonTower_2F (6, 8) [walk only]", + "10.04 walk west 2 (to wall) -> PokemonTower_2F (4, 8) [walk only]", + "10.04 walk south 2 -> PokemonTower_2F (4, 10) [walk only] [tapped]", "10.04 walk west 1 (warp) -> PokemonTower_3F (4, 10) [walk only]", "10.04 walk east 1 (to wall) -> PokemonTower_3F (5, 10) [walk only] [wild]", "10.04 walk south 4 (to wall) -> PokemonTower_3F (5, 14) [walk only] [wild]", @@ -135,7 +140,7 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_10[] = { "10.06 walk west 1 (warp) -> PokemonTower_7F (11, 16) [walk only]", "10.06 walk north 5 -> PokemonTower_7F (11, 11) [walk only] [wild]", "10.06 below_fuji from PokemonTower_7F (11, 6) facing north to PokemonTower_7F (11, 5) facing north", - "10.06 walk north 1 -> PokemonTower_7F (11, 5) [walk only] [wild]", + "10.06 walk north 1 (to wall) -> PokemonTower_7F (11, 5) [walk only] [wild]", "10.06 facing_fuji from LavenderTown_VolunteerPokemonHouse (3, 4) facing west to LavenderTown_VolunteerPokemonHouse (3, 4) facing north", "10.06 face north -> LavenderTown_VolunteerPokemonHouse (3, 4) [walk only]", }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h index 5fbe7e8f29..a083eddfba 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden11.h @@ -43,9 +43,10 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_11[] = { "11.02 walk east 11 (warp) -> Route18 (48, 9)", "11.02 walk east 18 (to wall) -> FuchsiaCity (6, 19) [connection 12]", "11.02 walk south 6 (to wall) -> FuchsiaCity (6, 25)", - "11.02 walk east 23 -> FuchsiaCity (29, 25)", + "11.02 walk east 24 (to wall) -> FuchsiaCity (30, 25)", + "11.02 walk west 1 -> FuchsiaCity (29, 25)", "11.02 walk north 8 (to wall) -> FuchsiaCity (29, 17)", - "11.02 walk east 7 -> FuchsiaCity (36, 17)", + "11.02 walk east 7 (to wall) -> FuchsiaCity (36, 17)", "11.02 walk south 1 (to wall) -> FuchsiaCity (36, 18)", "11.02 walk east 9 (to wall) -> FuchsiaCity (45, 18)", "11.02 walk north 13 (to wall) -> FuchsiaCity (45, 5)", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h index 66a9190178..8a6dc2abdf 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h @@ -27,9 +27,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12[] = { "12.01 walk south 4 (warp) -> FuchsiaCity (25, 32) [walk only]", "12.01 walk east 2 -> FuchsiaCity (27, 32)", "12.01 below_mart_tree from FuchsiaCity (29, 32) facing east to FuchsiaCity (24, 23) facing north", - "12.01 walk north 9 -> FuchsiaCity (29, 23)", - "12.01 walk west 5 -> FuchsiaCity (24, 23)", - "12.01 face north -> FuchsiaCity (24, 23)", + "12.01 walk north 7 -> FuchsiaCity (29, 25)", + "12.01 walk west 5 -> FuchsiaCity (24, 25)", + "12.01 walk north 2 (to wall) -> FuchsiaCity (24, 23)", "12.01 fuchsia_mart_wall from FuchsiaCity (24, 22) facing north to FuchsiaCity_Mart (4, 2) facing north", "12.01 walk north 6 -> FuchsiaCity (24, 16)", "12.01 walk west 13 -> FuchsiaCity (11, 16)", @@ -42,7 +42,7 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12[] = { "12.01 walk south 5 (warp) -> FuchsiaCity (11, 16) [walk only]", "12.01 walk south 1 (to wall) -> FuchsiaCity (11, 17)", "12.01 walk east 13 (to wall) -> FuchsiaCity (24, 17)", - "12.01 walk south 4 -> FuchsiaCity (24, 21)", + "12.01 walk south 4 (to wall) -> FuchsiaCity (24, 21)", "12.01 gym_east_wall from FuchsiaCity (24, 22) facing south to FuchsiaCity_Gym (14, 21) facing north", "12.01 walk south 3 (to wall) -> FuchsiaCity (24, 25)", "12.01 walk west 22 (to wall) -> FuchsiaCity (2, 25)", @@ -67,8 +67,10 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12[] = { "12.02b walk south 1 (warp) -> FuchsiaCity (9, 33) [walk only]", "12.02b walk south 4 (to wall) -> FuchsiaCity (9, 37)", "12.02b walk west 7 (to wall) -> FuchsiaCity (2, 37)", - "12.02b walk north 12 -> FuchsiaCity (2, 25)", - "12.02b walk east 28 (to wall) -> FuchsiaCity (30, 25)", + "12.02b walk north 19 (to wall) -> FuchsiaCity (2, 18)", + "12.02b walk east 4 (to wall) -> FuchsiaCity (6, 18)", + "12.02b walk south 7 (to wall) -> FuchsiaCity (6, 25)", + "12.02b walk east 24 (to wall) -> FuchsiaCity (30, 25)", "12.02b walk south 7 -> FuchsiaCity (30, 32)", "12.02b walk east 3 -> FuchsiaCity (33, 32)", "12.02b walk north 1 (warp) -> FuchsiaCity_WardensHouse (6, 9)", @@ -76,24 +78,18 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12[] = { "12.02b walk north 3 (to wall) -> FuchsiaCity_WardensHouse (1, 6) [walk only]", "12.02b face_warden from FuchsiaCity_WardensHouse (3, 6) facing east to FuchsiaCity_WardensHouse (3, 6) facing north", "12.02b face north -> FuchsiaCity_WardensHouse (3, 6) [walk only]", - "12.02b below_center_door from FuchsiaCity_WardensHouse (3, 6) facing north to FuchsiaCity (25, 32) facing north", + "12.02b warden_outside from FuchsiaCity_WardensHouse (3, 6) facing north to FuchsiaCity (33, 32) facing south", "12.02b walk east 3 -> FuchsiaCity_WardensHouse (6, 6) [walk only]", "12.02b walk south 4 (warp) -> FuchsiaCity (33, 32) [walk only]", - "12.02b walk west 4 -> FuchsiaCity (29, 32)", - "12.02b walk north 7 -> FuchsiaCity (29, 25)", - "12.02b walk west 27 (to wall) -> FuchsiaCity (2, 25)", - "12.02b walk south 12 (to wall) -> FuchsiaCity (2, 37)", - "12.02b walk east 9 (to wall) -> FuchsiaCity (11, 37)", - "12.02b walk north 5 (to wall) -> FuchsiaCity (11, 32)", - "12.02b walk east 14 -> FuchsiaCity (25, 32)", + "12.02b below_center_door from FuchsiaCity (25, 32) facing south to FuchsiaCity (25, 32) facing north", "12.02b face north -> FuchsiaCity (25, 32)", "12.03 outside_fuchsia_center from FuchsiaCity_PokemonCenter_1F (7, 4) facing north to FuchsiaCity (27, 32) facing east", "12.03 walk south 5 (warp) -> FuchsiaCity (25, 32) [walk only]", "12.03 walk east 2 -> FuchsiaCity (27, 32)", "12.03 below_mart_tree from FuchsiaCity (29, 32) facing east to FuchsiaCity (24, 23) facing north", - "12.03 walk north 9 -> FuchsiaCity (29, 23)", - "12.03 walk west 5 -> FuchsiaCity (24, 23)", - "12.03 face north -> FuchsiaCity (24, 23)", + "12.03 walk north 7 -> FuchsiaCity (29, 25)", + "12.03 walk west 5 -> FuchsiaCity (24, 25)", + "12.03 walk north 2 (to wall) -> FuchsiaCity (24, 23)", "12.03 fuchsia_mart_wall from FuchsiaCity (24, 22) facing north to FuchsiaCity_Mart (4, 2) facing north", "12.03 walk north 6 -> FuchsiaCity (24, 16)", "12.03 walk west 13 -> FuchsiaCity (11, 16)", @@ -106,15 +102,19 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12[] = { "12.03 walk south 5 (warp) -> FuchsiaCity (11, 16) [walk only]", "12.03 walk south 1 (to wall) -> FuchsiaCity (11, 17)", "12.03 walk east 13 (to wall) -> FuchsiaCity (24, 17)", - "12.03 walk south 4 -> FuchsiaCity (24, 21)", + "12.03 walk south 4 (to wall) -> FuchsiaCity (24, 21)", "12.03 pallet_shore from PalletTown (6, 8) facing south to PalletTown (10, 16) facing south", "12.03 walk south 2 (to wall) -> PalletTown (6, 10)", - "12.03 walk east 4 -> PalletTown (10, 10)", - "12.03 walk south 6 (to wall) -> PalletTown (10, 16)", + "12.03 walk east 6 (to wall) -> PalletTown (12, 10)", + "12.03 walk south 1 -> PalletTown (12, 11)", + "12.03 walk west 2 (to wall) -> PalletTown (10, 11)", + "12.03 walk south 5 (to wall) -> PalletTown (10, 16)", "12.03 land_north_sand_bar from PalletTown (10, 17) facing south to Route21_North (7, 32) facing south", "12.03 walk south 34 (to wall) (lands after 31) -> Route21_North (10, 31) [surfing] [wild] [connection 3]", - "12.03 walk west 3 -> Route21_North (7, 31)", - "12.03 walk south 1 (to wall) -> Route21_North (7, 32)", + "12.03 walk west 1 -> Route21_North (9, 31)", + "12.03 walk south 1 (to wall) -> Route21_North (9, 32)", + "12.03 walk west 2 (to wall) -> Route21_North (7, 32)", + "12.03 face south -> Route21_North (7, 32)", "12.03 down_to_west_rock from Route21_North (7, 33) facing south to Route21_North (7, 38) facing south", "12.03 walk south 5 (to wall) -> Route21_North (7, 38) [surfing] [wild]", "12.03 past_spencer_east from Route21_North (7, 38) facing south to Route21_South (20, 3) facing south", @@ -140,9 +140,10 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12[] = { "12.03 down_column_16 from CinnabarIsland (16, 2) facing east to CinnabarIsland (16, 7) facing south", "12.03 walk south 5 (to wall) -> CinnabarIsland (16, 7)", "12.03 mansion_door from CinnabarIsland (16, 7) facing south to CinnabarIsland (8, 4) facing north", - "12.03 walk north 3 -> CinnabarIsland (16, 4)", - "12.03 walk west 8 -> CinnabarIsland (8, 4)", - "12.03 face north -> CinnabarIsland (8, 4)", + "12.03 walk east 3 (to wall) -> CinnabarIsland (19, 7)", + "12.03 walk north 2 (to wall) -> CinnabarIsland (19, 5)", + "12.03 walk west 11 -> CinnabarIsland (8, 5)", + "12.03 walk north 1 -> CinnabarIsland (8, 4)", }; // The stored plan lines of Erika's rows, 14.03 to 14.04b, after the rows of Blaine's @@ -156,14 +157,16 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12_CELADON[] = { "14.03 walk west 10 -> CeladonCity (31, 25)", "14.03 walk south 8 (to wall) -> CeladonCity (31, 33)", "14.03 walk east 9 -> CeladonCity (40, 33)", - "14.03 walk south 1 -> CeladonCity (40, 34)", + "14.03 walk south 1 (to wall) -> CeladonCity (40, 34)", "14.03 yard_west_wall from CeladonCity (40, 35) facing south to CeladonCity (4, 37) facing west", "14.03 walk south 2 (to wall) -> CeladonCity (40, 37)", "14.03 walk west 36 (to wall) -> CeladonCity (4, 37)", "14.03 below_tamia_line from CeladonCity (11, 37) facing east to CeladonCity_Gym (2, 11) facing north", "14.03 walk north 7 (warp) -> CeladonCity_Gym (6, 18)", - "14.03 walk west 4 -> CeladonCity_Gym (2, 18) [walk only]", - "14.03 walk north 7 -> CeladonCity_Gym (2, 11) [walk only]", + "14.03 walk west 5 (to wall) -> CeladonCity_Gym (1, 18) [walk only]", + "14.03 walk north 6 (to wall) -> CeladonCity_Gym (1, 12) [walk only]", + "14.03 walk east 1 -> CeladonCity_Gym (2, 12) [walk only]", + "14.03 walk north 1 -> CeladonCity_Gym (2, 11) [walk only]", "14.03 below_erika from CeladonCity_Gym (6, 5) facing east to CeladonCity_Gym (6, 5) facing north", "14.03 face north -> CeladonCity_Gym (6, 5) [walk only]", "14.04b out_of_gym from CeladonCity_Gym (2, 18) facing south to CeladonCity (11, 31) facing south", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h index 3645f2f9ac..25b1dedbb7 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h @@ -83,9 +83,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_13[] = { "13.04 walk east 3 -> PokemonMansion_B1F (30, 6) [wild]", "13.04 walk south 4 -> PokemonMansion_B1F (30, 10) [wild]", "13.04 walk west 29 (to wall) -> PokemonMansion_B1F (1, 10) [wild]", - "13.04 walk north 4 -> PokemonMansion_B1F (1, 6) [wild]", - "13.04 walk east 4 -> PokemonMansion_B1F (5, 6) [wild]", - "13.04 face south -> PokemonMansion_B1F (5, 6)", + "13.04 walk north 7 (to wall) -> PokemonMansion_B1F (1, 3) [wild]", + "13.04 walk east 4 -> PokemonMansion_B1F (5, 3) [wild]", + "13.04 walk south 3 (to wall) -> PokemonMansion_B1F (5, 6) [wild]", }; } // namespace PokemonFRLG diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden14.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden14.h index 2148336357..e4f82289d2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden14.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden14.h @@ -20,17 +20,17 @@ namespace PokemonFRLG{ // The stored plan lines from segment 14 on, after FRLG_PLAN_GOLDEN_12's. inline constexpr std::string_view FRLG_PLAN_GOLDEN_14[] = { "14.01 below_center_door from CinnabarIsland (8, 4) facing south to CinnabarIsland (14, 12) facing north", - "14.01 walk east 10 (to wall) -> CinnabarIsland (18, 4)", - "14.01 walk south 4 (to wall) -> CinnabarIsland (18, 8)", - "14.01 walk east 4 (to wall) -> CinnabarIsland (22, 8)", - "14.01 walk south 4 -> CinnabarIsland (22, 12)", - "14.01 walk west 8 -> CinnabarIsland (14, 12)", + "14.01 walk south 1 -> CinnabarIsland (8, 5)", + "14.01 walk east 13 (to wall) -> CinnabarIsland (21, 5)", + "14.01 walk south 7 -> CinnabarIsland (21, 12)", + "14.01 walk west 7 -> CinnabarIsland (14, 12)", "14.01 face north -> CinnabarIsland (14, 12)", "14.01 to_gym_east_room from CinnabarIsland_PokemonCenter_1F (0, 2) facing north to CinnabarIsland_Gym (25, 16) facing north", "14.01 walk south 3 (to wall) -> CinnabarIsland_PokemonCenter_1F (0, 5) [walk only]", "14.01 walk east 7 -> CinnabarIsland_PokemonCenter_1F (7, 5) [walk only]", "14.01 walk south 4 (warp) -> CinnabarIsland (14, 12) [walk only]", - "14.01 walk east 7 -> CinnabarIsland (21, 12)", + "14.01 walk east 8 (to wall) -> CinnabarIsland (22, 12)", + "14.01 walk west 1 -> CinnabarIsland (21, 12)", "14.01 walk north 7 (to wall) -> CinnabarIsland (21, 5)", "14.01 walk west 1 -> CinnabarIsland (20, 5)", "14.01 walk north 1 (warp) -> CinnabarIsland_Gym (25, 23)", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h index 9dc578c9f8..97eaab63f0 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h @@ -21,14 +21,17 @@ namespace PokemonFRLG{ inline constexpr std::string_view FRLG_PLAN_GOLDEN_16[] = { "16.01 silph_3f_by_pad from SaffronCity_PokemonCenter_1F (7, 4) facing north to SilphCo_3F (5, 6) facing west", "16.01 walk south 5 (warp) -> SaffronCity (24, 39) [walk only]", - "16.01 walk west 9 (to wall) -> SaffronCity (15, 39)", - "16.01 walk north 7 -> SaffronCity (15, 32)", - "16.01 walk east 18 -> SaffronCity (33, 32)", - "16.01 walk north 2 (warp) -> SilphCo_1F (8, 20)", - "16.01 walk north 15 (to wall) -> SilphCo_1F (8, 5)", - "16.01 walk east 23 -> SilphCo_1F (31, 5)", - "16.01 walk north 3 (to wall) -> SilphCo_1F (31, 2)", - "16.01 walk east 1 (warp) -> SilphCo_2F (30, 2)", + "16.01 walk west 7 -> SaffronCity (17, 39)", + "16.01 walk north 5 -> SaffronCity (17, 34)", + "16.01 walk east 16 -> SaffronCity (33, 34)", + "16.01 walk north 4 (warp) -> SilphCo_1F (8, 20)", + "16.01 walk east 14 (to wall) -> SilphCo_1F (22, 20)", + "16.01 walk north 4 (to wall) -> SilphCo_1F (22, 16)", + "16.01 walk east 7 (to wall) -> SilphCo_1F (29, 16)", + "16.01 walk north 12 (to wall) -> SilphCo_1F (29, 4)", + "16.01 walk east 1 -> SilphCo_1F (30, 4)", + "16.01 walk north 2 (to wall) -> SilphCo_1F (30, 2)", + "16.01 walk east 2 (warp) -> SilphCo_2F (30, 2)", "16.01 walk west 3 (warp) -> SilphCo_3F (28, 2)", "16.01 walk south 4 -> SilphCo_3F (28, 6)", "16.01 walk west 23 -> SilphCo_3F (5, 6)", @@ -40,7 +43,7 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_16[] = { "16.02 walk east 4 (warp) -> SilphCo_5F (10, 20)", "16.02 walk east 2 (to wall) -> SilphCo_5F (12, 20)", "16.03 to_3f_trainer from SilphCo_5F (21, 21) facing east to SilphCo_3F (22, 9) facing south", - "16.03 walk west 9 -> SilphCo_5F (12, 21)", + "16.03 walk west 9 (to wall) -> SilphCo_5F (12, 21)", "16.03 walk north 1 (to wall) -> SilphCo_5F (12, 20)", "16.03 walk west 2 (warp) -> SilphCo_9F (22, 18)", "16.03 walk west 4 (to wall) -> SilphCo_9F (18, 18)", @@ -48,8 +51,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_16[] = { "16.03 walk north 12 -> SilphCo_5F (10, 8)", "16.03 walk east 5 -> SilphCo_5F (15, 8)", "16.03 walk north 1 (warp) -> SilphCo_3F (4, 6)", - "16.03 walk east 18 -> SilphCo_3F (22, 6)", - "16.03 walk south 3 -> SilphCo_3F (22, 9)", + "16.03 walk south 1 (to wall) -> SilphCo_3F (4, 7)", + "16.03 walk east 18 -> SilphCo_3F (22, 7)", + "16.03 walk south 2 -> SilphCo_3F (22, 9)", "16.03 to_3f_door from SilphCo_3F (22, 9) facing south to SilphCo_3F (18, 13) facing west", "16.03 walk south 4 -> SilphCo_3F (22, 13)", "16.03 open gate west -> SilphCo_3F (22, 13)", @@ -60,8 +64,11 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_16[] = { "16.03 walk west 5 (warp) -> SilphCo_7F (5, 4)", "16.03 walk west 2 -> SilphCo_7F (3, 4)", "16.03b to_lapras_guy from SilphCo_7F (2, 4) facing south to SilphCo_7F (1, 7) facing west", - "16.03b walk west 1 -> SilphCo_7F (1, 4)", - "16.03b walk south 3 -> SilphCo_7F (1, 7)", + "16.03b walk south 1 (to wall) -> SilphCo_7F (2, 5)", + "16.03b walk west 2 (to wall) -> SilphCo_7F (0, 5)", + "16.03b walk south 1 (to wall) -> SilphCo_7F (0, 6)", + "16.03b walk east 1 (to wall) -> SilphCo_7F (1, 6)", + "16.03b walk south 1 -> SilphCo_7F (1, 7)", "16.03b face west -> SilphCo_7F (1, 7)", "16.05 to_left_wall from SilphCo_7F (1, 7) facing west to SilphCo_11F (0, 18) facing south", "16.05 walk east 4 (to wall) -> SilphCo_7F (5, 7)", @@ -75,8 +82,11 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_16[] = { "16.05 open gate north -> SilphCo_11F (5, 18)", "16.05 walk north 2 -> SilphCo_11F (5, 16)", "16.05b below_president from SilphCo_11F (5, 15) facing east to SilphCo_11F (9, 10) facing north", - "16.05b walk north 5 -> SilphCo_11F (5, 10)", - "16.05b walk east 4 -> SilphCo_11F (9, 10)", + "16.05b walk north 7 (to wall) -> SilphCo_11F (5, 8)", + "16.05b walk south 1 -> SilphCo_11F (5, 9)", + "16.05b walk east 3 (to wall) -> SilphCo_11F (8, 9)", + "16.05b walk south 1 (to wall) -> SilphCo_11F (8, 10)", + "16.05b walk east 1 -> SilphCo_11F (9, 10)", "16.05b face north -> SilphCo_11F (9, 10)", "16.06 below_center_door from SaffronCity (24, 39) facing south to SaffronCity (24, 39) facing north", "16.06 face north -> SaffronCity (24, 39)", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h index 2f9d11625b..c0ad3162d6 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden17.h @@ -21,10 +21,12 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_17_GYM[] = { "17.02 saffron_outside from SaffronCity_PokemonCenter_1F (7, 4) facing north to SaffronCity (24, 39) facing south", "17.02 walk south 5 (warp) -> SaffronCity (24, 39) [walk only]", "17.02 below_gym_door from ViridianCity (26, 27) facing south to ViridianCity (36, 11) facing north", - "17.02 walk west 4 -> ViridianCity (22, 27)", - "17.02 walk north 21 -> ViridianCity (22, 6)", - "17.02 walk east 19 (to wall) -> ViridianCity (41, 6)", - "17.02 walk south 5 -> ViridianCity (41, 11)", + "17.02 walk west 5 -> ViridianCity (21, 27)", + "17.02 walk north 20 (to wall) -> ViridianCity (21, 7)", + "17.02 walk east 11 (to wall) -> ViridianCity (32, 7)", + "17.02 walk north 3 (to wall) -> ViridianCity (32, 4)", + "17.02 walk east 9 (to wall) -> ViridianCity (41, 4)", + "17.02 walk south 7 -> ViridianCity (41, 11)", "17.02 walk west 5 -> ViridianCity (36, 11)", "17.02 face north -> ViridianCity (36, 11)", "17.02 below_warren_line from ViridianCity_Gym (17, 22) facing north to ViridianCity_Gym (15, 8) facing north", @@ -34,21 +36,34 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_17_GYM[] = { "17.02 walk west 1 -> ViridianCity_Gym (13, 13) [walk only]", "17.02 walk north 3 (to wall) -> ViridianCity_Gym (13, 10) [walk only]", "17.02 walk east 3 (to wall) -> ViridianCity_Gym (16, 10) [walk only]", - "17.02 walk north 2 -> ViridianCity_Gym (16, 8) [walk only]", - "17.02 walk west 1 (to wall) -> ViridianCity_Gym (15, 8) [walk only]", - "17.02 face north -> ViridianCity_Gym (15, 8) [walk only]", - "17.03 below_takashi_line from ViridianCity_Gym (15, 7) facing north to ViridianCity_Gym (10, 6) facing north", - "17.03 walk north 1 (to wall) -> ViridianCity_Gym (15, 6) [walk only]", - "17.03 walk west 3 (to wall) -> ViridianCity_Gym (12, 6) [walk only]", + "17.02 walk north 1 -> ViridianCity_Gym (16, 9) [walk only]", + "17.02 walk west 1 (to wall) -> ViridianCity_Gym (15, 9) [walk only]", + "17.02 walk north 1 -> ViridianCity_Gym (15, 8) [walk only]", + "17.03 right_of_takashi from ViridianCity_Gym (15, 7) facing north to ViridianCity_Gym (11, 2) facing west", + "17.03 walk east 1 (to wall) -> ViridianCity_Gym (16, 7) [walk only]", + "17.03 walk south 6 (spins 2) -> ViridianCity_Gym (16, 15) [walk only]", + "17.03 walk east 3 (to wall) -> ViridianCity_Gym (19, 15) [walk only]", + "17.03 walk north 1 (spins 11) -> ViridianCity_Gym (19, 3) [walk only]", + "17.03 walk north 1 (spins 8) -> ViridianCity_Gym (11, 2) [walk only]", + "17.03 below_giovanni from ViridianCity_Gym (11, 2) facing west to ViridianCity_Gym (2, 3) facing north", + "17.03 walk south 1 (spins 6) -> ViridianCity_Gym (17, 3) [walk only]", + "17.03 walk east 1 (spins 11) -> ViridianCity_Gym (18, 14) [walk only]", + "17.03 walk south 1 -> ViridianCity_Gym (18, 15) [walk only]", + "17.03 walk west 4 (to wall) -> ViridianCity_Gym (14, 15) [walk only]", + "17.03 walk north 2 (to wall) -> ViridianCity_Gym (14, 13) [walk only]", + "17.03 walk west 1 -> ViridianCity_Gym (13, 13) [walk only]", + "17.03 walk north 3 (to wall) -> ViridianCity_Gym (13, 10) [walk only]", + "17.03 walk east 3 (to wall) -> ViridianCity_Gym (16, 10) [walk only]", + "17.03 walk north 4 (to wall) -> ViridianCity_Gym (16, 6) [walk only]", + "17.03 walk west 4 (to wall) -> ViridianCity_Gym (12, 6) [walk only]", "17.03 walk south 1 (to wall) -> ViridianCity_Gym (12, 7) [walk only]", "17.03 walk west 2 (to wall) -> ViridianCity_Gym (10, 7) [walk only]", - "17.03 walk north 1 -> ViridianCity_Gym (10, 6) [walk only]", - "17.03 below_giovanni from ViridianCity_Gym (10, 5) facing north to ViridianCity_Gym (2, 3) facing north", - "17.03 walk north 2 -> ViridianCity_Gym (10, 3) [walk only]", + "17.03 walk north 4 -> ViridianCity_Gym (10, 3) [walk only]", "17.03 walk west 3 -> ViridianCity_Gym (7, 3) [walk only]", "17.03 walk south 3 (to wall) -> ViridianCity_Gym (7, 6) [walk only]", - "17.03 walk west 5 -> ViridianCity_Gym (2, 6) [walk only]", - "17.03 walk north 3 -> ViridianCity_Gym (2, 3) [walk only]", + "17.03 walk west 6 (to wall) -> ViridianCity_Gym (1, 6) [walk only]", + "17.03 walk east 1 -> ViridianCity_Gym (2, 6) [walk only]", + "17.03 walk north 3 (to wall) -> ViridianCity_Gym (2, 3) [walk only]", "17.04b gym_exit from ViridianCity_Gym (2, 3) facing north to ViridianCity (36, 11) facing south", "17.04b walk south 4 (to wall) -> ViridianCity_Gym (2, 7) [walk only]", "17.04b walk east 4 (to wall) -> ViridianCity_Gym (6, 7) [walk only]", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h index 566d9b212d..70631b504f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h @@ -22,7 +22,8 @@ namespace PokemonFRLG{ // trip to Celadon. inline constexpr std::string_view FRLG_PLAN_GOLDEN_18[] = { "18.01 by_pad_to_bottom_right from SaffronCity_Gym (14, 23) facing north to SaffronCity_Gym (17, 20) facing east", - "18.01 walk east 3 -> SaffronCity_Gym (17, 23) [walk only]", + "18.01 walk east 4 (to wall) -> SaffronCity_Gym (18, 23) [walk only]", + "18.01 walk west 1 -> SaffronCity_Gym (17, 23) [walk only]", "18.01 walk north 3 -> SaffronCity_Gym (17, 20) [walk only]", "18.01 face east -> SaffronCity_Gym (17, 20) [walk only]", "18.01 along_row_22 from SaffronCity_Gym (28, 23) facing east to SaffronCity_Gym (20, 22) facing west", @@ -31,14 +32,14 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_18[] = { "18.01 below_pad_to_top_right from SaffronCity_Gym (20, 22) facing west to SaffronCity_Gym (20, 21) facing north", "18.01 walk north 1 -> SaffronCity_Gym (20, 21) [walk only]", "18.01 by_pad_to_top_left from SaffronCity_Gym (28, 4) facing north to SaffronCity_Gym (20, 6) facing south", - "18.01 walk south 2 -> SaffronCity_Gym (28, 6) [walk only]", - "18.01 walk west 8 (to wall) -> SaffronCity_Gym (20, 6) [walk only]", - "18.01 face south -> SaffronCity_Gym (20, 6) [walk only]", + "18.01 walk south 1 -> SaffronCity_Gym (28, 5) [walk only]", + "18.01 walk west 8 (to wall) -> SaffronCity_Gym (20, 5) [walk only]", + "18.01 walk south 1 -> SaffronCity_Gym (20, 6) [walk only]", "18.01 by_pad_to_sabrina from SaffronCity_Gym (0, 4) facing south to SaffronCity_Gym (0, 6) facing south", "18.01 walk south 2 -> SaffronCity_Gym (0, 6) [walk only]", "18.01 below_sabrina from SaffronCity_Gym (18, 15) facing south to SaffronCity_Gym (14, 12) facing north", "18.01 walk west 4 -> SaffronCity_Gym (14, 15) [walk only]", - "18.01 walk north 3 -> SaffronCity_Gym (14, 12) [walk only]", + "18.01 walk north 3 (to wall) -> SaffronCity_Gym (14, 12) [walk only]", "18.02b below_center_door from SaffronCity (24, 39) facing south to SaffronCity (24, 39) facing north", "18.02b face north -> SaffronCity (24, 39)", "18.03 saffron_outside from SaffronCity_PokemonCenter_1F (7, 4) facing north to SaffronCity (24, 39) facing south", @@ -52,9 +53,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_18[] = { "18.03 walk west 4 -> CeladonCity_DepartmentStore_1F (6, 5) [walk only]", "18.03 walk north 3 -> CeladonCity_DepartmentStore_1F (6, 2) [walk only]", "18.03 x_items_clerk from CeladonCity_DepartmentStore_5F (6, 2) facing south to CeladonCity_DepartmentStore_5F (3, 7) facing west", - "18.03 walk south 4 -> CeladonCity_DepartmentStore_5F (6, 6) [walk only]", - "18.03 walk west 3 (to wall) -> CeladonCity_DepartmentStore_5F (3, 6) [walk only]", - "18.03 walk south 1 -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", + "18.03 walk south 1 -> CeladonCity_DepartmentStore_5F (6, 3) [walk only]", + "18.03 walk west 3 (to wall) -> CeladonCity_DepartmentStore_5F (3, 3) [walk only]", + "18.03 walk south 4 -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", "18.03 face west -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", "18.03 below_5f_lift from CeladonCity_DepartmentStore_5F (3, 7) facing west to CeladonCity_DepartmentStore_5F (6, 2) facing north", "18.03 walk north 5 (to wall) -> CeladonCity_DepartmentStore_5F (3, 2) [walk only]", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden19.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden19.h index 4ebda27e66..0dfc835fe1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden19.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden19.h @@ -28,16 +28,17 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.01a face west -> ViridianCity_Mart (4, 3) [walk only]", "19.01 route22_east_of_trigger from ViridianCity_Mart (4, 3) facing west to Route22 (34, 5) facing west", "19.01 walk south 5 (warp) -> ViridianCity (36, 20) [walk only]", - "19.01 walk west 13 -> ViridianCity (23, 20)", - "19.01 walk north 1 (to wall) -> ViridianCity (23, 19)", - "19.01 walk west 29 (to wall) -> Route22 (42, 9) [connection 24]", + "19.01 walk west 16 -> ViridianCity (20, 20)", + "19.01 walk north 1 -> ViridianCity (20, 19)", + "19.01 walk west 26 (to wall) -> Route22 (42, 9) [connection 21]", "19.01 walk south 5 -> Route22 (42, 14)", "19.01 walk west 6 -> Route22 (36, 14)", "19.01 walk north 9 -> Route22 (36, 5) [wild]", "19.01 walk west 2 -> Route22 (34, 5)", "19.02 above_route22_ledge from Route22 (33, 5) facing west to Route22 (18, 7) facing south", - "19.02 walk west 15 -> Route22 (18, 5)", - "19.02 walk south 2 -> Route22 (18, 7)", + "19.02 walk south 1 (to wall) -> Route22 (33, 6)", + "19.02 walk west 15 -> Route22 (18, 6)", + "19.02 walk south 1 -> Route22 (18, 7)", "19.02 below_gate_guard_trigger from Route22 (18, 9) facing south to Route22_NorthEntrance (7, 3) facing north", "19.02 walk south 5 -> Route22 (18, 14) [wild]", "19.02 walk west 14 (to wall) -> Route22 (4, 14)", @@ -48,30 +49,34 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.02 walk north 1 (warp) -> Route22_NorthEntrance (7, 10)", "19.02 walk north 7 -> Route22_NorthEntrance (7, 3) [walk only]", "19.03 cascade_guard_approach from Route23 (8, 153) facing north to Route23 (13, 150) facing north", - "19.03 walk north 3 -> Route23 (8, 150)", + "19.03 walk north 4 (to wall) -> Route23 (8, 149)", + "19.03 walk south 1 -> Route23 (8, 150)", "19.03 walk east 5 -> Route23 (13, 150)", "19.03 face north -> Route23 (13, 150)", "19.03 thunder_guard_approach from Route23 (13, 149) facing north to Route23 (7, 141) facing north", - "19.03 walk north 8 -> Route23 (13, 141)", + "19.03 walk north 9 (to wall) -> Route23 (13, 140)", + "19.03 walk south 1 -> Route23 (13, 141)", "19.03 walk west 6 -> Route23 (7, 141)", "19.03 face north -> Route23 (7, 141)", "19.03 rainbow_guard_approach from Route23 (7, 140) facing north to Route23 (12, 124) facing north", "19.03 walk north 9 (to wall) -> Route23 (7, 131)", "19.03 walk west 5 (to wall) -> Route23 (2, 131)", - "19.03 walk north 7 -> Route23 (2, 124)", + "19.03 walk north 8 (to wall) -> Route23 (2, 123)", + "19.03 walk south 1 -> Route23 (2, 124)", "19.03 walk east 10 -> Route23 (12, 124)", "19.03 face north -> Route23 (12, 124)", "19.03 soul_shore from Route23 (12, 123) facing north to Route23 (13, 118) facing north", - "19.03 walk north 5 (to wall) -> Route23 (12, 118)", - "19.03 walk east 1 -> Route23 (13, 118)", - "19.03 face north -> Route23 (13, 118)", + "19.03 walk east 1 (to wall) -> Route23 (13, 123)", + "19.03 walk north 5 (to wall) -> Route23 (13, 118)", "19.03 soul_guard_approach from Route23 (13, 117) facing north to Route23 (13, 113) facing north", "19.03 walk north 4 -> Route23 (13, 113) [surfing] [wild]", "19.03 marsh_guard_approach from Route23 (13, 112) facing north to Route23 (9, 95) facing north", "19.03 walk north 13 (to wall) (lands after 9) -> Route23 (13, 99) [surfing] [wild]", - "19.03 walk west 4 -> Route23 (9, 99)", - "19.03 surf north -> Route23 (9, 98) [wild]", - "19.03 walk north 3 -> Route23 (9, 95) [surfing] [wild]", + "19.03 walk west 3 -> Route23 (10, 99)", + "19.03 surf north -> Route23 (10, 98) [wild]", + "19.03 walk north 3 (to wall) -> Route23 (10, 95) [surfing] [wild]", + "19.03 walk west 1 -> Route23 (9, 95) [surfing] [wild]", + "19.03 face north -> Route23 (9, 95) [surfing]", "19.03 land_below_volcano from Route23 (9, 94) facing north to Route23 (17, 77) facing north", "19.03 walk north 17 (to wall) (lands after 16) -> Route23 (9, 77) [surfing] [wild]", "19.03 walk east 8 -> Route23 (17, 77)", @@ -83,21 +88,28 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.03 face north -> Route23 (12, 62)", "19.03 earth_guard_approach from Route23 (12, 61) facing north to Route23 (5, 36) facing north", "19.03 walk north 14 (to wall) -> Route23 (12, 47)", - "19.03 walk west 3 (to wall) -> Route23 (9, 47)", - "19.03 walk north 5 (to wall) -> Route23 (9, 42)", - "19.03 walk west 4 -> Route23 (5, 42)", - "19.03 walk north 6 -> Route23 (5, 36)", + "19.03 walk west 1 -> Route23 (11, 47)", + "19.03 walk north 2 (to wall) -> Route23 (11, 45)", + "19.03 walk west 5 (to wall) -> Route23 (6, 45)", + "19.03 walk north 9 (to wall) -> Route23 (6, 36)", + "19.03 walk west 1 -> Route23 (5, 36)", + "19.03 face north -> Route23 (5, 36)", "19.03 victory_road_mouth from Route23 (5, 35) facing north to Route23 (5, 29) facing north", "19.03 walk north 6 -> Route23 (5, 29)", "19.04b behind_boulder_1 from VictoryRoad_1F (11, 20) facing north to VictoryRoad_1F (7, 17)", "19.04b walk west 3 (to wall) -> VictoryRoad_1F (8, 20) [wild]", "19.04b walk north 1 (to wall) -> VictoryRoad_1F (8, 19) [wild]", - "19.04b walk west 2 -> VictoryRoad_1F (6, 19) [wild]", - "19.04b walk north 2 (to wall) -> VictoryRoad_1F (6, 17) [wild]", + "19.04b walk west 4 (to wall) -> VictoryRoad_1F (4, 19) [wild]", + "19.04b walk north 1 (to wall) -> VictoryRoad_1F (4, 18) [wild]", + "19.04b walk east 2 (to wall) -> VictoryRoad_1F (6, 18) [wild]", + "19.04b walk north 1 (to wall) -> VictoryRoad_1F (6, 17) [wild]", "19.04b walk east 1 (to wall) -> VictoryRoad_1F (7, 17) [wild]", "19.04b by_boulder_2_corner from VictoryRoad_1F (7, 18) facing south to VictoryRoad_1F (6, 18)", - "19.04b walk west 1 -> VictoryRoad_1F (6, 18) [wild]", - "19.04b behind_boulder_2 from VictoryRoad_1F (6, 18) facing west to VictoryRoad_1F (6, 19)", + "19.04b walk south 1 (to wall) -> VictoryRoad_1F (7, 19) [wild]", + "19.04b walk west 3 (to wall) -> VictoryRoad_1F (4, 19) [wild]", + "19.04b walk north 1 (to wall) -> VictoryRoad_1F (4, 18) [wild]", + "19.04b walk east 2 (to wall) -> VictoryRoad_1F (6, 18) [wild]", + "19.04b behind_boulder_2 from VictoryRoad_1F (6, 18) facing east to VictoryRoad_1F (6, 19)", "19.04b walk south 1 (to wall) -> VictoryRoad_1F (6, 19) [wild]", "19.04b by_boulder_3_corner from VictoryRoad_1F (11, 19) facing east to VictoryRoad_1F (10, 20)", "19.04b walk south 1 -> VictoryRoad_1F (11, 20)", @@ -135,8 +147,10 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.04b walk north 1 (warp) -> VictoryRoad_1F (11, 20)", "19.04b walk west 3 (to wall) -> VictoryRoad_1F (8, 20) [wild]", "19.04b walk north 1 (to wall) -> VictoryRoad_1F (8, 19) [wild]", - "19.04b walk west 2 -> VictoryRoad_1F (6, 19) [wild]", - "19.04b walk north 2 (to wall) -> VictoryRoad_1F (6, 17) [wild]", + "19.04b walk west 4 (to wall) -> VictoryRoad_1F (4, 19) [wild]", + "19.04b walk north 1 (to wall) -> VictoryRoad_1F (4, 18) [wild]", + "19.04b walk east 2 (to wall) -> VictoryRoad_1F (6, 18) [wild]", + "19.04b walk north 1 (to wall) -> VictoryRoad_1F (6, 17) [wild]", "19.04b walk east 1 (to wall) -> VictoryRoad_1F (7, 17) [wild]", "19.04b walk north 6 (to wall) -> VictoryRoad_1F (7, 11) [wild]", "19.04b walk east 3 (to wall) -> VictoryRoad_1F (10, 11) [wild]", @@ -146,19 +160,19 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.04b walk west 5 -> VictoryRoad_1F (10, 5) [wild]", "19.04b walk south 5 (to wall) -> VictoryRoad_1F (10, 10) [wild]", "19.04b walk west 5 (to wall) -> VictoryRoad_1F (5, 10) [wild]", - "19.04b walk north 3 -> VictoryRoad_1F (5, 7) [wild]", - "19.04b walk west 1 -> VictoryRoad_1F (4, 7) [wild]", - "19.04b face north -> VictoryRoad_1F (4, 7)", + "19.04b walk north 1 -> VictoryRoad_1F (5, 9) [wild]", + "19.04b walk west 1 (to wall) -> VictoryRoad_1F (4, 9) [wild]", + "19.04b walk north 2 -> VictoryRoad_1F (4, 7) [wild]", "19.04b ladder_2f from VictoryRoad_1F (4, 7) facing north to VictoryRoad_2F (1, 9)", "19.04b walk north 5 (to wall) -> VictoryRoad_1F (4, 2) [wild]", "19.04b walk west 1 (warp) -> VictoryRoad_2F (1, 9)", "19.04c behind_boulder_1 from VictoryRoad_2F (1, 9) facing west to VictoryRoad_2F (7, 17)", "19.04c walk south 1 (to wall) -> VictoryRoad_2F (1, 10) [wild]", "19.04c walk east 5 (to wall) -> VictoryRoad_2F (6, 10) [wild]", - "19.04c walk south 6 -> VictoryRoad_2F (6, 16) [wild]", + "19.04c walk south 6 (to wall) -> VictoryRoad_2F (6, 16) [wild]", "19.04c walk east 6 (to wall) -> VictoryRoad_2F (12, 16) [wild]", "19.04c walk south 1 (to wall) -> VictoryRoad_2F (12, 17) [wild]", - "19.04c walk west 5 -> VictoryRoad_2F (7, 17) [wild]", + "19.04c walk west 5 (to wall) -> VictoryRoad_2F (7, 17) [wild]", "19.04c by_boulder_2_corner from VictoryRoad_2F (5, 17) facing west to VictoryRoad_2F (5, 16)", "19.04c walk north 1 -> VictoryRoad_2F (5, 16) [wild]", "19.04c behind_boulder_2 from VictoryRoad_2F (5, 16) facing north to VictoryRoad_2F (4, 16)", @@ -169,8 +183,10 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.04c walk south 1 (to wall) -> VictoryRoad_2F (5, 19) [wild]", "19.04c ladder_3f from VictoryRoad_2F (3, 19) facing west to VictoryRoad_3F (5, 2)", "19.04c walk east 2 (to wall) -> VictoryRoad_2F (5, 19) [wild]", - "19.04c walk north 6 -> VictoryRoad_2F (5, 13) [wild]", - "19.04c walk east 4 -> VictoryRoad_2F (9, 13) [wild]", + "19.04c walk north 1 -> VictoryRoad_2F (5, 18) [wild]", + "19.04c walk east 3 (to wall) -> VictoryRoad_2F (8, 18) [wild]", + "19.04c walk north 5 (to wall) -> VictoryRoad_2F (8, 13) [wild]", + "19.04c walk east 1 -> VictoryRoad_2F (9, 13) [wild]", "19.04c walk north 3 (to wall) -> VictoryRoad_2F (9, 10) [wild]", "19.04c walk east 13 (to wall) -> VictoryRoad_2F (22, 10) [wild]", "19.04c walk south 7 (to wall) -> VictoryRoad_2F (22, 17) [wild]", @@ -199,8 +215,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.04c walk east 4 (to wall) -> VictoryRoad_3F (12, 4) [wild]", "19.04c walk north 2 (to wall) -> VictoryRoad_3F (12, 2) [wild]", "19.04c walk east 19 -> VictoryRoad_3F (31, 2) [wild]", - "19.04c walk south 4 -> VictoryRoad_3F (31, 6) [wild]", - "19.04c walk east 1 -> VictoryRoad_3F (32, 6) [wild]", + "19.04c walk south 9 (to wall) -> VictoryRoad_3F (31, 11) [wild]", + "19.04c walk east 1 -> VictoryRoad_3F (32, 11) [wild]", + "19.04c walk north 5 (to wall) -> VictoryRoad_3F (32, 6) [wild]", "19.04c by_boulder_5_corner from VictoryRoad_3F (32, 4) facing north to VictoryRoad_3F (33, 4)", "19.04c walk east 1 -> VictoryRoad_3F (33, 4) [wild]", "19.04c behind_boulder_5 from VictoryRoad_3F (33, 4) facing east to VictoryRoad_3F (33, 3)", @@ -250,8 +267,9 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_19[] = { "19.04d hole_way_9 from VictoryRoad_3F (17, 15) facing east to VictoryRoad_3F (17, 19)", "19.04d walk south 4 (to wall) -> VictoryRoad_3F (17, 19) [wild]", "19.04d behind_hole_boulder from VictoryRoad_3F (17, 19) facing south to VictoryRoad_3F (32, 18)", - "19.04d walk east 15 -> VictoryRoad_3F (32, 19) [wild]", - "19.04d walk north 1 -> VictoryRoad_3F (32, 18) [wild]", + "19.04d walk east 4 -> VictoryRoad_3F (21, 19) [wild]", + "19.04d walk north 1 -> VictoryRoad_3F (21, 18) [wild]", + "19.04d walk east 11 (to wall) -> VictoryRoad_3F (32, 18) [wild]", "19.04d drop_to_2f from VictoryRoad_3F (33, 18) facing east to VictoryRoad_2F (34, 19)", "19.04d walk east 1 (warp) -> VictoryRoad_2F (34, 19) [wild]", "19.04d exit_way_1 from VictoryRoad_2F (15, 19) facing west to VictoryRoad_2F (31, 19)", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden20.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden20.h index c33f20da89..d76feb6afe 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden20.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden20.h @@ -20,39 +20,41 @@ namespace PokemonFRLG{ // The stored plan lines of 20.01a and after. inline constexpr std::string_view FRLG_PLAN_GOLDEN_20[] = { "20.01a indigo_mart_clerk from IndigoPlateau_PokemonCenter_1F (13, 12) facing north to IndigoPlateau_PokemonCenter_1F (2, 7) facing west", - "20.01a walk west 10 -> IndigoPlateau_PokemonCenter_1F (3, 12) [walk only]", - "20.01a walk north 5 -> IndigoPlateau_PokemonCenter_1F (3, 7) [walk only]", - "20.01a walk west 1 (to wall) -> IndigoPlateau_PokemonCenter_1F (2, 7) [walk only]", + "20.01a walk west 9 -> IndigoPlateau_PokemonCenter_1F (4, 12) [walk only]", + "20.01a walk north 5 -> IndigoPlateau_PokemonCenter_1F (4, 7) [walk only]", + "20.01a walk west 2 (to wall) -> IndigoPlateau_PokemonCenter_1F (2, 7) [walk only]", "20.01 below_league_door from IndigoPlateau_PokemonCenter_1F (2, 7) facing west to IndigoPlateau_PokemonCenter_1F (4, 2) facing north", - "20.01 walk east 2 -> IndigoPlateau_PokemonCenter_1F (4, 7) [walk only]", - "20.01 walk north 5 -> IndigoPlateau_PokemonCenter_1F (4, 2) [walk only]", + "20.01 walk east 1 -> IndigoPlateau_PokemonCenter_1F (3, 7) [walk only]", + "20.01 walk north 5 (to wall) -> IndigoPlateau_PokemonCenter_1F (3, 2) [walk only]", + "20.01 walk east 1 -> IndigoPlateau_PokemonCenter_1F (4, 2) [walk only]", + "20.01 face north -> IndigoPlateau_PokemonCenter_1F (4, 2) [walk only]", "20.01 before_lorelei from PokemonLeague_LoreleisRoom (6, 7) facing north to PokemonLeague_LoreleisRoom (6, 6) facing north", - "20.01 walk north 1 -> PokemonLeague_LoreleisRoom (6, 6) [walk only]", + "20.01 walk north 1 (to wall) -> PokemonLeague_LoreleisRoom (6, 6) [walk only]", "20.02 below_loreleis_door from PokemonLeague_LoreleisRoom (6, 6) facing north to PokemonLeague_LoreleisRoom (6, 3) facing north", - "20.02 walk east 3 (to wall) -> PokemonLeague_LoreleisRoom (9, 6) [walk only]", - "20.02 walk north 3 (to wall) -> PokemonLeague_LoreleisRoom (9, 3) [walk only]", - "20.02 walk west 3 -> PokemonLeague_LoreleisRoom (6, 3) [walk only]", + "20.02 walk east 1 -> PokemonLeague_LoreleisRoom (7, 6) [walk only]", + "20.02 walk north 3 (to wall) -> PokemonLeague_LoreleisRoom (7, 3) [walk only]", + "20.02 walk west 1 -> PokemonLeague_LoreleisRoom (6, 3) [walk only]", "20.02 face north -> PokemonLeague_LoreleisRoom (6, 3) [walk only]", "20.02 before_bruno from PokemonLeague_BrunosRoom (6, 7) facing north to PokemonLeague_BrunosRoom (6, 6) facing north", - "20.02 walk north 1 -> PokemonLeague_BrunosRoom (6, 6) [walk only]", + "20.02 walk north 1 (to wall) -> PokemonLeague_BrunosRoom (6, 6) [walk only]", "20.03 below_brunos_door from PokemonLeague_BrunosRoom (6, 6) facing north to PokemonLeague_BrunosRoom (6, 3) facing north", - "20.03 walk east 3 (to wall) -> PokemonLeague_BrunosRoom (9, 6) [walk only]", - "20.03 walk north 3 (to wall) -> PokemonLeague_BrunosRoom (9, 3) [walk only]", - "20.03 walk west 3 -> PokemonLeague_BrunosRoom (6, 3) [walk only]", + "20.03 walk east 1 -> PokemonLeague_BrunosRoom (7, 6) [walk only]", + "20.03 walk north 3 (to wall) -> PokemonLeague_BrunosRoom (7, 3) [walk only]", + "20.03 walk west 1 -> PokemonLeague_BrunosRoom (6, 3) [walk only]", "20.03 face north -> PokemonLeague_BrunosRoom (6, 3) [walk only]", "20.03 before_agatha from PokemonLeague_AgathasRoom (6, 7) facing north to PokemonLeague_AgathasRoom (6, 6) facing north", - "20.03 walk north 1 -> PokemonLeague_AgathasRoom (6, 6) [walk only]", + "20.03 walk north 1 (to wall) -> PokemonLeague_AgathasRoom (6, 6) [walk only]", "20.04 below_agathas_door from PokemonLeague_AgathasRoom (6, 6) facing north to PokemonLeague_AgathasRoom (6, 3) facing north", - "20.04 walk east 3 (to wall) -> PokemonLeague_AgathasRoom (9, 6) [walk only]", - "20.04 walk north 3 (to wall) -> PokemonLeague_AgathasRoom (9, 3) [walk only]", - "20.04 walk west 3 -> PokemonLeague_AgathasRoom (6, 3) [walk only]", + "20.04 walk east 1 -> PokemonLeague_AgathasRoom (7, 6) [walk only]", + "20.04 walk north 3 (to wall) -> PokemonLeague_AgathasRoom (7, 3) [walk only]", + "20.04 walk west 1 -> PokemonLeague_AgathasRoom (6, 3) [walk only]", "20.04 face north -> PokemonLeague_AgathasRoom (6, 3) [walk only]", "20.04 before_lance from PokemonLeague_LancesRoom (6, 10) facing north to PokemonLeague_LancesRoom (6, 9) facing north", - "20.04 walk north 1 -> PokemonLeague_LancesRoom (6, 9) [walk only]", + "20.04 walk north 1 (to wall) -> PokemonLeague_LancesRoom (6, 9) [walk only]", "20.05 below_champions_door from PokemonLeague_LancesRoom (6, 9) facing north to PokemonLeague_LancesRoom (6, 6) facing north", - "20.05 walk east 3 (to wall) -> PokemonLeague_LancesRoom (9, 9) [walk only]", - "20.05 walk north 3 (to wall) -> PokemonLeague_LancesRoom (9, 6) [walk only]", - "20.05 walk west 3 -> PokemonLeague_LancesRoom (6, 6) [walk only]", + "20.05 walk east 1 -> PokemonLeague_LancesRoom (7, 9) [walk only]", + "20.05 walk north 3 (to wall) -> PokemonLeague_LancesRoom (7, 6) [walk only]", + "20.05 walk west 1 -> PokemonLeague_LancesRoom (6, 6) [walk only]", "20.05 face north -> PokemonLeague_LancesRoom (6, 6) [walk only]", }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.cpp index b6379e390b..f7a9fb0998 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.cpp @@ -16,6 +16,7 @@ #include "Pokemon/AutoStory/Pokemon_TilePose.h" #include "PokemonFRLG_AutoStoryBoulders.h" #include "PokemonFRLG_AutoStoryLegs.h" +#include "PokemonFRLG_AutoStoryLineTrainer.h" #include "PokemonFRLG_AutoStoryPacedRoute.h" #include "PokemonFRLG_AutoStoryActions.h" #include "PokemonFRLG_AutoStoryBattleDecisions.h" @@ -177,7 +178,7 @@ Outcome StoryMapsSim::run_action(const StoryStep& step, RunState& state){ } m_dialog_up = false; } - return regrow_on_warp(maps(), [&]{ return Pokemon::TableExecutor::run_action(step, state); }, state); + return trainers_back_on_warp([&]{ return regrow_on_warp(maps(state), [&]{ return Pokemon::TableExecutor::run_action(step, state); }, state); }, state); } Pokemon::ScreenLook StoryMapsSim::look(){ @@ -229,11 +230,11 @@ Pokemon::StoryAction StoryMapsSim::action(StoryActionId id){ return played([this](const StoryStep& step, RunState&){ return shop(step); }); // A push leaves the player behind the boulder, a switch on if it lands on one. case StoryActionId::PUSH_BOULDER: - return played([this](const StoryStep& step, RunState& state){ return boulder_pushed(state, step, maps()); }); + return played([this](const StoryStep& step, RunState& state){ return boulder_pushed(state, step, maps(state)); }); // Pacing leaves the player on either of its tiles, as on the console. // A cut leaves the player on the tree's tile, its gate open. case StoryActionId::CUT_TREE: - return m_stubs.stub([this](const StoryStep& step, RunState& state){ return tree_cut(state, step, maps()); }); + return m_stubs.stub([this](const StoryStep& step, RunState& state){ return tree_cut(state, step, maps(state)); }); case StoryActionId::CLOSE_TRAINER_CARD: case StoryActionId::LEAVE_GIFT_SUMMARY: case StoryActionId::TRASH_CANS: @@ -254,11 +255,11 @@ Pokemon::StoryAction StoryMapsSim::action(StoryActionId id){ } Outcome StoryMapsSim::legs(const RunState& state, const StoryStep& step) const{ - const Standing at = standing(state.pose, maps()); + const Standing at = standing(state.pose, maps(state)); if (!at.error.empty()){ return Pokemon::outcome_failed("no_pose", at.error); } - const std::optional> route = fixed_route(resolve_maps(maps(), state.gates), at.position, Pokemon::story_arg>(step.args, "legs")); + const std::optional> route = fixed_route(resolve_maps(maps(state), state.gates), at.position, Pokemon::story_arg>(step.args, "legs")); if (!route || route->empty()){ return Pokemon::outcome_failed("bad_legs", to_string(at.position)); } @@ -319,8 +320,8 @@ Outcome StoryMapsSim::shop(const StoryStep& step){ return Pokemon::outcome_ok(); } -const std::vector& StoryMapsSim::maps() const{ - return m_knobs.maps != nullptr ? *m_knobs.maps : story_maps(); +const std::vector& StoryMapsSim::maps(const Pokemon::RunState& state) const{ + return m_knobs.maps != nullptr ? *m_knobs.maps : run_story_maps(state.flags); } Outcome StoryMapsSim::walk_to(Pokemon::RunState& state, const StoryStep& step) const{ @@ -331,30 +332,30 @@ Outcome StoryMapsSim::walk_to(Pokemon::RunState& state, const StoryStep& step) c // test_routes_after_pacing() walks it on the sim from each. const std::optional target = story_pose(Pokemon::pose_of(Pokemon::story_arg(step.args, "target"))); const RouteGoal goal{{target->map, target->tile}, target->facing}; - const std::optional> route = plan_story_route(maps(), pose, std::nullopt, goal, state.gates, rules); + const std::optional> route = plan_story_route(maps(state), pose, std::nullopt, goal, state.gates, rules); if (!route || route->empty()){ return Pokemon::outcome_failed("no_route", Pokemon::to_string(pose) + " to " + to_string(goal.position)); } state.gates = gates_after_route(state.gates, *route); return Pokemon::outcome_ok(to_pose(StoryPose{target->map, target->tile, route->back().facing_after})); } - const Standing at = standing(pose, maps()); + const Standing at = standing(pose, maps(state)); if (!at.error.empty()){ return Pokemon::outcome_failed("no_pose", at.error); } const std::optional target = story_pose(Pokemon::pose_of(Pokemon::story_arg(step.args, "target"))); const RouteGoal goal{{target->map, target->tile}, target->facing}; const std::optional> route = plan_overworld_route_gated( - maps(), at.position, goal, state.gates, rules, story_route_costs(), at.facing + maps(state), at.position, goal, state.gates, rules, story_route_costs(), at.facing ); if (!route){ return Pokemon::outcome_failed("no_route", to_string(at.position) + " to " + to_string(goal.position)); } - const MapPosition end = follow_overworld_route(maps(), at.position, *route, state.gates); + const MapPosition end = follow_overworld_route(maps(state), at.position, *route, state.gates); if (!(end == goal.position)){ return Pokemon::outcome_failed("wrong_end", to_string(end)); } - if (const std::optional leg = overrun_wall_leg(*route, maps())){ + if (const std::optional leg = overrun_wall_leg(*route, maps(state))){ return Pokemon::outcome_failed("wall_overrun", *leg); } state.gates = gates_after_route(state.gates, *route); @@ -462,6 +463,7 @@ Pokemon::StoryAction OverworldStepSim::step_action(StoryActionId id){ m_flags = state.flags; m_beaten = beaten_trainers(state.flags); const std::string failure = (this->*body)(step); + state.flags = m_flags; return failure.empty() ? Pokemon::outcome_ok() : Pokemon::outcome_failed("sim_failure", failure); }); } @@ -613,7 +615,15 @@ std::string OverworldStepSim::step_ahead(const StoryStep& step){ return shown.has_value(); }; const int tiles = step.action == TRAINER_LINE_VARIANT ? TRAINER_LINE_TILES : 1; - return step_until_seen(tiles, tap, seen) ? "" : "no trainer saw the player."; + if (!step_until_seen(tiles, tap, seen)){ + return "no trainer saw the player."; + } + // As note_line_trainer(): the trainer who saw the player stands beside them + // from now on, for the routes after the battle. + if (step.action == TRAINER_LINE_VARIANT || step.action == TRAINER_WAIT_VARIANT){ + note_trainer_walked_up(m_sim.state().position, m_flags); + } + return ""; } // take_warp_step() on the sim: the step, then its fade, with a step more @@ -843,11 +853,22 @@ std::string row_step_on_sim( OverworldSim& sim, StoryPose& at, const StoryStep& step, const std::string& id, const std::set& run_flags ){ + std::set flags = run_flags; + return row_step_carrying_flags(sim, at, step, id, flags); +} + +std::string row_step_carrying_flags( + OverworldSim& sim, StoryPose& at, const StoryStep& step, const std::string& id, + std::set& run_flags +){ + const std::string map_before = at.map; OverworldStepSim executor(sim, id, at); RunState state; state.flags = run_flags; const Outcome outcome = executor.run(step, state); at = executor.at(); + run_flags = std::move(state.flags); + trainers_back_after_map_change(map_before, at.map, run_flags); if (outcome.succeeded()){ // The step that picks the Card Key up (flags_after) opens the doors the // next ones walk to. diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.h index 7137b89bb1..13edd5973c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.h @@ -90,7 +90,10 @@ class StoryMapsSim : public Pokemon::TableExecutor{ private: Pokemon::StoryAction action(StoryActionId id); - const std::vector& maps() const; + // The maps a run with `state`'s flags plans on: run_story_maps(), as + // the program (Silph Co.'s Rockets gone once cleared, walked-up + // trainers where they stand), unless the knobs give maps. + const std::vector& maps(const Pokemon::RunState& state) const; // Plans the route and moves the run's pose and gates to its end. Pokemon::Outcome walk_to(Pokemon::RunState& state, const StoryStep& step) const; Pokemon::Outcome legs(const Pokemon::RunState& state, const StoryStep& step) const; @@ -188,6 +191,13 @@ std::string row_step_on_sim( OverworldSim& sim, StoryPose& at, const StoryStep& step, const std::string& id, const std::set& run_flags = std::set() ); +// row_step_on_sim() with `run_flags` carried on: they become the flags +// the step left, as the program's run state carries them to the next +// step (a trainer who walked up to the player, TRAINER_AT_FLAG). +std::string row_step_carrying_flags( + OverworldSim& sim, StoryPose& at, const StoryStep& step, const std::string& id, + std::set& run_flags +); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp index 50f86e0e5a..5698cef90f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp @@ -225,10 +225,9 @@ UnitTestResult test_cameron_sees_row_21(){ UnitTestResult test_celadon_x_accuracies(){ const StoryCheckpoint& row = checkpoint("18.03"); StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); - // The Department Store's lift, as 10.01's: its room and its floors. - SimScript script; - script.lift_floors[std::string(DEPT_STORE_LIFT_MAP)] = department_store_lift_exits(); - OverworldSim sim(story_maps(), MapPosition{at.map, at.tile}, *at.facing, script); + // The Department Store's lift, as 10.01's: story_maps() has its room, + // the sim its floors (SimScript::lift_floors). + OverworldSim sim(story_maps(), MapPosition{at.map, at.tile}, *at.facing); const MapPosition clerk{"CeladonCity_DepartmentStore_5F", {3, 7}}; bool bought_at_clerk = false; for (const StoryStep& step : row.steps){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimBudget.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimBudget.h new file mode 100644 index 0000000000..3068b9c5ad --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimBudget.h @@ -0,0 +1,68 @@ +/* AutoStory Sim Budget + * + * From: https://github.com/PokemonAutomation/ + * + * For the FRLG story sims' tests: a wall-clock budget a run stops at, so a + * sim that goes round in circles fails its test with a message instead of + * holding CI's per-push run (#599's whole-story sims ran past 5 minutes + * each), and the switch that turns the slow tests on. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStorySimBudget_H +#define PokemonAutomation_PokemonFRLG_AutoStorySimBudget_H + +#include +#include +#include +#include +#include +#include "Common/Cpp/Exceptions.h" +#include "Common/Cpp/Time.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// One test case's sims, at most this long: a stage of the story. +inline constexpr Seconds STAGE_BUDGET{120}; + +// A run's wall-clock budget. +struct TimeBudget{ + Seconds seconds; + std::chrono::steady_clock::time_point deadline; +}; + +// A budget of `seconds` that starts now. +inline TimeBudget budget_from_now(Seconds seconds){ + return TimeBudget{seconds, std::chrono::steady_clock::now() + seconds}; +} + +// Throws, naming `where` (the step about to run), once `budget` is spent. +inline void check_budget(const TimeBudget& budget, std::string_view where){ + if (std::chrono::steady_clock::now() > budget.deadline){ + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format( + "Time budget of {} s spent before {}: the run is stuck or too long for one test; split it.", + budget.seconds.count(), where + )); + } +} + +// The environment variable that turns on the slow tests (the whole story +// end to end). Unset, as in Fork Draft CI's per-push run, they are +// SKIPPED. +inline constexpr std::string_view SLOW_TESTS_VARIABLE = "PA_SLOW_TESTS"; + +// Whether SLOW_TESTS_VARIABLE is set, and not to "0". +inline bool slow_tests_enabled(){ + // code-health: allow char_pointer -- std::getenv returns a const char pointer + const char* value = std::getenv(std::string(SLOW_TESTS_VARIABLE).c_str()); + return value != nullptr && value[0] != '\0' && std::string_view(value) != "0"; +} + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp index c9c3e83943..31d49c56cf 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include "PokemonFRLG_AutoStoryPaceSim.h" #include "PokemonFRLG_AutoStoryRngLoop.h" #include "PokemonFRLG_AutoStoryRowSim.h" +#include "PokemonFRLG_AutoStorySimBudget.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" @@ -75,12 +77,16 @@ const StoryCheckpoint& checkpoint_row(std::string_view id){ return *row; } +// The whole story end to end, a slow test. +constexpr Seconds WHOLE_STORY_BUDGET{1200}; + // The story on the story maps (StoryMapsSim), with a trace of what ran // and steps told to fail. class FakeGame : public StoryMapsSim{ public: - explicit FakeGame(StorySimKnobs knobs = {}) + FakeGame(StorySimKnobs knobs, TimeBudget budget) : StoryMapsSim(std::move(knobs)) + , m_budget(budget) {} struct Failure{ @@ -100,6 +106,7 @@ class FakeGame : public StoryMapsSim{ } virtual Outcome run(const StoryStep& step, RunState& state) override{ const std::string key = m_row + "/" + step.name; + check_budget(m_budget, key); trace.push_back(key); auto failure = failures.find(key); if (failure != failures.end() && failure->second.times > 0){ @@ -111,6 +118,7 @@ class FakeGame : public StoryMapsSim{ private: std::string m_row; + TimeBudget m_budget; }; @@ -118,8 +126,8 @@ class FakeGame : public StoryMapsSim{ // run takes with every handoff off, each saving at its end (hooks.save // stands for save_game()). struct Simulation{ - explicit Simulation(StorySimKnobs knobs = {}) - : game(std::move(knobs)) + explicit Simulation(StorySimKnobs knobs = {}, TimeBudget budget = budget_from_now(STAGE_BUDGET)) + : game(std::move(knobs), budget) {} std::vector rows = plan_story_run(story_checkpoints(), 0, story_checkpoints().size() - 1, StoryHandoffs{}).rows; @@ -180,10 +188,11 @@ struct Simulation{ struct AutoStorySimulationInput{ - std::string name; UnitTestResult (*body)(); // A body that logs, run instead of `body` if given. - UnitTestResult (*logged)(Logger&) = {}; + std::function logged = {}; + // Run only with the slow tests on (SLOW_TESTS_VARIABLE). + bool slow = false; }; struct AutoStorySimulationExpectation{ @@ -191,6 +200,7 @@ struct AutoStorySimulationExpectation{ }; struct AutoStorySimulationTestCase{ + std::string name; AutoStorySimulationInput input; AutoStorySimulationExpectation expectation; }; @@ -198,14 +208,17 @@ struct AutoStorySimulationTestCase{ class Test_AutoStorySimulation : public UnitTest{ public: explicit Test_AutoStorySimulation(AutoStorySimulationTestCase scenario) - : UnitTest("PokemonFRLG::AutoStory - Simulation: " + scenario.input.name) + : UnitTest("PokemonFRLG::AutoStory - Simulation: " + scenario.name) , m_scenario(std::move(scenario)) {} virtual UnitTestResult run(Logger& logger, CancellableScope&) const override{ + if (m_scenario.input.slow && !slow_tests_enabled()){ + return UnitTestResult(UnitTestResult::SKIPPED, std::format("a slow test: set {}=1 to run it", SLOW_TESTS_VARIABLE)); + } try{ return m_scenario.input.logged ? m_scenario.input.logged(logger) : m_scenario.input.body(); }catch (Exception& e){ - return std::string(e.name()) + ": " + e.message(); + return std::format("{}: {}", e.name(), e.message()); } } @@ -214,23 +227,42 @@ class Test_AutoStorySimulation : public UnitTest{ }; -UnitTestResult test_whole_story(){ - Simulation sim; - const Pokemon::SegmentReport report = sim.run({}); - if (!report.completed){ - return "Expected the whole story through:" + joined(sim.lines); +// The rows of a run, as Simulation::rows has them, from `first` to +// `last`, both inclusive; all of them for an empty range. +std::vector rows_in(const std::vector& rows, const Pokemon::SegmentRange& range){ + std::vector out; + bool in = !range.from; + for (const StoryCheckpoint& data : rows){ + in = in || data.id == *range.from; + if (in){ + out.push_back(data); + } + if (range.to && data.id == *range.to){ + break; + } } - std::vector ids; - for (const StoryCheckpoint& data : sim.rows){ - ids.push_back(data.id); + return out; +} + +// A run of `range` with nothing told to fail: through, each checkpoint +// once in order and one-shot, each saving at its end, each starting where +// the save before it stands; and 02.03's shopping, if it ran. +UnitTestResult check_story_run(const Pokemon::SegmentRange& range, TimeBudget budget){ + Simulation sim({}, budget); + const Pokemon::SegmentReport report = sim.run(range); + if (!report.completed){ + return "Expected the story through:" + joined(sim.lines); } + const std::vector rows = rows_in(sim.rows, range); + std::vector ids(rows.size()); + std::ranges::transform(rows, ids.begin(), &StoryCheckpoint::id); if (sim.begun() != ids || sim.saves.size() != ids.size()){ return "Expected each checkpoint once, in order, each saving at its end:" + joined(sim.game.trace); } // Each checkpoint starts where the save before it stands, but one // authored before the rows that lead up to it. - for (size_t c = 1; c < sim.rows.size(); c++){ - const StoryCheckpoint& data = sim.rows[c]; + for (size_t c = 1; c < rows.size(); c++){ + const StoryCheckpoint& data = rows[c]; if (starts_after_unauthored_rows(data.id)){ continue; } @@ -246,6 +278,9 @@ UnitTestResult test_whole_story(){ if (report.one_shot_passes() != report.checkpoints_run){ return "Expected every checkpoint one-shot:" + joined(sim.lines); } + if (std::ranges::find(ids, "02.03") == ids.end()){ + return true; + } // 02.03's shopping, with the cursor staying on each row bought. const std::map bought{{"potion", 5}, {"antidote", 3}, {"parlyz_heal", 1}}; if (sim.game.bag() != bought){ @@ -258,13 +293,17 @@ UnitTestResult test_whole_story(){ return true; } +UnitTestResult test_whole_story(){ + return check_story_run({}, budget_from_now(WHOLE_STORY_BUDGET)); +} + // The whole story through the table as the simulation binds it, each // row's stubs logged: a step is stubbed exactly when its action needs the // console, so no step the simulation plays is passed over. -UnitTestResult test_stubbed_steps_need_the_console(Logger& logger){ +UnitTestResult check_stubbed_steps(Logger& logger, const Pokemon::SegmentRange& range){ Simulation sim; - if (!sim.run({}).completed){ - return "Expected the whole story through:" + joined(sim.lines); + if (!sim.run(range).completed){ + return "Expected the story through:" + joined(sim.lines); } logger.log("Steps the simulation does not play, by row:\n" + stub_report(sim.game.stubs().rows())); for (const RowStubs& stubs : sim.game.stubs().rows()){ @@ -806,18 +845,23 @@ UnitTestResult test_out_of_bill_cottage(){ return true; } - // Someone talks to the player before every step (StorySimKnobs:: // dialog_before): cleared between steps, the whole story still passes; // left up, as before the executor looked, a walk fails on it. -UnitTestResult test_dialog_before_every_step(){ +UnitTestResult check_dialog_before_every_step(const Pokemon::SegmentRange& range){ + Simulation cleared({.dialog_before = [](const std::string&, const std::string&){ return true; }}); + if (!cleared.run(range).completed){ + return "Expected the story through, a dialog before every step cleared:" + joined(cleared.lines); + } + return true; +} + +// The same dialogs left up, as before the executor looked: the story's +// first walk fails on one. +UnitTestResult test_dialog_left_up_stops_a_walk(){ const auto always = [](const std::string&, const std::string&){ return true; }; - Simulation cleared({.dialog_before = always}); - if (!cleared.run({}).completed){ - return "Expected the story through, a dialog before every step cleared:" + joined(cleared.lines); - } Simulation left({.dialog_before = always, .clear_interrupts = false}); const bool completed = left.run({}).completed; const auto stopped = [](const std::string& line){ @@ -831,8 +875,9 @@ UnitTestResult test_dialog_before_every_step(){ // Dialogs pop up at random before one step in five: how many whole runs // pass with them cleared between steps, and with them left up. -UnitTestResult test_dialogs_at_random(Logger& logger){ +UnitTestResult check_dialogs_at_random(Logger& logger, const Pokemon::SegmentRange& range){ constexpr uint32_t SEEDS = 5; + const TimeBudget budget = budget_from_now(STAGE_BUDGET); size_t passes[2] = {0, 0}; for (uint32_t seed = 1; seed <= SEEDS; seed++){ for (bool clear : {false, true}){ @@ -842,13 +887,13 @@ UnitTestResult test_dialogs_at_random(Logger& logger){ return std::bernoulli_distribution(0.2)(*rng); }, .clear_interrupts = clear, - }); - passes[clear] += sim.run({}).completed ? 1 : 0; + }, budget); + passes[clear] += sim.run(range).completed ? 1 : 0; } } logger.log(std::format( - "Dialogs before one step in five, {} seeds: {} passed left up, {} cleared between steps.", - SEEDS, passes[0], passes[1] + "Dialogs before one step in five, {} to {}, {} seeds: {} passed left up, {} cleared between steps.", + range.from.value_or("the start"), range.to.value_or("the end"), SEEDS, passes[0], passes[1] )); if (passes[1] != SEEDS){ return std::format("Expected every run through with the dialogs cleared, {} of {}.", passes[1], SEEDS); @@ -856,62 +901,95 @@ UnitTestResult test_dialogs_at_random(Logger& logger){ return true; } +// A stage of the story: its first and last checkpoints. +struct StoryStage{ + std::string first; + std::string last; +}; -// No ANSWER step follows a ROUTE or LEGS step. A walk closes a message -// that shows at its end with B (MessageInterrupt), which answers a YES/NO -// NO by itself, and the ANSWER after it then finds none. Console B, -// 2026-11-14, 14.02b: Bill's scene ran as below_gym_door's warp out of -// Cinnabar Gym landed, the walk pressed through his question, and -// decline_bill failed with "answer_yes_no(): no YES/NO". A question that -// shows on arrival follows a STEP onto the warp, which leaves it up. -UnitTestResult test_no_answer_after_walk(){ - for (const StoryCheckpoint& row : story_checkpoints()){ - for (size_t c = 1; c < row.steps.size(); c++){ - const StoryStep& walk = row.steps[c - 1]; - const StoryStep& answer = row.steps[c]; - if (answer.kind != StoryStepKind::ANSWER){ - continue; - } - if (walk.kind == StoryStepKind::ROUTE || walk.kind == StoryStepKind::LEGS){ - return std::format("{}/{}: follows the walk {}, which answers a YES/NO at its end with B.", row.id, answer.name, walk.name); - } +// The story's stages, as a run with every handoff off takes its rows: +// each run of rows whose ids share a stage number ("05" for 05.01 to +// 05.10). +std::vector story_stages(){ + const std::vector rows = plan_story_run(story_checkpoints(), 0, story_checkpoints().size() - 1, StoryHandoffs{}).rows; + std::vector stages; + for (const StoryCheckpoint& data : rows){ + if (stages.empty() || stages.back().last.substr(0, 2) != data.id.substr(0, 2)){ + stages.push_back({.first = data.id, .last = data.id}); + }else{ + stages.back().last = data.id; } } - return true; + return stages; +} + +// The stage tests: each stage of the story, from its first row's start +// (where the save of the row before it stands, as the no-sim chain test +// checks: PokemonFRLG_AutoStoryStepLint_Tests.cpp) to its last row's end, +// within STAGE_BUDGET. Together they run the whole story on every push. +struct StageCheck{ + std::string_view what; + std::string_view description; + UnitTestResult (*check)(Logger&, const Pokemon::SegmentRange&); +}; + +const StageCheck STAGE_CHECKS[] = { + {"in order, each start where the last save stood", "runs the stage's checkpoints one-shot, each from where the one before saved", [](Logger&, const Pokemon::SegmentRange& range){ return check_story_run(range, budget_from_now(STAGE_BUDGET)); }}, + {"the steps it stubs need the console", "stubs each needs-console step of the stage and plays the rest", check_stubbed_steps}, + {"a dialog before every step, cleared", "the stage passes with each dialog cleared between steps", [](Logger&, const Pokemon::SegmentRange& range){ return check_dialog_before_every_step(range); }}, + {"dialogs before one step in five, over 5 seeds", "every run of the stage passes with them cleared", check_dialogs_at_random}, +}; + +// `check` on `stage`. `check` is one of STAGE_CHECKS, which outlive it. +AutoStorySimulationTestCase stage_case(const StoryStage& stage, const StageCheck& check){ + const Pokemon::SegmentRange range{.from = stage.first, .to = stage.last}; + return { + .name = std::format("stage {} ({} to {}), {}", stage.first.substr(0, 2), stage.first, stage.last, check.what), + .input = {.body = nullptr, .logged = [&check, range](Logger& logger){ return check.check(logger, range); }}, + .expectation = {.description = check.description}, + }; } +std::vector stage_cases(){ + std::vector cases; + for (const StoryStage& stage : story_stages()){ + for (const StageCheck& check : STAGE_CHECKS){ + cases.push_back(stage_case(stage, check)); + } + } + return cases; +} const AutoStorySimulationTestCase AUTO_STORY_SIMULATION_CASES[] = { - {.input = {.name = "new game to Brock, in order, each start where the last save stood", .body = test_whole_story}, .expectation = {.description = "runs full story progression from new game through Brock gym"}}, - {.input = {.name = "the steps it stubs need the console", .body = nullptr, .logged = test_stubbed_steps_need_the_console}, .expectation = {.description = "stubs each needs-console step of the whole story and plays the rest"}}, - {.input = {.name = "start and end checkpoints", .body = test_start_and_end}, .expectation = {.description = "executes segment bounded by start and end checkpoints"}}, - {.input = {.name = "a failed walk reloads its checkpoint's save", .body = test_retry_from_save}, .expectation = {.description = "reloads checkpoint save state on simulated movement failure"}}, - {.input = {.name = "a battle lost every time stops after 3 attempts", .body = test_gives_up_after_attempts}, .expectation = {.description = "aborts after three consecutive battle blackouts"}}, - {.input = {.name = "04.06 into Cerulean, the entry leg a tile short", .body = test_cerulean_entry_short}, .expectation = {.description = "recovers when entering Cerulean City if movement ends one tile short"}}, - {.input = {.name = "04.06 from Mt. Moon to the Mega Kick tutor, then above the ledge", .body = test_mega_kick_tutor_walks}, .expectation = {.description = "verifies route navigation from Mt. Moon to tutor and past ledge"}}, - {.input = {.name = "05.05 Nugget Bridge, the walk onto it a tile short", .body = test_nugget_bridge_short}, .expectation = {.description = "completes Nugget Bridge battles even if initial approach stops short"}}, - {.input = {.name = "05.06 Route 25, its four trainers and Dan", .body = test_route25_trainers}, .expectation = {.description = "simulates Route 25 trainer battles and Dan detour"}}, - {.input = {.name = "05.07 out of Bill's Sea Cottage, Bill on (7, 6)", .body = test_out_of_bill_cottage}, .expectation = {.description = "simulates exiting Bill sea cottage with Bill relocated"}}, - {.input = {.name = "05.09 to Route 24's grass and back, past Shane", .body = test_oddish_walks}, .expectation = {.description = "navigates to Route 24 grass avoiding trainer line of sight"}}, - {.input = {.name = "05.09 back to the Center, the Oddish's battle on the pace's far step", .body = test_oddish_battle_on_far_step}, .expectation = {.description = "handles Oddish capture encounter occurring on far pace step"}}, - {.input = {.name = "05.09 onto the grass out of Shane's sight, the leg west a tile short", .body = test_oddish_patch_west_short}, .expectation = {.description = "recovers when approaching grass patch with short western leg"}}, - {.input = {.name = "the routes after pacing, from either of its tiles", .body = test_routes_after_pacing}, .expectation = {.description = "plans valid routes regardless of which pacing tile character ends on"}}, - {.input = {.name = "a save off the start pose stops before any step", .body = test_save_off_start_pose}, .expectation = {.description = "fails the start check without walking or saving"}}, - {.input = {.name = "the row after an RNG handoff runs off any start pose", .body = test_rows_after_rng_skip_start_check}, .expectation = {.description = "01.06, 04.03 and 09.04 start where the RNG program left the game"}}, - {.input = {.name = "a dialog pops up before every step", .body = test_dialog_before_every_step}, .expectation = {.description = "cleared between steps, the story passes; left up, a walk fails on it"}}, - {.input = {.name = "dialogs pop up before one step in five, over 5 seeds", .body = nullptr, .logged = test_dialogs_at_random}, .expectation = {.description = "every run passes with them cleared"}}, - {.input = {.name = "an ANSWER never follows a walk", .body = test_no_answer_after_walk}, .expectation = {.description = "a YES/NO after a warp follows a STEP onto it, which leaves the question up"}}, + {.name = "new game to Brock, in order, each start where the last save stood", .input = {.body = test_whole_story, .slow = true}, .expectation = {.description = "runs the whole story end to end; slow, the stage tests run it on every push"}}, + {.name = "start and end checkpoints", .input = {.body = test_start_and_end}, .expectation = {.description = "executes segment bounded by start and end checkpoints"}}, + {.name = "a failed walk reloads its checkpoint's save", .input = {.body = test_retry_from_save}, .expectation = {.description = "reloads checkpoint save state on simulated movement failure"}}, + {.name = "a battle lost every time stops after 3 attempts", .input = {.body = test_gives_up_after_attempts}, .expectation = {.description = "aborts after three consecutive battle blackouts"}}, + {.name = "04.06 into Cerulean, the entry leg a tile short", .input = {.body = test_cerulean_entry_short}, .expectation = {.description = "recovers when entering Cerulean City if movement ends one tile short"}}, + {.name = "04.06 from Mt. Moon to the Mega Kick tutor, then above the ledge", .input = {.body = test_mega_kick_tutor_walks}, .expectation = {.description = "verifies route navigation from Mt. Moon to tutor and past ledge"}}, + {.name = "05.05 Nugget Bridge, the walk onto it a tile short", .input = {.body = test_nugget_bridge_short}, .expectation = {.description = "completes Nugget Bridge battles even if initial approach stops short"}}, + {.name = "05.06 Route 25, its four trainers and Dan", .input = {.body = test_route25_trainers}, .expectation = {.description = "simulates Route 25 trainer battles and Dan detour"}}, + {.name = "05.07 out of Bill's Sea Cottage, Bill on (7, 6)", .input = {.body = test_out_of_bill_cottage}, .expectation = {.description = "simulates exiting Bill sea cottage with Bill relocated"}}, + {.name = "05.09 to Route 24's grass and back, past Shane", .input = {.body = test_oddish_walks}, .expectation = {.description = "navigates to Route 24 grass avoiding trainer line of sight"}}, + {.name = "05.09 back to the Center, the Oddish's battle on the pace's far step", .input = {.body = test_oddish_battle_on_far_step}, .expectation = {.description = "handles Oddish capture encounter occurring on far pace step"}}, + {.name = "05.09 onto the grass out of Shane's sight, the leg west a tile short", .input = {.body = test_oddish_patch_west_short}, .expectation = {.description = "recovers when approaching grass patch with short western leg"}}, + {.name = "the routes after pacing, from either of its tiles", .input = {.body = test_routes_after_pacing}, .expectation = {.description = "plans valid routes regardless of which pacing tile character ends on"}}, + {.name = "a save off the start pose stops before any step", .input = {.body = test_save_off_start_pose}, .expectation = {.description = "fails the start check without walking or saving"}}, + {.name = "the row after an RNG handoff runs off any start pose", .input = {.body = test_rows_after_rng_skip_start_check}, .expectation = {.description = "01.06, 04.03 and 09.04 start where the RNG program left the game"}}, + {.name = "a dialog left up before every step stops a walk", .input = {.body = test_dialog_left_up_stops_a_walk}, .expectation = {.description = "left up, as before the executor looked, a walk fails on it"}}, }; } // namespace - void add_tests_AutoStorySimulation(UnitTestDatabase& database){ add_tests_AutoStoryStepTable(database); add_tests_AutoStoryStartFrames(database); for (const auto& scenario : AUTO_STORY_SIMULATION_CASES){ database.add(scenario); } + for (AutoStorySimulationTestCase& scenario : stage_cases()){ + database.add(std::move(scenario)); + } } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.cpp new file mode 100644 index 0000000000..046384d766 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.cpp @@ -0,0 +1,226 @@ +/* AutoStory Step Lint Tests + * + * From: https://github.com/PokemonAutomation/ + * + * Lints over FRLG's story table, without a sim: each checkpoint starts + * where the one before declares its end, no ANSWER follows a walk, and no + * new `legs` event without a reason the planner can't walk it. + * + */ + +#include +#include +#include +#include +#include +#include +#include "Common/Cpp/TestRunners/UnitTest.h" +#include "Pokemon/AutoStory/Pokemon_StoryPostconditionCheck.h" +#include "Pokemon/AutoStory/Pokemon_TilePose.h" +#include "PokemonFRLG_AutoStoryEvents.h" +#include "PokemonFRLG_AutoStoryStepLint_Tests.h" +#include "PokemonFRLG_AutoStoryTable.h" +#include "PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +namespace{ + +// Without a sim: each checkpoint starts where the one before it declares +// its end (checkpoint_end_pose()), so the stage tests, each from its own +// first row's start, chain into the whole story. A row whose end is left +// to its legs' taps (04.01, 05.01) is checked by its stage's run; a +// stage's last row must declare its end. +UnitTestResult test_declared_ends_chain(){ + const std::vector rows = plan_story_run(story_checkpoints(), /*first=*/0, story_checkpoints().size() - 1, StoryHandoffs{}).rows; + for (size_t c = 1; c < rows.size(); c++){ + const StoryCheckpoint& before = rows[c - 1]; + const StoryCheckpoint& data = rows[c]; + if (starts_after_unauthored_rows(data.id)){ + continue; + } + const std::optional end = Pokemon::checkpoint_end_pose(before); + if (!end){ + if (before.id.substr(0, 2) != data.id.substr(0, 2)){ + return std::format("{} ends its stage, but declares no end for {} to start from.", before.id, data.id); + } + continue; + } + const std::optional ends = story_pose(Pokemon::pose_of(*end)); + const std::optional start = data.start ? story_pose(Pokemon::pose_of(*data.start)) : std::nullopt; + const bool same = ends && start && start->map == ends->map && start->tile == ends->tile + && (!start->facing || !ends->facing || start->facing == ends->facing); + if (!same){ + return std::format("{} starts at {}, but {} declares its end at {}.", data.id, + data.start ? Pokemon::to_string(Pokemon::pose_of(*data.start)) : std::string("a new game"), before.id, Pokemon::to_string(Pokemon::pose_of(*end))); + } + } + return true; +} + +// No ANSWER step follows a ROUTE or LEGS step. A walk closes a message +// that shows at its end with B (MessageInterrupt), which answers a YES/NO +// NO by itself, and the ANSWER after it then finds none. Console B, +// 2026-11-14, 14.02b: Bill's scene ran as below_gym_door's warp out of +// Cinnabar Gym landed, the walk pressed through his question, and +// decline_bill failed with "answer_yes_no(): no YES/NO". A question that +// shows on arrival follows a STEP onto the warp, which leaves it up. +UnitTestResult test_no_answer_after_walk(){ + for (const StoryCheckpoint& row : story_checkpoints()){ + for (size_t c = 1; c < row.steps.size(); c++){ + const StoryStep& walk = row.steps[c - 1]; + const StoryStep& answer = row.steps[c]; + if (answer.kind != StoryStepKind::ANSWER){ + continue; + } + if (walk.kind == StoryStepKind::ROUTE || walk.kind == StoryStepKind::LEGS){ + return std::format("{}/{}: follows the walk {}, which answers a YES/NO at its end with B.", row.id, answer.name, walk.name); + } + } + } + return true; +} + +// The `legs` events in the story before 2026-11-15, row/step. The user +// (2026-11-15, 17.03's hand-written legs: "not ok"): every walk is a +// planned `route` to a target tile, the gym's spinners planner moves too; +// these are listed, not rewritten, and leave the list as they become +// routes. +const std::set>& legs_before_2026_11_15(){ + static const std::set> LEGS{ + "03.01/forest_east", "03.01/forest_exit", "04.01/below_colton_line", "04.01/past_ben", + "04.01/above_james_line", "04.01/save_spot", "04.05/mt_moon_1f", "04.05/b2f_south", + "04.05/below_miguel_trigger", "04.05/below_helix_fossil", "04.06/above_city_ledge", + "05.01/gym_west_walkway", "05.01/below_misty_platform", "05.02/gym_way_out", "05.05/below_ali_line", + "05.05/below_timmy_line", "05.05/below_reli_line", "05.05/below_ethan_line", "05.06/west_of_dan", + "05.06/round_dan", "05.06/west_of_nob_line", "05.06/below_haley_line", "05.07/beside_bill", + "05.07/around_bill", "05.10/round_keigo_and_elijah", "06.01/past_the_cabins", "06.01/round_the_sailor", + "06.02/west_of_dwayne_line", "06.02/east_of_baily_line", "06.02/below_tucker_line", + "06.03/round_isabelle_line", "06.03/down_to_jeff_row", "07.01/round_isabelle_and_elijah", + "07.02/round_brice", "07.02/above_caitlin_line", "07.02/below_center_door", "08.01/above_ashton_line", + "08.01/winston_line_end", "08.01/below_martha_line", "08.01/below_allen_line", "08.01/west_of_b1f_ladder", + "08.01/above_lenny_line", "08.01/west_of_lucas_line", "08.01/east_of_sofia_line", + "08.01/east_of_dudley_line", "08.01/past_cooper", "08.01/above_dana_line", "08.01/above_south_mouth", + "08.02/route10_east_side", "08.02/below_center_door", "08.03/lavender_west_edge", + "08.03/east_of_rich_line", "08.03/west_of_glenn_column", "08.03/route8_row7_west_wall", + "08.03/route8_row14_west_wall", "08.03/east_of_underground_door", "09.01/b2f_to_stairs", + "09.01/b3f_arrow_maze", "09.01/beside_lift_key", "09.01/b4f_east_to_wall", "09.01/b4f_to_stairs", + "09.01/b3f_down_to_row_20", "09.01/b3f_row_20_to_wall", "09.01/b3f_back_to_candy_row", + "09.02/b3f_to_column_12", "09.02/b3f_to_top_corridor", "09.02/b2f_arrows_to_moon_stone", + "09.02/beside_moon_stone", "09.02/b2f_arrows_to_lift_room", "09.02/lift_room_to_row_17", + "09.02/row_17_to_wall", "09.02/below_lift", "09.02/below_left_guard", "09.02/below_right_guard", + "09.02/west_of_right_guard", "09.02/up_column_17", "09.02/beside_giovanni", "10.04/tower_3f_to_stairs", + "10.04/tower_4f_column_16", "10.04/tower_5f_row6_east", "10.05/tower_6f_below_jennifer_line", + "10.05/above_tower_rare_candy", "10.05/above_marowak_trigger", "10.06/below_fuji_house", + "11.02/top_of_cycling_road", "11.02/route18_west_wall", "11.03/before_east_grass", + "11.03/to_full_restore", "11.03/to_north_area", "11.03/to_west_area", "11.03/below_gold_teeth", + "11.03/below_secret_house_attendant", "12.01/center_northwest_corner", "12.01/below_kayden_line", + "12.01/east_column_to_kirk", "12.01/east_column_to_wall", "12.01/top_row_to_wall", "12.01/down_to_koga", + "12.02b/beside_warden", "13.01/statue_row", "13.01/statue_wall", "13.01/statue_tile", + "14.01/center_northwest_corner", "14.01/below_quiz_1", "14.01/below_door_1", "14.01/to_quiz_2_machine", + "14.01/below_quiz_2", "14.01/above_door_2", "14.01/below_quiz_3", "14.01/above_door_3", + "14.01/below_quiz_4", "14.01/east_of_door_4", "14.01/below_quiz_5", "14.01/below_door_5", + "14.01/below_quiz_6", "14.01/below_door_6", "14.01/below_blaine", "14.02b/above_door_6", + "14.02b/above_door_5", "14.02b/west_of_door_4", "14.02b/below_door_3", "14.02b/below_door_2", + "14.02b/above_door_1", "14.03/below_gym_gap", "14.03/column_1_west", "14.03/column_1_to_wall", + "14.03/beside_inner_tree", "14.03/beside_erika", "14.04b/below_lori", "14.04b/row_5_to_wall", + "14.04b/column_1_down_to_wall", "14.04b/onto_column_2", "14.04b/column_2_to_wall", + "16.02/to_card_key_ball", + }; + return LEGS; +} + +// What a new `legs` event's why says, then why the planner can't walk it +// (taps beside a wall where a run overshoots, as 12.02b's beside_warden). +constexpr std::string_view NOT_PLANNED = "not planned: "; + +// No new `legs` event without a reason the planner can't walk it, and +// every listed one still in the story. +UnitTestResult test_legs_need_a_reason(){ + std::set> listed_seen; + for (const StoryCheckpoint& row : story_checkpoints()){ + for (const StoryStep& step : row.steps){ + if (step.kind != StoryStepKind::LEGS){ + continue; + } + const std::string key = row.id + "/" + step.name; + if (legs_before_2026_11_15().contains(key)){ + listed_seen.insert(key); + continue; + } + if (step.why.find(NOT_PLANNED) == std::string::npos){ + return std::format("{}: a legs event; make it a planned route to its target tile, or start its why's reason with \"{}\".", key, NOT_PLANNED); + } + } + } + for (const std::string& key : legs_before_2026_11_15()){ + if (!listed_seen.contains(key)){ + return std::format("{} is no legs event now: take it off legs_before_2026_11_15().", key); + } + } + return true; +} + +struct StepLintInput{ + UnitTestResult (*body)(); +}; + +struct StepLintExpectation{ + std::string_view description; +}; + +struct StepLintCase{ + std::string name; + StepLintInput input; + StepLintExpectation expectation; +}; + +class Test_AutoStoryStepLint : public UnitTest{ +public: + explicit Test_AutoStoryStepLint(StepLintCase scenario) + : UnitTest("PokemonFRLG::AutoStory - Step lint: " + scenario.name) + , m_scenario(std::move(scenario)) + {} + virtual UnitTestResult run(Logger&, CancellableScope&) const override{ + return m_scenario.input.body(); + } + +private: + StepLintCase m_scenario; +}; + +const StepLintCase STEP_LINT_CASES[] = { + { + .name = "each checkpoint starts where the one before declares its end", + .input = {.body = test_declared_ends_chain}, + .expectation = {.description = "the stage sims chain into the whole story"}, + }, + { + .name = "an ANSWER never follows a walk", + .input = {.body = test_no_answer_after_walk}, + .expectation = {.description = "a YES/NO after a warp follows a STEP onto it, which leaves the question up"}, + }, + { + .name = "no new legs event without a reason the planner can't walk it", + .input = {.body = test_legs_need_a_reason}, + .expectation = {.description = "every walk a planned route, but the listed legs and those whose why says \"not planned: \""}, + }, +}; + +} // namespace + + +void add_tests_AutoStoryStepLint(UnitTestDatabase& database){ + for (const StepLintCase& item : STEP_LINT_CASES){ + database.add(item); + } +} + + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.h new file mode 100644 index 0000000000..d2108e8d9d --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.h @@ -0,0 +1,28 @@ +/* AutoStory Step Lint Tests + * + * From: https://github.com/PokemonAutomation/ + * + * Registration of the lints over the story table + * (PokemonFRLG_AutoStoryStepLint_Tests.cpp). + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryStepLint_Tests_H +#define PokemonAutomation_PokemonFRLG_AutoStoryStepLint_Tests_H + +#include "Common/Cpp/TestRunners/UnitTestDatabase.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// The story table's lints: declared ends chain, no ANSWER after a walk, +// no new legs event without a reason. +void add_tests_AutoStoryStepLint(UnitTestDatabase& database); + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTower_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTower_Tests.cpp index 36feefef88..9a25fae360 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTower_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTower_Tests.cpp @@ -140,9 +140,9 @@ struct RowRun{ RowRun run_row(std::string_view id, std::vector maps){ const StoryCheckpoint& row = checkpoint(id); StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); - // The Department Store's lift (10.01): its room and its floors. - SimScript script; - script.lift_floors[std::string(DEPT_STORE_LIFT_MAP)] = department_store_lift_exits(); + // The Department Store's lift (10.01): its room in `maps`, its floors + // the sim's own (SimScript::lift_floors). + const SimScript script{}; auto sim = std::make_unique(maps, MapPosition{at.map, at.tile}, *at.facing, script); RowRun run; for (const StoryStep& step : row.steps){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp index 15dc8cc20b..51e5de53a0 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryViridian_Tests.cpp @@ -2,16 +2,16 @@ * * From: https://github.com/PokemonAutomation/ * - * Viridian Gym's spinner tiles and rows 17.02 and 17.04b - * (StoryData/frlg-17.0N.plan.json) on the overworld sim. 17.03 is the - * fault sweep's (a known-failing clean run: Takashi stands in the way - * after his battle). + * Viridian Gym's spinner tiles and rows 17.02 to 17.04b + * (StoryData/frlg-17.0N.plan.json) on the overworld sim. * */ +#include #include #include #include +#include #include #include #include @@ -19,8 +19,11 @@ #include "Common/Cpp/TestRunners/UnitTest.h" #include "Pokemon/AutoStory/Pokemon_StoryStepExecutor.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldObjects.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSpin.h" +#include "PokemonFRLG_AutoStoryMovedTrainers.h" +#include "PokemonFRLG_AutoStoryPacedRoute.h" #include "PokemonFRLG_AutoStoryPoses.h" #include "PokemonFRLG_AutoStoryRowSim.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" @@ -113,11 +116,18 @@ const StoryCheckpoint& table_row(std::string_view id){ throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format("No row {}.", id)); } -// Whether the overworld sim plays `step`; after any other step the -// player is put on its pose_after. -bool sim_walks(const StoryStep& step){ - return step.kind == StoryStepKind::ROUTE || step.kind == StoryStepKind::LEGS - || step.kind == StoryStepKind::STEP || step.kind == StoryStepKind::BATTLE; +// Whether row `row`'s step `c` is a battle a talk starts: the sim has no +// talk, and no trainer's message up for it. +bool talk_battle(const StoryCheckpoint& row, size_t c){ + return row.steps[c].kind == StoryStepKind::BATTLE && c > 0 && row.steps[c - 1].kind == StoryStepKind::TALK; +} + +// Whether the overworld sim plays row `row`'s step `c`; after any other +// step the player is put on its pose_after. +bool sim_walks(const StoryCheckpoint& row, size_t c){ + const StoryStep& step = row.steps[c]; + return !talk_battle(row, c) && (step.kind == StoryStepKind::ROUTE || step.kind == StoryStepKind::LEGS + || step.kind == StoryStepKind::STEP || step.kind == StoryStepKind::BATTLE); } // story_maps() after Giovanni's win: every trainer of the gym beaten with @@ -137,7 +147,9 @@ std::vector beaten_gym_maps(){ // Row `id`'s steps after `after` (from the row's start if empty) up to // `last`, on the sim over `maps` from where `after` leaves the player. It -// must fight only its own battles, break no rule and end on `end`. +// must fight only its own battles, break no rule and end on `end`. The run +// flags go from step to step, as in the program's run state; a battle a +// talk starts beats the trainers its flags_after name, on the sim too. UnitTestResult walk_row( std::string_view id, std::string_view after, std::string_view last, const std::vector& maps, const MapPosition& end @@ -151,19 +163,24 @@ UnitTestResult walk_row( first = c + 1; } } + std::set flags(row.start_flags.begin(), row.start_flags.end()); std::optional sim; - sim.emplace(maps, MapPosition{at.map, at.tile}, at.facing.value_or(Direction::SOUTH)); + sim.emplace(with_trainers_beaten(maps, beaten_trainers(flags)), MapPosition{at.map, at.tile}, at.facing.value_or(Direction::SOUTH)); size_t battles = 0; + // The trainers fought on the sims before `sim`, and the talks' battles. + size_t fought = 0; for (size_t c = first; c < row.steps.size(); c++){ const StoryStep& step = row.steps[c]; battles += step.kind == StoryStepKind::BATTLE ? 1 : 0; - if (sim_walks(step)){ - if (const std::string failure = row_step_on_sim(*sim, at, step, row.id); !failure.empty()){ + if (sim_walks(row, c)){ + if (const std::string failure = row_step_carrying_flags(*sim, at, step, row.id, flags); !failure.empty()){ return failure; } }else if (step.pose_after){ + fought += sim->state().trainers_beaten.size() + (talk_battle(row, c) ? 1 : 0); + flags.insert(step.flags_after.begin(), step.flags_after.end()); at = *story_pose(Pokemon::pose_of(*step.pose_after)); - sim.emplace(maps, MapPosition{at.map, at.tile}, at.facing.value_or(sim->state().facing)); + sim.emplace(with_trainers_beaten(maps, beaten_trainers(flags)), MapPosition{at.map, at.tile}, at.facing.value_or(sim->state().facing)); } if (!sim->state().violations.empty()){ return std::format("{} {}: broke a rule: {}", id, step.name, sim->state().violations.front()); @@ -175,8 +192,9 @@ UnitTestResult walk_row( if (!(sim->state().position == end)){ return std::format("{}: ended on {}, not {}.", id, to_string(sim->state().position), to_string(end)); } - if (sim->state().trainers_beaten.size() != battles){ - return std::format("{}: fought {} trainer(s), not the row's {}.", id, sim->state().trainers_beaten.size(), battles); + fought += sim->state().trainers_beaten.size(); + if (fought != battles){ + return std::format("{}: fought {} trainer(s), not the row's {}.", id, fought, battles); } return true; } @@ -187,6 +205,124 @@ UnitTestResult test_row_17_02(){ return walk_row("17.02", "fly_viridian", "warren", story_maps(), MapPosition{std::string(GYM), {15, 7}}); } +// Takashi, facing south on (10, 2) with a sight of 3, sees the player +// step onto (10, 5) and walks up to (10, 4), where he stays after the +// battle (console B, 2026-11-15 16:52); once beaten he sees no one. +UnitTestResult test_takashi_walks_up(){ + const std::optional takashi = trainer_walking_up(story_maps(), MapPosition{std::string(GYM), {10, 5}}, {}); + if (!takashi || takashi->trainer != "ViridianCity_Gym/black_belt@10,2" || takashi->x != 10 || takashi->y != 4){ + return "Expected Takashi (ViridianCity_Gym/black_belt@10,2) to walk up to (10, 4)."; + } + if (trainer_walking_up(story_maps(), MapPosition{std::string(GYM), {10, 5}}, {takashi->trainer})){ + return "Expected no trainer to walk up once Takashi is beaten."; + } + return true; +} + +// 17.03: Takashi, facing south on (10, 2) with a sight of 3, is fought +// from his right, (11, 2), where the arrows (19, 14) and (19, 2) slide the +// player; he stays on (10, 2), and below_giovanni goes up column 10 past +// him. Fought from his line, (10, 5), he walked up to (10, 4) and stood +// across that way (console B, 2026-11-15 16:52). +UnitTestResult test_row_17_03(){ + return walk_row("17.03", "", "below_giovanni", story_maps(), MapPosition{std::string(GYM), {2, 3}}); +} + +const std::string WARREN = "ViridianCity_Gym/cooltrainer_m@13,7"; +const std::string TAKASHI = "ViridianCity_Gym/black_belt@10,2"; + +// A leg the walker's [Leg] records say it walked. +struct WalkedLeg{ + std::string direction; + int tiles = 0; +}; + +// The legs the walker's [Leg] records say it walked, in order; turns in +// place (0 tiles) left out. +std::vector walked_legs(const std::vector& log){ + std::vector legs; + for (const std::string& line : log){ + const size_t dir = line.find("\"dir\":\""); + const size_t tiles = line.find("\"tiles\":"); + if (line.find("[Leg]") == std::string::npos || dir == std::string::npos || tiles == std::string::npos){ + continue; + } + const size_t from = dir + 7; + WalkedLeg leg{.direction = line.substr(from, line.find('"', from) - from), .tiles = std::atoi(line.c_str() + tiles + 8)}; + if (leg.tiles > 0){ + legs.push_back(std::move(leg)); + } + } + return legs; +} + +bool opposite(std::string_view a, std::string_view b){ + return (a == "north" && b == "south") || (a == "south" && b == "north") + || (a == "east" && b == "west") || (a == "west" && b == "east"); +} + +// 17.03's route `event` planned from `from` over the gym with `beaten` +// beaten, as the program plans it, and walked on the sim with nothing +// injected. A clean walk needs no position check: it never plans again +// from an unknown tile, and no leg walks 2 tiles or more back the way the one before went +// (console B, 2026-11-15 21:39, below_giovanni: "west 3 (open)" to (7, 3) +// and "north 3 (open)" up to Giovanni each arrived, and each was followed +// by holds to walls and back). +UnitTestResult walk_event_clean(std::string_view event, const StoryPose& from, const std::set& beaten){ + const StoryCheckpoint& row = table_row("17.03"); + const StoryStep* step = nullptr; + for (const StoryStep& candidate : row.steps){ + if (candidate.name == event){ + step = &candidate; + } + } + if (step == nullptr){ + return std::format("17.03 has no step {}.", event); + } + const std::vector maps = with_trainers_beaten(story_maps(), beaten); + const std::optional> route = walked_route(from, *step, maps); + if (!route || route->empty()){ + return std::format("17.03 {}: no route from {}.", event, to_string(from.tile)); + } + OverworldSim sim(maps, MapPosition{from.map, from.tile}, from.facing.value_or(Direction::SOUTH)); + OverworldSimWalker walker(sim); + const RoutePlanning planning{ + .maps = &maps, .costs = story_route_costs(), .start = MapPosition{from.map, from.tile}, .label = std::string(event), + .beaten_trainers = beaten + }; + const std::string failure = walker.run(*route, planning); + std::string log; + for (const std::string& line : walker.log()){ + log += "\n " + line; + } + if (!failure.empty() || !(sim.state().position == route->back().end)){ + return std::format("17.03 {}: ended on {}, not {}: \"{}\"{}", event, to_string(sim.state().position), to_string(route->back().end), failure, log); + } + if (log.find("plan from an unknown tile") != std::string::npos){ + return std::format("17.03 {}: a clean walk planned again from an unknown tile:{}", event, log); + } + // A step back off a wall the plan holds to, to the tile beside it, is + // how a planned walk lands an open leg in a funnel; walking 2 tiles or + // more back is a detour. + const std::vector legs = walked_legs(walker.log()); + for (size_t c = 1; c < legs.size(); c++){ + if (opposite(legs[c - 1].direction, legs[c].direction) && legs[c].tiles > 1){ + return std::format("17.03 {}: leg {} ({} {}) walks back the way leg {} ({}) went:{}", event, c + 1, legs[c].direction, legs[c].tiles, c, legs[c - 1].direction, log); + } + } + return true; +} + +// right_of_takashi from Warren's battle tile, Warren beaten (17.02). +UnitTestResult test_17_03_right_of_takashi_clean(){ + return walk_event_clean("right_of_takashi", StoryPose{std::string(GYM), {15, 7}, Direction::NORTH}, {WARREN}); +} + +// below_giovanni from beside Takashi, him beaten too. +UnitTestResult test_17_03_below_giovanni_clean(){ + return walk_event_clean("below_giovanni", StoryPose{std::string(GYM), {11, 2}, Direction::WEST}, {WARREN, TAKASHI}); +} + // 17.04b after Giovanni's win: back through the gym past its beaten // trainers (Takashi's line on row 3 among them), out of the door and the // Fly to below the Center's door (26, 27). @@ -199,6 +335,22 @@ const AutoStoryViridianCase AUTO_STORY_VIRIDIAN_CASES[] = { .input = {.name = "17.02: from the Fly to Viridian through the gym into Warren's line", .body = test_row_17_02}, .expectation = {.description = "Warren's battle won on (15, 7), no other trainer met"}, }, + { + .input = {.name = "Takashi seen from his line on (10, 5)", .body = test_takashi_walks_up}, + .expectation = {.description = "walks up to (10, 4); beaten, sees no one"}, + }, + { + .input = {.name = "17.03: Takashi fought from his right, then up column 10 to Giovanni", .body = test_row_17_03}, + .expectation = {.description = "on ViridianCity_Gym (2, 3), Takashi's battle the only one"}, + }, + { + .input = {.name = "17.03 right_of_takashi walked clean", .body = test_17_03_right_of_takashi_clean}, + .expectation = {.description = "arrives on (11, 2) with no position check and no leg walked back"}, + }, + { + .input = {.name = "17.03 below_giovanni walked clean", .body = test_17_03_below_giovanni_clean}, + .expectation = {.description = "arrives below Giovanni on (2, 3) with no position check and no leg walked back"}, + }, { .input = {.name = "17.04b: out of the beaten gym and by Fly to below Viridian's Center", .body = test_row_17_04b}, .expectation = {.description = "on ViridianCity (26, 27), no trainer met"}, 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 3ccab42213..88eb14b621 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -24,6 +24,7 @@ #include "VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_OptionMenuReader.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldGatedRoute.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldObjects.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecovery.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRoute.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTileRules.h" @@ -49,7 +50,10 @@ #include "PokemonFRLG_AutoStoryPlanGolden19.h" #include "PokemonFRLG_AutoStoryPlanGolden20.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryLineTrainer.h" +#include "PokemonFRLG_AutoStoryPacedRoute.h" #include "PokemonFRLG_AutoStoryMoveData.h" +#include "PokemonFRLG_AutoStoryTrainerLine.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" #include "PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h" @@ -355,9 +359,25 @@ UnitTestResult check_route(StoryPose& pose, const StoryStep& step, std::vector(step.args, "direction"); + const int tiles = step.action == TRAINER_LINE_VARIANT ? TRAINER_LINE_TILES : 1; + for (int c = 0; c < tiles; c++){ + pose = StoryPose{pose.map, pose.tile.next(direction), direction}; + if (note_trainer_walked_up(MapPosition{pose.map, pose.tile}, walk_state().run_flags)){ + return; + } + } +} + // check_checkpoint()'s walk through the steps. UnitTestResult check_checkpoint_steps(const StoryCheckpoint& checkpoint, StoryPose& pose, std::vector& golden){ for (const StoryStep& step : checkpoint.steps){ + const std::string map_before = pose.map; if (step.kind == StoryStepKind::ROUTE || step.kind == StoryStepKind::LEGS){ UnitTestResult result = step.kind == StoryStepKind::ROUTE ? check_route(pose, step, golden) : check_legs(pose, step); if (result.result != UnitTestResult::PASSED){ @@ -372,6 +392,8 @@ UnitTestResult check_checkpoint_steps(const StoryCheckpoint& checkpoint, StoryPo if (result.result != UnitTestResult::PASSED){ return checkpoint.id + " " + result.message; } + }else if (step.kind == StoryStepKind::STEP && (step.action == TRAINER_LINE_VARIANT || step.action == TRAINER_WAIT_VARIANT)){ + step_into_line(step, pose); }else if (step.kind == StoryStepKind::STEP){ const Direction direction = Pokemon::story_arg(step.args, "direction"); pose = StoryPose{pose.map, pose.tile.next(direction), direction}; @@ -379,6 +401,7 @@ UnitTestResult check_checkpoint_steps(const StoryCheckpoint& checkpoint, StoryPo if (step.pose_after){ pose = one_tile(Pokemon::grid_pose_of(*step.pose_after)); } + trainers_back_after_map_change(map_before, pose.map, walk_state().run_flags); apply_step_effects(step); } return true; @@ -609,9 +632,9 @@ bool looks_around(const MapObject& object){ // The trainer on `map` who would see the player on `tile`, other than the // `beaten`. Wanderers and those who look around are left out (no route can plan round one: wanderer_stops(), // held_past_lookers()); with `lookers`, only those who look around, met by a wait (TRAINER_WAIT_VARIANT). -const MapObject* trainer_seeing(const MapData& map, const TilePos& tile, const std::set& beaten, bool lookers){ +const MapObject* trainer_seeing(const MapData& map, const TilePos& tile, const std::set& beaten, bool lookers){ for (const MapObject& object : map.objects){ - if (object.trainer && !object.wander && looks_around(object) == lookers && !beaten.contains(&object) && trainer_may_see(map, object, tile)){ + if (object.trainer && !object.wander && looks_around(object) == lookers && !beaten.contains(trainer_id(map, object)) && trainer_may_see(map, object, tile)){ return &object; } } @@ -622,7 +645,7 @@ const MapObject* trainer_seeing(const MapData& map, const TilePos& tile, const s // trainer's line, the first within TRAINER_LINE_TILES that a trainer // other than the `beaten` sees, where step_until_seen() stops, else the // last. -TilePos step_end(const StoryPose& pose, const StoryStep& step, const std::set& beaten){ +TilePos step_end(const StoryPose& pose, const StoryStep& step, const std::set& beaten){ const MapData* map = find_map_named(pose.map); const Direction direction = Pokemon::story_arg(step.args, "direction"); if (step.action != TRAINER_LINE_VARIANT || map == nullptr){ @@ -706,14 +729,14 @@ std::vector> wanderer_stops(const StoryPose& pose, co // on to its wall after the battle. Or the leg is one tile: the trainer // sees the player when the step is done, on its end. Empty if so, else // the leg that doesn't. Trainers in `beaten` see no one. -std::string held_past_lookers(const StoryPose& pose, const StoryStep& step, const std::set& beaten){ +std::string held_past_lookers(const StoryPose& pose, const StoryStep& step, const std::set& beaten){ MapPosition from{pose.map, pose.tile}; for (const RouteStep& leg : legs_walked(pose, step)){ const MapData* map = find_map_named(from.map); bool crosses = false; for (const MapPosition& tile : leg.action == RouteAction::WALK && map ? leg_tiles(walk_maps(), from, leg) : std::vector{}){ for (const MapObject& object : map->objects){ - crosses |= looks_around(object) && !beaten.contains(&object) && trainer_may_see(*map, object, tile.point); + crosses |= looks_around(object) && !beaten.contains(trainer_id(*map, object)) && trainer_may_see(*map, object, tile.point); } } if (crosses && !leg.to_wall && leg.tiles != 1){ @@ -741,7 +764,7 @@ std::vector tiles_walked(const StoryPose& pose, const StoryStep& st // Why the player shouldn't walk onto `tile`, or empty: tall grass, a warp // to a map not loaded (Route 4's ways into Mt. Moon), a trainer's line. -std::string tile_problem(const MapPosition& tile, const std::set& beaten){ +std::string tile_problem(const MapPosition& tile, const std::set& beaten){ const MapData* map = find_map_named(tile.map); if (map == nullptr){ return "off the story's maps at " + to_string(tile); @@ -807,11 +830,20 @@ bool wanders_past_known(const StoryCheckpoint& checkpoint, const StoryStep& step return lewis || roland || incidental_fights(checkpoint.id); } +// The trainers `step`'s flags_after say are beaten (TRAINER_BEATEN_FLAG), +// added to `beaten`: a battle a talk starts, as 17.03's Takashi fought +// from his right. +void add_beaten_after(const StoryStep& step, std::set& beaten){ + const std::set fought = beaten_trainers(std::set(step.flags_after.begin(), step.flags_after.end())); + beaten.insert(fought.begin(), fought.end()); +} + // `checkpoint`'s routes and legs keep to tiles with no tile_problem(); a -// step into a trainer's line is followed by the battle, which beats them. +// step into a trainer's line is followed by the battle, which beats them, +// as does a battle whose flags_after say so. // `repelled`: a Repel the table used is on (it lasts past the // checkpoint's save): grass is walked as any floor. -UnitTestResult check_lines(const StoryCheckpoint& checkpoint, std::set& beaten, bool& repelled){ +UnitTestResult check_lines(const StoryCheckpoint& checkpoint, std::set& beaten, bool& repelled){ begin_walk(checkpoint); StoryPose pose = one_tile(Pokemon::grid_pose_of(*checkpoint.start)); for (size_t c = 0; c < checkpoint.steps.size(); c++){ @@ -846,8 +878,9 @@ UnitTestResult check_lines(const StoryCheckpoint& checkpoint, std::set beaten; + std::set beaten; bool has_shoes = false; bool repelled = false; for (const StoryCheckpoint& checkpoint : story_checkpoints()){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.02b.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.02b.plan.json index 0aad746a81..31f25c39f3 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.02b.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.02b.plan.json @@ -44,6 +44,23 @@ "declared_after": {"map": "FuchsiaCity_WardensHouse", "tiles": [[3, 6]], "facing": "north"}, "why": "he takes the GOLD TEETH and gives HM04 STRENGTH (FuchsiaCity_WardensHouse_EventScript_GiveGoldTeeth; no YES/NO with the teeth; pokeguy 1:18:25 to 1:18:39)" }, + { + "id": "warden_outside", + "kind": "route", + "action": "run", + "args": { + "target": {"map": "FuchsiaCity", "tiles": [[33, 32]], "facing": "south"} + }, + "why": "out of the Warden's door onto the street below it (33, 31): Fly works outdoors only" + }, + { + "id": "fly_fuchsia", + "kind": "game_action", + "action": "fly", + "args": {"town": "FuchsiaCity", "species": "pidgey"}, + "declared_after": {"map": "FuchsiaCity", "tiles": [[25, 32]], "facing": "south"}, + "why": "the walk from the Warden's door to the Center's is 85 tiles round the city's west side (story route plan golden); Fly to Fuchsia City lands below the Center's door (25, 31) on its heal spot (user, 2026-11-15: \"yeh should fly\")" + }, { "id": "below_center_door", "kind": "route", @@ -51,7 +68,7 @@ "args": { "target": {"map": "FuchsiaCity", "tiles": [[25, 32]], "facing": "north"} }, - "why": "out of the Warden's door and west along row 32 to below the Center's door (25, 31)" + "why": "turn to the Center's door (25, 31) from Fly's landing: no tile to walk" }, { "id": "fuchsia_nurse", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json index 32337f46e6..63fd2b49f0 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.02.plan.json @@ -149,7 +149,11 @@ ], "facing": "north" }, - "why": "Warren (TRAINER_COOLTRAINER_WARREN): Marowak Lv37, Marowak Lv37, Rhyhorn Lv38, Nidorina Lv39, Nidoqueen Lv39" + "why": "Warren (TRAINER_COOLTRAINER_WARREN): Marowak Lv37, Marowak Lv37, Rhyhorn Lv38, Nidorina Lv39, Nidoqueen Lv39; he walked up from (13, 7) to (14, 7) when he saw the player on (15, 7), and stands there from now on (trainer_at), across row 7 west of the player", + "flags_after": [ + "trainer_beaten:ViridianCity_Gym/cooltrainer_m@13,7", + "trainer_at:ViridianCity_Gym/cooltrainer_m@13,7=14,7" + ] } ] }, diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json index 25600f94d1..0f88434b26 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-17.03.plan.json @@ -14,9 +14,13 @@ ], "facing": "north" }, + "start_flags": [ + "trainer_beaten:ViridianCity_Gym/cooltrainer_m@13,7", + "trainer_at:ViridianCity_Gym/cooltrainer_m@13,7=14,7" + ], "events": [ { - "id": "below_takashi_line", + "id": "right_of_takashi", "kind": "route", "action": "run", "args": { @@ -24,23 +28,19 @@ "map": "ViridianCity_Gym", "tiles": [ [ - 10, - 6 + 11, + 2 ] ], - "facing": "north" + "facing": "west" } }, - "why": "back up column 15, west along row 6 to (10, 6), below Takashi's line (10, 3..5)" + "why": "planned from Warren's (15, 7) through the gym, the spinners ridden as planner moves (ViridianCity_Gym's arrow glyphs, PokemonFRLG_OverworldSpin.h): below the up arrow (19, 15), up column 19 to (19, 3), the left arrow (19, 2) west along row 2 to the stop tile (11, 2), beside Takashi (10, 2) on his right, out of his line (column 10, (10, 3..5)); the walk ends on a localized tile before the talk" }, { - "id": "takashi_line", - "kind": "step", - "action": "trainer_line", - "args": { - "direction": "north" - }, - "why": "onto (10, 5), the end of Takashi's line (sight 3, facing south)" + "id": "challenge_takashi", + "kind": "talk", + "why": "Takashi (10, 2), from his right: fought where he stands, so he walks nowhere and stays on (10, 2) after" }, { "id": "takashi", @@ -58,13 +58,16 @@ "map": "ViridianCity_Gym", "tiles": [ [ - 10, - 5 + 11, + 2 ] ], - "facing": "north" + "facing": "west" }, - "why": "Takashi (TRAINER_BLACK_BELT_TAKASHI): Machoke Lv38, Machop Lv38, Machoke Lv38, Machoke Lv43" + "why": "Takashi (TRAINER_BLACK_BELT_TAKASHI): Machoke Lv38, Machop Lv38, Machoke Lv38, Machoke Lv43; beaten, he sees no one on column 10 after", + "flags_after": [ + "trainer_beaten:ViridianCity_Gym/black_belt@10,2" + ] }, { "id": "below_giovanni", @@ -82,7 +85,7 @@ "facing": "north" } }, - "why": "west along row 3 and down to (2, 3), facing Giovanni (2, 2)" + "why": "planned from Takashi's right (11, 2), down the spinners (the right arrow (11, 3) and the down arrow (18, 3), the only way off row 2 with Takashi on (10, 2)) and round to below Giovanni (2, 2), facing him; beaten, Takashi sees no one" } ] }, @@ -90,6 +93,7 @@ "menu": "full", "notes": { "checkpoint": [ + "Starts on (15, 7) after Warren's battle in 17.02: he stands on (14, 7) since (start_flags, as 17.02's battle sets them). Takashi is fought from his right, (11, 2), which the arrows (19, 14) and (19, 2) slide the player to: from his line (10, 5) he walked up to (10, 4) and stood across the only way north to Giovanni (console B, 2026-11-15 16:52). Fought from the side he stays on (10, 2), and the way north up column 10 is open.", "Ends at (2, 3) facing Giovanni (2, 2): the save in front of him, as for the other leaders." ] } @@ -109,4 +113,4 @@ } } } -} \ No newline at end of file +} diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index bada30a983..2cb35cb748 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2112,6 +2112,7 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldStepChecks.h Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTileRules.h Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTiles.h + Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTrainerCrossing.cpp Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldTrainerCrossing.h Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.h @@ -2168,6 +2169,9 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCapture_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCeladon_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCeladonGym_Tests.cpp + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimBudget.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.cpp + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepLint_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySurf_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySurf_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryCenterHeal.h @@ -2205,6 +2209,8 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFrameReplay_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLegs.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLegs.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.cpp + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLineTrainer.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoveSteps.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoveSteps.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFieldMoves.cpp