Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d0dbc83
PokemonLZA: AutoStory: Main Mission 01 (01.01-01.03)
dayfine Nov 11, 2026
a048716
Merge plza/story-base into plza/story-mm1
dayfine Nov 11, 2026
7df8593
PokemonLZA: AutoStory: story battles press A until the first attack
dayfine Nov 11, 2026
b43c6bf
Merge remote-tracking branch 'origin/plza/story-base' into plza/story…
dayfine Nov 11, 2026
35a5ab0
PokemonLZA: AutoStory: 01.xx starts are places, starter walks are TIM…
dayfine Nov 11, 2026
03d796a
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 11, 2026
d7a72fe
Merge plza/story-base into plza/story-mm1
dayfine Nov 11, 2026
0afa1fe
Merge origin/plza/story-base into plza/story-mm1
dayfine Nov 12, 2026
c72c347
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 12, 2026
4c0a9d8
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 12, 2026
5b0750b
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 12, 2026
9ddb609
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 12, 2026
8303e1d
Merge remote-tracking branch 'origin/plza/story-base' into plza/story…
dayfine Nov 12, 2026
d761bad
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 12, 2026
a443a2e
Merge origin/plza/story-base into plza/story-mm1
dayfine Nov 12, 2026
dbbdbd6
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
602832e
Merge remote-tracking branch 'origin/plza/story-base' into plza/story…
dayfine Nov 13, 2026
bc9d827
PokemonLZA AutoStory: test that 01.02's chase walks the same path aft…
dayfine Nov 13, 2026
a7a80cb
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
4432c5b
PokemonLZA AutoStory: 01.02's chase turns first from the camera, not …
dayfine Nov 13, 2026
689c0d5
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
79d42f5
Merge branch 'plza/mm1-start-heading' into plza/story-mm1
dayfine Nov 13, 2026
59f2cec
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
643c23b
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
92276bb
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
ba38062
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
68aa1e6
PokemonLZA AutoStory: 01.02 reloads its save when run after 01.01
dayfine Nov 13, 2026
92a2269
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
1d121fa
PokemonLZA AutoStory: the 01.02 reload test leaves later checkpoints …
dayfine Nov 13, 2026
155b87a
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
24eb8c6
Merge remote-tracking branch 'origin/plza/story-base' into HEAD
dayfine Nov 13, 2026
e86a6cb
Merge origin/plza/story-base into plza/story-mm1: #45 review fixes
dayfine Nov 13, 2026
34e585b
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
811a8a8
PLZA AutoStory: the leg breakpoint test builds the starter's game
dayfine Nov 13, 2026
42aced1
Merge origin/plza/story-base into plza/story-mm1: #45 review fixes
dayfine Nov 13, 2026
eb6675f
Merge origin/plza/story-base into plza/story-mm1: shared checkpoint r…
dayfine Nov 13, 2026
e6139ef
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
ff583a4
Merge branch 'plza/story-base' into plza/story-mm1
dayfine Nov 13, 2026
dca5c53
Merge plza/story-base into plza/story-mm1
dayfine Nov 13, 2026
3067312
Merge origin/plza/story-base into plza/story-mm1
dayfine Nov 13, 2026
af403a1
Merge origin/plza/story-base into plza/story-mm1
dayfine Nov 13, 2026
f52ea24
Merge origin/plza/story-base into plza/story-mm1
dayfine Nov 13, 2026
0fa597a
Merge origin/plza/story-base into plza/story-mm1: shared ScreenEvent …
dayfine Nov 14, 2026
a562aea
Use the shared ScreenEvent names after merging autostory/engine
dayfine Nov 14, 2026
c9e6a39
Merge plza/story-base into plza/story-mm1
dayfine Nov 14, 2026
aa8c59b
Merge plza/story-base (#354) into plza/story-mm1
dayfine Nov 14, 2026
e68f202
Merge plza/story-base (#354) into plza/story-mm1
dayfine Nov 14, 2026
7d91dca
Merge plza/story-base into plza/story-mm1
dayfine Nov 14, 2026
9619112
Merge origin/plza/story-base into plza/story-mm1
dayfine Nov 14, 2026
8f1ba1a
Merge origin/plza/story-base into plza/story-mm1
dayfine Nov 15, 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 @@ -77,7 +77,7 @@



void fight_battle_in_progress(

Check warning on line 80 in SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryActions.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonLZA::fight_battle_in_progress( ProgramEnvironment & env , ConsoleHandle & console , ProControllerContext & context , BattleAIOption & battle_ai , std :: chrono :: seconds timeout): function_lines=33 (advisory above 25, limit 50)
ProgramEnvironment& env, ConsoleHandle& console, ProControllerContext& context,
BattleAIOption& battle_ai, std::chrono::seconds timeout
){
Expand All @@ -86,10 +86,12 @@
BlueDialogDetector blue_dialog;
TealDialogDetector teal_dialog;
const WallClock deadline = current_time() + timeout;
bool attacked = false;
while (true){
context.wait_for_all_requests();
const VideoSnapshot screen = console.video().snapshot();
if (white_dialog.detect(screen) || blue_dialog.detect(screen) || teal_dialog.detect(screen)){
const bool dialog = white_dialog.detect(screen) || blue_dialog.detect(screen) || teal_dialog.detect(screen);
if (dialog && attacked){
return;
}
if (current_time() > deadline){
Expand All @@ -99,7 +101,13 @@
console
);
}
battle_state.attempt_one_attack(env, console, context);
if (dialog || !battle_state.attempt_one_attack(env, console, context)){
if (!attacked){
pbf_press_button(context, BUTTON_A, 160ms, 400ms);
}
continue;
}
attacked = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class StoryActionNotImplemented : public OperationFailedException{
public:
explicit StoryActionNotImplemented(std::string message);

// code-health: allow char_pointer -- the exception base class's name() returns const char*
virtual const char* name() const override{
return "StoryActionNotImplemented";
}
Expand All @@ -52,9 +51,12 @@ void fight_battle(
BattleAIOption& battle_ai
);

// In a battle that is already on screen: attacks with TrainerBattleState
// until a dialog box shows (the speech after a win or a loss). For story
// battles, which show no Run prompt for fight_battle() to start on.
// A story battle, from the talk before it: attacks with TrainerBattleState
// until a dialog box shows (the speech after a win or a loss). Until the
// first attack lands, a dialog box or a failed lock-on gets A instead: the
// trainer's lines, the challenge cutscene's subtitle (no text box) and
// tutorial cards (Taunie's battle in 03.02, console B 2026-11-10). For
// story battles, which show no Run prompt for fight_battle() to start on.
// Throws OperationFailedException after `timeout`.
void fight_battle_in_progress(
ProgramEnvironment& env, ConsoleHandle& console, ProControllerContext& context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"PokemonLZA:AutoStory",
std::format("{} LZA", STRING_POKEMON), "Auto Story",
"Programs/PokemonLZA/AutoStory.html",
"Play the main story of Pokemon Legends: Z-A. Prototype: plays a new game to the station platform, as recorded on a console. "
"Play the main story of Pokemon Legends: Z-A. Prototype: Main Mission 01 as recorded on a console; plays from a new game to the starter and Andi. "
"Start a new game and pick its language, look and name by hand: checkpoint 01.00 starts on the Confirm Choices screen that follows. "
"It checks that screen, presses nothing anywhere else, and picks Ready!. Later checkpoints load their save first. "
"Set Game Language to the language the game is set to: the program reads place names in it.",
Expand Down Expand Up @@ -73,7 +73,7 @@
} // namespace


AutoStory::AutoStory()

Check warning on line 76 in SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStory.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonLZA::AutoStory::AutoStory(): function_lines=41 (advisory above 25, limit 50)
: LANGUAGE(
"<b>Game Language:</b><br>The language the game is set to. The program reads text in it "
"(the place names in the fast travel menu) and does not check that the game matches.",
Expand All @@ -82,6 +82,16 @@
true
)
, RUN(checkpoint_database(), Gen8ToGen9Languages_Database())
, STARTER(
"<b>Starter Pokemon:</b>",
{
{StarterChoice::CHIKORITA, "chikorita", "Chikorita"},
{StarterChoice::TEPIG, "tepig", "Tepig"},
{StarterChoice::TOTODILE, "totodile", "Totodile"},
},
LockMode::LOCK_WHILE_RUNNING,
StarterChoice::CHIKORITA
)
, RELOAD_AT_BOUNDARIES(
"<b>Reload at Checkpoint Boundaries:</b><br>Reload the save before a checkpoint whose plan asks for it "
"when the run comes from the checkpoint before. Off: run straight on. A failed checkpoint's retry reloads either way.",
Expand All @@ -98,6 +108,7 @@
PA_ADD_OPTION(LANGUAGE);
RUN.LANGUAGE.set_visibility(ConfigOptionState::HIDDEN);
PA_ADD_OPTION(RUN);
PA_ADD_OPTION(STARTER);
PA_ADD_OPTION(BATTLE_AI);
PA_ADD_OPTION(RELOAD_AT_BOUNDARIES);
PA_ADD_OPTION(GO_HOME_WHEN_DONE);
Expand Down Expand Up @@ -153,11 +164,13 @@
require_player(console, context, BUTTON_L);
}

// PLZA's game for a run on `story`, pausing at `breakpoints` (the
// PLZA's game for a run on `story` with `starter`, pausing at `breakpoints` (the
// BREAKPOINTS option): before each step, or each leg too, where a lab build
// waits for the user (Pokemon_StoryBreakpoints.h).
StoryGame<ZonePose> run_game(StoryEnv& story, const StoryData& data, StoryBreakpoints breakpoints, CancellableScope& scope){
StoryGame<ZonePose> game = make_plza_story_game(story, data.autosaves);
StoryGame<ZonePose> run_game(
StoryEnv& story, StarterChoice starter, const StoryData& data, StoryBreakpoints breakpoints, CancellableScope& scope
){
StoryGame<ZonePose> game = make_plza_story_game(story, starter, data.autosaves);
game.breakpoints = breakpoints;
game.pause_point = make_story_pause_hook(scope);
return game;
Expand Down Expand Up @@ -190,7 +203,7 @@
.env = env, .context = context, .language = LANGUAGE, .battle_ai = BATTLE_AI
};
PlzaConsoleBackend backend(story);
const StoryGame<ZonePose> game = run_game(story, story_data, RUN.breakpoints(), context);
const StoryGame<ZonePose> game = run_game(story, STARTER, story_data, RUN.breakpoints(), context);
StoryEngine<ZonePose> engine(game, backend);
RunState state;
load_start_save(env.console, game, backend, rows, first);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class AutoStory : public SingleSwitchProgramInstance{
// The start and end checkpoints, attempts and checks. Its own language
// dropdown is hidden: LANGUAGE above is PLZA's.
Pokemon::StoryRunOptions RUN;
EnumDropdownOption<StarterChoice> STARTER;
BattleAIOption BATTLE_AI;
// Off: a run of several checkpoints runs straight on at the rows whose
// plans say "reload_when_chained"; on: it reloads the save there.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* PokemonLZA AutoStory - Story backend

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryBackend.h

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<header>: header_symbols=7 (advisory above 6, limit 8)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -41,6 +41,14 @@
namespace PokemonLZA{


// The starters Mission 1 offers. The player picks one by walking up to it
// and talking to it.
enum class StarterChoice{
CHIKORITA,
TEPIG,
TOTODILE,
};

// The console a run plays on, for the actions only a console can do
// (menus, OCR, the battle AI).
struct StoryEnv{
Expand Down
Loading
Loading