Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7b9281b
FRLG AutoStory: stop for Starter RNG under the starter's ball
dayfine Nov 2, 2026
74f1442
Merge commit 'HEAD@{1}' into HEAD
dayfine Nov 2, 2026
756fdb1
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 2, 2026
4eeb918
Merge commit '8f6383b5f' into HEAD
dayfine Nov 2, 2026
f1c2f60
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 2, 2026
edce2a6
Merge branch 'frlg/autostory-sid-helper' into frlg/autostory-starter-rng
dayfine Nov 2, 2026
b9dc95e
Merge branch 'frlg/autostory-sid-helper' into frlg/autostory-starter-rng
dayfine Nov 3, 2026
675e8ad
Merge remote-tracking branch 'origin/frlg/autostory-sid-helper' into …
dayfine Nov 3, 2026
ef4c16c
Merge branch 'frlg/autostory-sid-helper' into frlg/autostory-starter-rng
dayfine Nov 3, 2026
61e9412
Merge branch 'frlg/autostory-sid-helper' into frlg/autostory-starter-rng
dayfine Nov 3, 2026
6c8f6f2
Merge branch 'frlg/autostory-sid-helper' into frlg/autostory-starter-rng
dayfine Nov 3, 2026
8491006
Merge branch 'frlg/autostory-sid-helper' into frlg/autostory-starter-rng
dayfine Nov 3, 2026
b64c8bb
Merge remote-tracking branch 'origin/frlg/autostory-sid-helper' into …
dayfine Nov 3, 2026
87cbb0e
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 3, 2026
55613ff
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 3, 2026
0ec2f03
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 3, 2026
f3f3bfa
Merge frlg/autostory-sid-helper (047f95d3f, #119 recovery) into frlg/…
dayfine Nov 3, 2026
4bba467
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 3, 2026
c4fab0c
Merge remote-tracking branch 'origin/frlg/autostory-sid-helper' into …
dayfine Nov 3, 2026
322f707
Merge remote-tracking branch 'origin/frlg/autostory-sid-helper' into …
dayfine Nov 3, 2026
bf0a3a0
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 3, 2026
1db4269
Merge frlg/autostory-sid-helper (battle loop: end on the overworld af…
dayfine Nov 3, 2026
56ae755
Merge frlg/autostory-sid-helper (a disabled move, and a move list tha…
dayfine Nov 3, 2026
89d1dc1
Merge frlg/autostory-mvp (matchup attacks in every battle) into frlg/…
dayfine Nov 3, 2026
e338553
Merge frlg/autostory-mvp (HP bar share, nurse for yellow HP, move pro…
dayfine Nov 3, 2026
0bd23ad
Merge frlg/autostory-sid-helper (886eddddc: verify mode from #122) in…
dayfine Nov 3, 2026
9cafcf7
Merge frlg/autostory-sid-helper (f4f5a75b7: battle sim from #120) int…
dayfine Nov 3, 2026
5a4ece5
Merge frlg/autostory-sid-helper into frlg/autostory-starter-rng
dayfine Nov 3, 2026
fc8b723
Merge frlg/autostory-sid-helper (TM moves in the summary reader) into…
dayfine Nov 3, 2026
c7e2854
Merge frlg/autostory-sid-helper (bag rows below an item the reader ca…
dayfine Nov 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

}

AutoStory::AutoStory()

Check warning on line 56 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::AutoStory::AutoStory(): function_lines=44 (advisory above 25, limit 50)
: RUN(checkpoint_database())
, NEW_GAME_FROM_TITLE(
"<b>New game from the title screen:</b><br>The game is on its title screen with no save data. "
Expand All @@ -77,6 +77,14 @@
LockMode::LOCK_WHILE_RUNNING,
false
)
, STOP_FOR_STARTER_RNG(
"<b>Stop for Starter RNG:</b><br>Off by default. At the end of 00.04, save south of the table facing Squirtle's ball "
"and stop, where the Starter RNG program starts. After Starter RNG, save right after the rival's battle without moving "
"and start AutoStory at 00.05.<br>"
"With this off, 00.04 and 00.04b run as one checkpoint, as before.",
LockMode::LOCK_WHILE_RUNNING,
false
)
, NOTIFICATIONS({
&NOTIFICATION_PROGRAM_FINISH,
&NOTIFICATION_ERROR_FATAL,
Expand All @@ -86,6 +94,7 @@
PA_ADD_OPTION(NEW_GAME_FROM_TITLE);
PA_ADD_OPTION(PLAYER_NAME);
PA_ADD_OPTION(STOP_FOR_SID_HELPER);
PA_ADD_OPTION(STOP_FOR_STARTER_RNG);
PA_ADD_OPTION(NOTIFICATIONS);
}

Expand Down Expand Up @@ -271,7 +280,7 @@
send_program_finished_notification(env, notification, message);
}

void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){

Check warning on line 283 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::AutoStory::program( SingleSwitchProgramEnvironment & env , ProControllerContext & context): function_lines=49 (advisory above 25, limit 50)
if (const std::optional<Pokemon::VerifyPolicy> verify = RUN.VERIFY.policy()){
verify_story_checkpoint(env, context, RUN, *verify, NOTIFICATION_PROGRAM_FINISH);
return;
Expand All @@ -281,7 +290,9 @@
const size_t last = RUN.end_index();
const std::string player_name = PLAYER_NAME;
check_setup(env.console, checkpoints, first, last, NEW_GAME_FROM_TITLE, player_name);
const StoryRunPlan plan = plan_story_run(checkpoints, first, last, StoryHandoffs{.sid_helper = STOP_FOR_SID_HELPER});
const StoryRunPlan plan = plan_story_run(
checkpoints, first, last, StoryHandoffs{.sid_helper = STOP_FOR_SID_HELPER, .starter_rng = STOP_FOR_STARTER_RNG}
);
if (plan.stop == StoryHandoff::SID_HELPER){
play_new_game_to_player_name(env.console, context, player_name);
stop_for_handoff(env, NOTIFICATION_PROGRAM_FINISH,
Expand All @@ -308,6 +319,13 @@
Pokemon::record_story_stats(env.current_stats<Pokemon::AutoStoryStats>(), report);
env.update_stats();
throw_if_failed(report);
if (plan.stop == StoryHandoff::STARTER_RNG){
stop_for_handoff(env, NOTIFICATION_PROGRAM_FINISH,
"Stopped for Starter RNG: saved south of the table, facing Squirtle's ball. Run Starter RNG now. "
"Then save right after the rival's battle, without moving, and start AutoStory at 00.05."
);
return;
}
env.console.log("AutoStory: done through " + plan.rows.back().id + ".");
send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class AutoStory : public SingleSwitchProgramInstance{
StringOption PLAYER_NAME;
// The RNG programs the run stops for (StoryHandoff).
BooleanCheckBoxOption STOP_FOR_SID_HELPER;
BooleanCheckBoxOption STOP_FOR_STARTER_RNG;
EventNotificationsOption NOTIFICATIONS;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* AutoStory Events

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=583 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -452,7 +452,24 @@
}


namespace{

// `first` and `second` as one checkpoint: `first`'s id, start and
// supplies, `second`'s title and START menu, both rows' steps.
StoryCheckpoint joined_rows(const StoryCheckpoint& first, const StoryCheckpoint& second){
StoryCheckpoint row = second;
row.id = first.id;
row.start = first.start;
row.supplies = first.supplies;
row.live_start = first.live_start;
row.steps = first.steps;
row.steps.insert(row.steps.end(), second.steps.begin(), second.steps.end());
return row;
}

}

StoryRunPlan plan_story_run(

Check warning on line 472 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::plan_story_run( const std :: vector<StoryCheckpoint> & checkpoints , size_t first , size_t last , const StoryHandoffs & handoffs): function_lines=28 (advisory above 25, limit 50)
const std::vector<StoryCheckpoint>& checkpoints, size_t first, size_t last, const StoryHandoffs& handoffs
){
StoryRunPlan plan;
Expand All @@ -466,6 +483,16 @@
plan.stop = StoryHandoff::SID_HELPER;
return plan;
}
if (row.handoff == StoryHandoff::STARTER_RNG && handoffs.starter_rng){
plan.rows.emplace_back(row);
plan.stop = StoryHandoff::STARTER_RNG;
return plan;
}
if (row.handoff == StoryHandoff::STARTER_RNG && c + 1 < checkpoints.size()){
plan.rows.emplace_back(joined_rows(row, checkpoints[c + 1]));
c++;
continue;
}
plan.rows.emplace_back(row);
}
return plan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ enum class StoryHandoff{
// The checkpoint's new game stops on the player's keyboard, the name
// typed and OK not pressed, which is where SID Helper starts.
SID_HELPER,
// The checkpoint saves south of the table, facing the starter's ball,
// which is where Starter RNG starts. With the handoff off, it runs on
// into the next checkpoint as one, as the story did before the split.
STARTER_RNG,
};

// A shared checkpoint with what FRLG adds to it.
Expand All @@ -89,6 +93,7 @@ struct StoryCheckpoint : public Pokemon::StoryCheckpoint{
// The handoffs a run stops for (AutoStory's options).
struct StoryHandoffs{
bool sid_helper = false;
bool starter_rng = false;
};

// What a run from table row `first` to `last` does.
Expand All @@ -97,12 +102,16 @@ struct StoryRunPlan{
std::vector<StoryCheckpoint> rows;
// NONE: the run ends after `rows`. SID_HELPER: `rows` is empty; the run
// plays the new game to the player's keyboard and stops there.
// STARTER_RNG: the run stops after `rows`, the last of which saves at
// the starter's ball.
StoryHandoff stop = StoryHandoff::NONE;
};

// The rows of `checkpoints` from `first` to `last`, both inclusive, as a
// run with `handoffs` takes them: live-start rows only when the run
// starts there, and a run that reaches a handoff that is on stops for it.
// starts there, a run that reaches a handoff that is on stops for it, and
// a STARTER_RNG row whose handoff is off is joined with the row after it,
// under its own id.
StoryRunPlan plan_story_run(
const std::vector<StoryCheckpoint>& checkpoints, size_t first, size_t last, const StoryHandoffs& handoffs
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,17 @@ StoryCheckpoint oaks_trigger(){
});
}

StoryCheckpoint starter(){
return row("00.04", "Squirtle, then the rival's battle", at(LAB, 6, 4, NORTH), {}, StartMenu::BEFORE_POKEDEX, {
// Starter RNG starts from a save south of the table, facing the ball.
StoryCheckpoint to_starter_ball(){
StoryCheckpoint checkpoint = row("00.04", "to Squirtle's ball, south of the table", at(LAB, 6, 4, NORTH), {}, StartMenu::BEFORE_POKEMON, {
route("below_squirtle", at(LAB, 9, 5, NORTH), "under Squirtle's ball (9, 4)"),
});
checkpoint.handoff = StoryHandoff::STARTER_RNG;
return checkpoint;
}

StoryCheckpoint starter(){
return row("00.04b", "Squirtle, then the rival's battle", at(LAB, 9, 5, NORTH), {}, StartMenu::BEFORE_POKEDEX, {
talk("squirtle_ball", "\"So, you want the WATER POKEMON SQUIRTLE?\""),
answer("choose_squirtle", true, "take Squirtle"),
answer("no_nickname", false, "\"give a nickname?\" NO"),
Expand Down Expand Up @@ -309,7 +317,7 @@ StoryCheckpoint running_shoes(){

const std::vector<StoryCheckpoint>& story_checkpoints(){
static const std::vector<StoryCheckpoint> checkpoints{
new_game(), after_sid_helper(), leave_house(), oaks_trigger(), starter(), parcel(), pokedex(), shopping(), forest(), brock(),
new_game(), after_sid_helper(), leave_house(), oaks_trigger(), to_starter_ball(), starter(), parcel(), pokedex(), shopping(), forest(), brock(),
running_shoes(),
};
return checkpoints;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ namespace PokemonFRLG{


// Checkpoints 00.01 to 00.10, in order, with 00.01b, the way back in after
// SID Helper, after 00.01.
// SID Helper, after 00.01, and 00.04 split in two at Squirtle's ball for
// Starter RNG: 00.04 and 00.04b.
const std::vector<StoryCheckpoint>& story_checkpoints();


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* AutoStory Tests

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=760 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -212,8 +212,8 @@

UnitTestResult test_routes_and_chain(){
const std::vector<StoryCheckpoint>& checkpoints = story_checkpoints();
if (checkpoints.size() != 11 || checkpoints[0].start){
return "Expected 11 checkpoints, the first from a new game.";
if (checkpoints.size() != 12 || checkpoints[0].start){
return "Expected 12 checkpoints, the first from a new game.";
}
StoryPose pose;
for (size_t c = 0; c < checkpoints.size(); c++){
Expand Down Expand Up @@ -553,6 +553,8 @@
return "none";
case StoryHandoff::SID_HELPER:
return "SID Helper";
case StoryHandoff::STARTER_RNG:
return "Starter RNG";
}
return "?";
}
Expand Down Expand Up @@ -593,7 +595,7 @@
const RunPlanScenario m_scenario;
};

void add_tests_RunPlan(UnitTestDatabase& database){

Check warning on line 598 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::add_tests_RunPlan( UnitTestDatabase & database): function_lines=43 (advisory above 25, limit 50)
const std::string TODAY = "00.01 00.02 00.03 00.04 00.05 00.06 00.07 00.08 00.09 00.10";
const RunPlanScenario scenarios[] = {
{.name = "handoffs off: the story as before", .first = "00.01", .expected_ids = TODAY},
Expand All @@ -614,12 +616,68 @@
},
{.name = "00.01b runs when started at, option off", .first = "00.01b", .last = "00.02", .expected_ids = "00.01b 00.02"},
{.name = "SID Helper: a later start passes over it", .first = "00.02", .last = "00.03", .handoffs = {.sid_helper = true}, .expected_ids = "00.02 00.03"},
{.name = "handoffs off: an end at 00.04 still takes the rival's battle", .first = "00.03", .last = "00.04", .expected_ids = "00.03 00.04"},
{
.name = "Starter RNG: stops after 00.04's save",
.first = "00.02",
.handoffs = {.starter_rng = true},
.expected_ids = "00.02 00.03 00.04",
.expected_stop = StoryHandoff::STARTER_RNG,
},
{.name = "00.04b runs from its own save", .first = "00.04b", .last = "00.05", .expected_ids = "00.04b 00.05"},
{.name = "Starter RNG: a later start doesn't stop", .first = "00.05", .last = "00.06", .handoffs = {.starter_rng = true}, .expected_ids = "00.05 00.06"},
{
.name = "both handoffs, back in after SID Helper",
.first = "00.01b",
.handoffs = {.sid_helper = true, .starter_rng = true},
.expected_ids = "00.01b 00.02 00.03 00.04",
.expected_stop = StoryHandoff::STARTER_RNG,
},
};
for (const RunPlanScenario& scenario : scenarios){
database.add<Test_RunPlan>(scenario);
}
}

std::string step_names(const StoryCheckpoint& checkpoint){
std::string text;
for (const StoryStep& step : checkpoint.steps){
text += (text.empty() ? "" : " ") + step.name;
}
return text;
}

// With Starter RNG's handoff off, 00.04 and 00.04b run as the one 00.04
// the story had before the split: from the lab's table to the rival's
// battle, saving once with the starter's START menu.
UnitTestResult test_starter_rows_joined(){

Check warning on line 653 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::test_starter_rows_joined(): function_lines=27 (advisory above 25, limit 50)
const std::vector<StoryCheckpoint>& checkpoints = story_checkpoints();
const StoryRunPlan plan = plan_story_run(checkpoints, row_index("00.04"), row_index("00.04b"), StoryHandoffs{});
const std::string expected_steps =
"below_squirtle squirtle_ball choose_squirtle no_nickname rival_takes_bulbasaur above_rival_trigger rival_trigger rival_battle";
if (plan.rows.size() != 1){
return "Expected one checkpoint, got \"" + joined_ids(plan.rows) + "\".";
}
const StoryCheckpoint& row = plan.rows[0];
if (row.id != "00.04" || row.title != "Squirtle, then the rival's battle" || step_names(row) != expected_steps){
return "Expected 00.04 \"Squirtle, then the rival's battle\": " + expected_steps
+ "; got " + row.id + " \"" + row.title + "\": " + step_names(row);
}
const std::optional<StoryPose> start = story_pose(*row.start);
if (!start || start->map != "PalletTown_ProfessorOaksLab" || !(start->tile == TilePos{6, 4}) || row.menu != StartMenu::BEFORE_POKEDEX){
return "Expected the joined 00.04 to start at the table (6, 4) and save with the starter's START menu.";
}
// Split, 00.04 saves under the ball facing it, before the starter.
const StoryCheckpoint& to_ball = checkpoints[row_index("00.04")];
const std::optional<StoryPose> ball = story_pose(*checkpoints[row_index("00.04b")].start);
if (to_ball.handoff != StoryHandoff::STARTER_RNG || to_ball.menu != StartMenu::BEFORE_POKEMON
|| !ball || !(ball->tile == TilePos{9, 5}) || ball->facing != Direction::NORTH
){
return "Expected 00.04 to end under Squirtle's ball (9, 5) facing north, saving before the starter.";
}
return true;
}

// The way back in after SID Helper loads no save and starts where 00.01
// leaves the player, so 00.02 follows it unchanged.
UnitTestResult test_after_sid_helper_row(){
Expand Down Expand Up @@ -681,6 +739,7 @@
void add_tests_AutoStory(UnitTestDatabase& database){
add_tests_RunPlan(database);
database.add<Test_AutoStory>("00.01b: back in after SID Helper", test_after_sid_helper_row);
database.add<Test_AutoStory>("00.04 and 00.04b: one checkpoint with Starter RNG off", test_starter_rows_joined);
database.add<Test_AutoStory>("every route plans, and checkpoints chain", test_routes_and_chain);
database.add<Test_AutoStory>("step names are unique per checkpoint", test_unique_names);
database.add<Test_AutoStory>("every save has a place on the save card", test_save_places);
Expand Down
Loading