Skip to content

FRLG 20.01a to 20.05: Indigo Plateau's Mart, the Elite Four and the Champion - #458

Draft
dayfine wants to merge 251 commits into
frlg/stage19b-victory-cavefrom
frlg/stage20-league
Draft

dayfine wants to merge 251 commits into
frlg/stage19b-victory-cavefrom
frlg/stage20-league

Conversation

@dayfine

@dayfine dayfine commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Depends on #457 (base frlg/stage19b-victory-cave), with #453 (Fly party scan), #463 (surf legs that land) and #451 ([Leg] records and the hold movement check, with #464's shared leg trace and replay) merged in, so the diff also shows their changes until they land in the base.

Also depends on #474 (shared checkpoint-file loading), merged in: FRLG's story now loads through it (load_frlg_story(), STORY_ORDER as plays_before), gaining the shared save/reload_when_chained/dev_only fields and dev files from AutoStoryDev/frlg/; PokemonFRLG::StoryFiles tests pin the authored rows' order and marks.

The story stopped at Indigo Plateau's Center (19.05). This adds the League as six checkpoints, each boss its own: 20.01a buys Full Restores to 13 at the Plateau's Mart (PokeGuy's Lorelei bag), then 20.01 Lorelei, 20.02 Bruno, 20.03 Agatha, 20.04 Lance (a heal after Agatha) and 20.05 the Champion and the Hall of Fame (a heal after Lance). Each fight uses PokeGuy's C2 setup goals from pokeguy-conditions.md, and its foe_threats come from PokemonSimulation's planning_risk() for each foe leading against that fight's entry state, the same generator as 19.01's rival. A test pins those rows. The rooms are one-way: each row walks round the beaten trainer to the door north and steps in. The room's own script then walks the player up (a scene), and a route reaches the tile in front of the next trainer. The League maps are now loaded.

  • Not modelled: Bruno's target_torrent; PokeGuy's Elixir before the Champion (use_item has no Elixir); the Full Restore he spends after Agatha (heal_to_full uses Potions/Super Potions instead).
  • The map pack draws the League's north doors closed (walls), so the sim checks each row only up to below its door. The step through the door is left to the console.
  • The Hall of Fame saves the game itself and rolls the credits. 20.05's own end save there is unverified.

Testing: AutoStory golden, run plan, save card, the new League simulation suite and the 20.0N fault sweeps pass on the headless runner (FRLG AutoStory: only the image/Resources tests that need the CommandLineTests checkout fail). No console run yet. With #451 in, 19.04b's below_ladder steps off the boulder on the switch first (the plan walked through it), and a one-tile route from the start onto a tile before a wall or a person may already stand there (the 20.0N scene end pose sweeps).

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

dayfine and others added 30 commits November 12, 2026 16:36
…ack to Saffron (16.02-16.06)

Five checkpoints after 16.01: the Card Key pickup (flags_after card_key_held), the
card-key doors as gates_after on the opening steps, the rival on 7F, the Lapras gift
by the Gift RNG handoff (16.03 -> 16.04), Giovanni on 11F with the silph_cleared flag,
the president's Master Ball behind a "Take the Master Ball" option (skipped in
SPEEDRUN), and the walk back to the Saffron Center. story_maps(run_flags) hides the
Saffron Rocket at (46,13) once silph_cleared is set. Silph's doors come from trimmed
GateMaps fixtures (PokemonSimulation 82b5b05), since the pinned maps have them open.
The row sim plans on gates and picks up the Card Key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…andoff

A shiny is the handoff's success (the rows after it stay FRLG's, built from the
game's state); every other loop end is the user's turn. rng_handoff_mode() replaces
the STOP || RUN tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…its signature

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRowSim.h
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The Card Key is picked up during a run, so the sim's own flag is the source;
a SimState copy went stale.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…oors); 16.06 walks past the left Rockets

The pin (4b886bb) has Silph Co.'s card-key doors, so with_gate_maps() and its
82b5b05 fixtures go, as their TODO says. 16.06's walk is exempt from trainer
lines as 16.05's is: Giovanni's Rockets have left (silph_cleared), which the
test's maps don't carry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…06 no longer an incidental-fights row

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp
…'s merge missed them); 71 checkpoints

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp
…rge counted one twice)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…rge counted one twice)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
A boss battle is its own checkpoint (user, 2026-11-12). 16.03 walks up to the rival on 7F and ends where his battle leaves the player; the new 16.03b starts there, walks to the employee with the Lapras and takes over the Gift RNG handoff (the save facing the employee). Ids are not renumbered; the golden, run-plan, table, count, Silph tests and the Gift RNG option text follow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Saffron's gym rows (18.01, 18.02) now sit between 16.01 and 17.02, which starts where 18.02 ends.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
PokemonSimulation's maps since #100 give Chad (36, 4) a wander box, column
36 rows 1..7. With sight 2 he sees down to row 9, and every way east
crosses his column there, so the sim, which looks from every tile of the
box, fights him. The cut tree gate on (30, 3) doesn't change the route.
…ped leg to a wall is held after a tap shows no step

With the quiz doors as gates the clean 14.01 row passes, so its fault
sweeps run for the first time.

Scene end pose: from a tile off the nurse, the walk out ended on a side
tile of the mat, which warps only on a step south into the wall. As in
12.01, legs to the Center's northwest corner (0, 2) start the walk out
from a known tile.

Unseen step: a tap of a tapped leg to a wall that showed no step ended
the leg blocked, and the route failed unless a sign stood ahead. The
leg is now held again to its wall, untapped, so the wall finds the
player wherever the taps left them. 16.02, 14.03 and 11.03's unseen step
sweeps pass with it and leave KNOWN_FAILING.
…rt; a leg up to water ends to the wall

Unseen step, 10.04: the Pokemon Tower's taps legs to a wall start wild
battles, so after_wall_stop() took a tap that showed no step as a wild
battle's interrupt and tapped the leg again, 9 times. The blocked tap is now
held to its wall before that branch, as aebfdda does elsewhere.

Scene end pose, 11.02: from a slope that ended a row high, route18_west_wall's
"south 1" down to Route 18's water was an open leg, so the player stayed on
row 9 and the safari_zone_door ride missed the gate's row. fixed_route() now
ends a leg facing water (no Surf) to the wall, as stops_at() does for the
planner; the hold finds the water's edge from either row.

The lift sim test waits out the ride (lift_ride, f46a21c) before the hold.
Fork CI fetches the FRLG Pokemon sprite sheets from dayfine/Packages
lab/autostory-resources for the AutoStoryResources test.
The warp no-op sweep kills the warps of each map a row warps from, but
the sim's Fly ignored that knob and always landed, so the fault was never
injected for a Fly: 11.01, 12.03, 14.03 and 17.02 went on as clean and
the sweep reported "not stopped". On the console fly_to_town() already
fails as fly_no_takeoff when the screen never leaves the departure town;
the sim's row step checks the landing tile (ended_on()) the same way.

Now a Fly from a dead-warp map does nothing, the row stops at the Fly,
and the four rows leave KNOWN_FAILING. New test: AutoStoryFieldMoves
"fly with no takeoff on the sim".
A blocked step tap kept, of the tiles up to BLOCKED_TAP_SLACK past the
taps that moved, only those with the way ahead blocked. A tap that moved
but read as not moved leaves the player a tile on, where the way is open,
so with a wall a few tiles on the walker took the player to be there: on
Pokemon Tower 6F's column 16 it went on from (16, 4) while the player
stood on (16, 7), and 10.05's jennifer_line found no trainer (the unseen
step sweep, step tap 8).

stop_candidates() now marks, on a tapped leg, the tile one past the taps
seen to move (StopCandidate::past_seen_taps), and the blocked filter keeps
it, so the walls find the player from either tile. 10.05's unseen step
sweep leaves KNOWN_FAILING. The OverworldWalk "step tap read as not
moved" test is now cases, with Tower 6F's column added.
Each row gets a "clean run" test; a clean failure was only logged as
"not swept" while every fault test passed. The row's sim now starts as the
row does: its start_gates open and the Card Key held from start_flags
(14.02b's quiz doors, 14.04b's cut tree, 16.03-16.06's doors, 19.04d's
switch), gates and Card Key carried over a stubbed step, and the gyms
whose leader an earlier row beat cleared (17.04b past Takashi). 04.05,
06.02, 09.02 and 17.03 (Takashi stands in the way after his battle) are
known-failing clean runs. Viridian tests walk rows 17.02 and 17.04b.
The row sim's step onto a warp and its Center and lift room legs waited
AFTER_WARP from the step, not from the fade's end as the console's
wait_out_warp() does (BlackScreenOverWatcher). With every fade 1500 ms late
the next taps went in while the game took none: 17.04b's walk to Viridian's
nurse ended a tile short, and 14.02b's route after Cinnabar Gym's door
started frozen. sim_wait_out_warp() watches the fade to its end first.
Fixes the late fade sweeps of 17.04b and 14.02b and 17.04b's slow fade-in.
A sim started with a cut tree's gate open (a row's start_gates: the save
keeps the tree cut) opened the tile but left the tree's object standing,
so the player bumped it: the sweep's 14.04b clean run stopped at Celadon
Gym's inner tree (3, 5) on row_5_to_wall and failed at column_2_to_wall
from (5, 7). open_start_gates() cuts those trees, to grow back after a
warp as cut ones do. New OverworldGates sim test.
16.02's walk to the corridor ends on (12, 21), in the line of the Rocket
on (9, 21), who looks north and east; the sim fights him there. 16.03
starts from the save after that, so its start_flags list him beaten, and
the fault sweep now starts a row with its start_flags: the trainers they
beat are no trainers on its maps, and the steps get the flags. Before, the
16.03 clean run met him on to_3f_trainer's walk west and could not find the
player again.
A tap north from (16, 8) that stepped unseen left the player on (16, 7) or
(16, 8), and the hold that found them again went up column 16 through
Jennifer's line to its wall, so she was fought before jennifer_line, which
then found no trainer (the unseen step sweep, step tap 8). The legs end on
(16, 8), and jennifer_line taps up from there: two taps to (16, 6).
dayfine and others added 7 commits November 14, 2026 20:35
…ight

The to_corridor route ended on (12, 21), three east of Grunt1 (9, 21), who
faces north or east by turns (MOVEMENT_TYPE_FACE_UP_AND_RIGHT): the walk
fought him only when he happened to face east, so 16.03's start flag
trainer_beaten:SilphCo_5F/rocket_m@9,21 held by chance. The route now ends
a tile above, on (12, 20); a trainer_wait step south onto (12, 21) waits for
him to face east and walk up, his battle (Arbok Lv33) follows and sets the
flag. The east legs to the Card Key's ball are unchanged from (12, 21).

The Silph row sim plays a battle whose trainer's message is up instead of
skipping it as a scripted one, and a new test checks the battle, its flag
and 16.03's start flag.
…p; ledge hop 32 frames

Console B failed 15.01 twice at the same tile (2026-11-14 20:23, 20:27). The
dead-reckoned "east 19" ran a column long because the Celadon -> Route 7
crossing did not hold the player up, "south 8" down column 8 hopped the row-8
ledge and ended a row short, and "east 9 (warp)" held into the gate wall; the
no-fade warp acceptance then took the still outdoor screen as the gate.

- 15.01 plan: a to_gate_wall step (south to a wall on row 11, east to the
  gate wall at (15, 11)), then north 1 onto the door tile and east 1 (warp).
- arrived_without_fade(): the later screen must show a building's or gate's
  map with the black below it; a still outdoor screen is not a warp.
- Sim: a ledge hop costs LEDGE_HOP_TIME (32 frames) regardless of pace, so a
  running hold timed by its tiles ends short of its tile after a hop.
- Tests: warp-fade case for a wall stop outdoors; Saffron sim case running
  15.01 to the gate at run pace with no connection stall (red on the old plan).
….01 sweep

- LEDGE_HOP_TIME is TILE_TIME * 2: 533 ms, a millisecond under two rounded
  walk tiles, let the walking hold of "no hold over a ledge" take a step past
  the ledge to (26, 32), where the console stopped on (26, 31).
- Golden 15.01: "walk north 1" onto the gate's door tile is a tap, as the
  test output prints it.
- Route 3 trainer lines: 44, with 16.02's planned fight with Silph Co. 5F's
  corridor Rocket (7c95b4d, red on the base too).
- Fault sweep 18.01 late fade passes: off KNOWN_FAILING (red on the base too).
FRLG 15.01: Route 7's gate by legs to walls; a still screen is no warp
Console B, 2026-11-14 22:27, 15.01 west_of_tea_guard: the turn tap east on
Route 7's gate door (15, 10), a walk_east warp, took the warp; its fade passed
while the turn was read, and the hold and the two steps more walked on inside
the gate. The sim's turn tap only turned. Now a tap or hold off an exit mat its
way takes the warp with no turn first. New Saffron sim case from the gate's
wall facing north is red: no fade in and out after walking onto the warp.
RouteStep::off_exit_mat marks a warp leg that starts on an exit mat and goes
its way; turns_first() skips the turn tap there, so the hold takes the warp
and its fade is watched along the hold. The fade watcher and
arrived_without_fade() were fine: the warp was taken before the leg's
'before' screen, which then showed the gate itself.
B3F's (15, 18) is MB_DOWN_LEFT_STAIR_WARP: the stair exit leaves the
player facing east, and pokefirered's TryArrowWarp takes a stair warp
from a held press its way, the same as an arrow warp. The plan's turn
west there took the stairs back down to B4F on the sim since the exit
mat change; the target now keeps the arrival facing.
dayfine and others added 9 commits November 14, 2026 23:54
…awn tile

Console B run 4 (2026-11-14 23:24): 16.03's "west 11" along SilphCo_5F
row 21 stopped two tiles short of the pad, with the Rocket 16.02 had just
beaten standing on (11, 21). He saw the player waiting on (12, 21) and
walked up from his map tile (9, 21); the game leaves a beaten trainer
where he stopped. The planner and the row sim kept him on (9, 21), so
the route ran through the tile he actually blocks.

A run flag, TRAINER_AT_FLAG ("trainer_at:<trainer_id>=<x>,<y>"), records
where a trainer stands after his fight; 16.02's battle sets it and 16.03
starts with it. run_story_maps() applies the moved trainers to the maps
the run plans on (PokemonFRLG_AutoStoryMovedTrainers), and the row sim's
walk plans on run_story_maps(flags) as the program does, instead of
story_maps(). The Silph rows' sim stands the beaten Rocket on (11, 21),
where the sim's trainer_sees leaves him (red: 16.03 blocked on (12, 21);
green with the flag), and a new case checks the flag data and maps. The
golden plan for 16.03 goes west 9, north 1, west 2 onto the pad.
…' reference

GCC's -Wdangling-reference flagged binding the result to a call with a
temporary set.
FRLG 15.01: no turn tap on a warp leg off an exit mat (Route 7's gate door)
… that leg did

The way back after finding the player at walls was planned to the leg's end
tile with no facing, so it ended with its own last leg's facing ("north 1
(to wall)") while the route still reported the planned one (west). 16.03's
rival_trigger step then tapped west with no turn first, which only turned the
player beside the trigger (2, 4). plan_reanchor() now takes the facing the way
back must end with; the walker passes the leg's own when nothing follows it.
FRLG AutoStory 16.03: re-anchored last leg ends facing as planned (rival trigger)
…he Bicycle

- 16.03's golden: "north 1 (to wall)" to SilphCo_5F (12, 20), (12, 19) a wall.
- Fault sweep: a row that starts with silph_cleared sims on maps without
  Giovanni's Rockets, as the planner's run_story_maps() has them. 16.06's
  clean run planned up column 2 of 11F while the sim's Grunt2 stood on (2, 19).
- Recovery: a way back after a re-anchor ends facing the route's last leg only
  on foot. On the Bicycle the turn tap stepped a tile off the end
  (OverworldBike "a leg on the Bicycle that starts off it" ended on (8, 2)).
- Mount lost sweep: a riding clean run that fails counts as 1 variant, not 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant