diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/PokemonLZA_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/PokemonLZA_Tests.cpp index cd8ac5598c..b37e7b4c03 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/PokemonLZA_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/PokemonLZA_Tests.cpp @@ -25,6 +25,7 @@ #include "Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDialogDetector_Tests.h" #include "Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.h" #include "Programs/AutoStory/PokemonLZA_AutoStorySceneMachine_Tests.h" +#include "Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -53,6 +54,7 @@ void add_tests(UnitTestDatabase& database){ add_tests_AutoStoryDialogDetector(database); add_tests_AutoStoryGame(database); add_tests_AutoStorySceneMachine(database); + add_tests_AutoStoryScreenEvents(database); } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.cpp index e1ee30252d..2a10ed02c8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.cpp @@ -43,6 +43,22 @@ void play_checked(PlzaBackend& backend, std::string_view what, Input&& input){ } } +// StoryWalkStyle::HELD: each leg's stick held at its angle for its time +// (a turn-only leg a 150 ms tap); L before each later leg that turns. +void run_held_legs(PlzaBackend& backend, const std::vector& legs){ + for (size_t index = 0; index < legs.size(); index++){ + const StoryWalkLeg& leg = legs[index]; + if (index > 0 && leg.turn != 0){ + backend.press(BUTTON_L, /*hold=*/100ms, /*release=*/150ms); + } + if (leg.walk > 0ms){ + backend.stick(leg.turn, leg.walk, /*release=*/0ms, Pokemon::StoryPace::WALK); + }else if (leg.turn != 0){ + backend.stick(leg.turn, /*duration=*/150ms, /*release=*/100ms, Pokemon::StoryPace::WALK); + } + } +} + // "leg 2/5 turn 90 walk 1200 ms": leg `index` (from 0) of `count`, for the // log. A leg with no walk leaves it out. std::string story_walk_leg_label(size_t index, size_t count, const StoryWalkLeg& leg){ @@ -57,6 +73,10 @@ std::string story_walk_leg_label(size_t index, size_t count, const StoryWalkLeg& Pokemon::Outcome run_story_move(PlzaBackend& backend, const StoryMove& move){ + if (move.style == StoryWalkStyle::HELD){ + run_held_legs(backend, move.legs); + return Pokemon::outcome_ok(); + } // The look the first input is checked against. backend.observe(); for (size_t index = 0; index < move.legs.size(); index++){ diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.h index 3c0f364a5e..434c83f5c4 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMoves.h @@ -33,17 +33,33 @@ struct StoryWalkLeg{ Milliseconds walk = Milliseconds(0); }; +// How a walk's legs are played. +enum class StoryWalkStyle{ + // Each turn is L, a 150 ms tap that way, L, then the stick held + // forward (the 2026-11-08 recording). + TURN_THEN_WALK, + // The stick is held at the leg's angle for its whole time, from the + // camera as it is; L recenters the camera only before a later leg that + // turns (02.01, console B 2026-11-10). L near an NPC turns to it, so a + // held walk starts without one. + HELD, +}; + // A walk in the overworld. Lumiose has no tiles: a move is legs of turns // and timed walks, as recorded on the console. struct StoryMove{ std::vector legs = {}; + StoryWalkStyle style = StoryWalkStyle::TURN_THEN_WALK; + // A wait before the walk looks for free control, for the NPCs to move + // off (02.01). The walk's caller waits it; run_story_move() does not. + Milliseconds wait_first = Milliseconds(0); }; -// From the overworld, walks as `move` says: each leg's turn (and L to -// recenter the camera, since the walk goes where it looks) and walk. A -// look after each turn and each walk; one that shows the screen still -// (the game dropped the input) plays that turn or walk once more, then -// goes on. A leg cut short or blocked part way goes unnoticed, and a step +// From the overworld, walks as `move` says. TURN_THEN_WALK: each leg's +// turn (and L to recenter the camera, since the walk goes where it looks) +// and walk, with a look after each turn and each walk; one that shows the +// screen still (the game dropped the input) plays that turn or walk once +// more, then goes on. HELD: each leg's stick held, unchecked. A leg cut short or blocked part way goes unnoticed, and a step // that needs a prompt after the walk fails there instead. Pokemon::Outcome run_story_move(PlzaBackend& backend, const StoryMove& move); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp index 6aff73294f..01e2f2ef27 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp @@ -27,6 +27,39 @@ constexpr Milliseconds HOLD_SLICE = 250ms; constexpr Milliseconds FREE_CONTROL_WAIT = 15000ms; constexpr Milliseconds FREE_CONTROL_LOOK = 250ms; +// One slice of walk_to_prompt()'s walk between looks. +constexpr Milliseconds PROMPT_WALK_SLICE = 250ms; + +// After A at a prompt: how long a fade or text may take to show (a late +// fade starts 1.8 s after the A), how often it is looked for, and how many +// times A is pressed while the prompt stays with neither (a dropped A). +constexpr Milliseconds PROMPT_TAKEN_WAIT = 3000ms; +constexpr Milliseconds PROMPT_POLL = 250ms; +constexpr size_t PROMPT_PRESSES = 3; + +// Whether `look` shows that A at a prompt was taken: a fade, or text. +bool prompt_taken(const ScreenObservation& look){ + return look.events.has(ScreenEvent::FADE_BLACK) || look.events.has(ScreenEvent::FADE_WHITE) || + look.events.has(ScreenEvent::DIALOG_BOX) || look.events.has(ScreenEvent::CHOICE_BOX); +} + +// A at a prompt, then looks until a fade or text shows; returns whether +// the prompt still shows on the last look without either. +bool press_at_prompt(PlzaBackend& backend){ + backend.press(BUTTON_A, /*hold=*/160ms, /*release=*/400ms); + bool prompt = true; + for (Milliseconds waited = 0ms; waited < PROMPT_TAKEN_WAIT; waited += PROMPT_POLL){ + backend.scope().throw_if_cancelled(); + const Pokemon::Observation look = backend.observe(); + if (prompt_taken(look)){ + return false; + } + prompt = look.events.has(ScreenEvent::INTERACT_PROMPT); + backend.wait(PROMPT_POLL); + } + return prompt; +} + // What no walk may start on, by name; empty when free. std::string_view not_free_control(const ScreenObservation& look){ if (look.readings.contains(ADVANCE_ARROW_READING)){ @@ -97,6 +130,30 @@ Pokemon::Outcome walk_until(PlzaBackend& backend, std::string_view walk, const S return Pokemon::outcome_failed("walk_no_end", std::format("{}: no end event within {} ms of the last leg", walk, hold.count())); } +Pokemon::Outcome walk_to_prompt(PlzaBackend& backend, Milliseconds timeout){ + for (Milliseconds walked = 0ms; ; walked += PROMPT_WALK_SLICE){ + backend.scope().throw_if_cancelled(); + if (backend.observe().events.has(ScreenEvent::INTERACT_PROMPT)){ + backend.log(std::format("[PLZA] walk_to_prompt: the A prompt shows after {} ms of walking", walked.count())); + return Pokemon::outcome_ok(); + } + if (walked >= timeout){ + break; + } + backend.hold(Pokemon::Direction::NORTH, PROMPT_WALK_SLICE, Pokemon::StoryPace::WALK); + } + return Pokemon::outcome_failed("no_prompt", std::format("walk_to_prompt: no A prompt in {} ms of walking", timeout.count())); +} + +void press_through_prompt(PlzaBackend& backend){ + for (size_t press = 1; press <= PROMPT_PRESSES; press++){ + if (!press_at_prompt(backend)){ + return; + } + backend.log(std::format("[PLZA] press_through_prompt: the prompt is still up {} ms after A {}", PROMPT_TAKEN_WAIT.count(), press)); + } +} + } // namespace PokemonLZA diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.h index 7868e7f4ec..02261471cb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.h @@ -42,6 +42,20 @@ void finish_walk(PlzaBackend& backend, std::string_view walk); // within it. Pokemon::Outcome walk_until(PlzaBackend& backend, std::string_view walk, const StoryMove& move, ScreenEvent end); +// Walks straight on, 250 ms at a time, until an A prompt shows +// (INTERACT_PROMPT: "A Leave" at the Battle Zone's gate); nothing if it +// shows already. Fails as "no_prompt" after `timeout` of walking without +// one. +Pokemon::Outcome walk_to_prompt(PlzaBackend& backend, Milliseconds timeout); + +// A at the A prompt the player stands at (a door's "A Enter"), then looks +// for up to 3 s for a fade or text; while the prompt stays with neither, +// A again, 3 times at most. The party bar shows under the prompt, so a +// scene machine run right after would take it for control before a late +// fade. A prompt gone with no fade or text, or still up after the last A, +// is left to what runs next. +void press_through_prompt(PlzaBackend& backend); + } // namespace PokemonLZA diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp index b1b96c09de..589447dedd 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp @@ -51,6 +51,11 @@ StoryArgSpec optional_ms(std::string key, int64_t fallback, std::string why){ return StoryArgSpec{.key = std::move(key), .type = StoryArgType::INTEGER, .required = false, .fallback = fallback, .why = std::move(why)}; } +// A flag that is off when left out. +StoryArgSpec flag(std::string key, std::string why){ + return StoryArgSpec{.key = std::move(key), .type = StoryArgType::BOOLEAN, .required = false, .fallback = false, .why = std::move(why)}; +} + std::vector make_specs(){ StoryActionSpec confirm = game_spec("confirm_new_game"); confirm.console_only = true; @@ -71,14 +76,28 @@ std::vector make_specs(){ .key = "end", .type = StoryArgType::WORD, .required = false, .fallback = std::nullopt, .why = "\"fade_white\", \"fade_black\" or \"dialog\": the last leg is held until it shows, its ms the bound", }, + flag("held", "hold the stick at each leg's angle (L only before a later turning leg), not tap-and-forward"), + StoryArgSpec{ + .key = "wait_ms", .type = StoryArgType::INTEGER, .required = false, .fallback = std::nullopt, + .why = "wait this long before looking for free control: NPCs moving off", + }, + }), + game_spec("walk_to_prompt", { + optional_ms("timeout_ms", 10000, "walking this long with no A prompt fails the step"), }), game_spec("mash_to_move_hints", { optional_ms("min_length_ms", 0, "the scene's rough length: no quiet failure before it"), + optional_ms("quiet_ms", 60000, "nothing busy and no control this long fails the step"), + flag("press_a_first", "press A first, at the prompt that starts the scene (a door's \"A Enter\")"), + flag("quiet_is_control", "the quiet time ends the step with control, where no party bar or prompt shows (Hotel Z)"), + }), + game_spec("text_to_choice", { + flag("advance_with_a", "advance the text with A, for a talk that B cancels (Hotel Z's elevator)"), }), - game_spec("text_to_choice"), game_spec("choose_0"), game_spec("choose_1"), StoryActionSpec{.kind = StoryStepKind::TALK, .name = "talk", .args = {}}, + StoryActionSpec{.kind = StoryStepKind::MASH, .name = "a", .args = {}}, game_spec("story_battle_start"), game_spec("story_battle"), }; @@ -203,10 +222,18 @@ Handler platform_handler(PlatformWait wait){ // The walk of `args`: the legs of its arg "legs", each [turn in degrees -// clockwise (negative: left), walk ms]. The args must have passed the -// walk's spec. +// clockwise (negative: left), walk ms], held with "held", after the wait +// "wait_ms". The args must have passed the walk's spec. StoryMove story_walk_move(const StoryActionArgs& args){ StoryMove move; + const auto held = args.find("held"); + if (held != args.end() && std::get(held->second)){ + move.style = StoryWalkStyle::HELD; + } + const auto wait = args.find("wait_ms"); + if (wait != args.end()){ + move.wait_first = Milliseconds(std::get(wait->second)); + } for (const Pokemon::StoryTimedLeg& row : Pokemon::story_arg>(args, "legs")){ move.legs.push_back({.turn = (double)row.turn, .walk = row.walk}); } @@ -218,11 +245,14 @@ StoryMove story_walk_move(const StoryActionArgs& args){ // (finish_walk()). Outcome walk_step(Pokemon::StoryBackend& backend, const StoryActionCall& call, Pokemon::RunState&){ const std::string_view name = call.step.name; + const StoryMove move = story_walk_move(call.args); + if (move.wait_first > Milliseconds(0)){ + backend.wait(move.wait_first); + } const Outcome free = check_can_walk(backend, name); if (!free.succeeded()){ return free; } - const StoryMove move = story_walk_move(call.args); const auto end = call.args.find("end"); if (end != call.args.end()){ const std::optional event = walk_end_event(std::get(end->second)); @@ -247,10 +277,18 @@ Outcome walk_step(Pokemon::StoryBackend& backend, const StoryActionCal // control: a minute with nothing busy fails the step. After 5 s with // nothing busy and no sign of control, A every 2 s, for text the detectors // miss (01.01's ad). -// "min_length_ms" holds the quiet failure off for a long still scene. +// "min_length_ms" holds the quiet failure off for a long still scene; +// "quiet_ms" is the quiet time, which with "quiet_is_control" ends the +// step with control (Hotel Z shows no party bar). "press_a_first" presses +// A at the prompt the scene starts from (press_through_prompt()), which +// would otherwise read as control at once. Outcome move_hints_step(Pokemon::StoryBackend& backend, const StoryActionCall& call, Pokemon::RunState&){ + if (Pokemon::story_arg(call.args, "press_a_first")){ + press_through_prompt(backend); + } SceneMachineConfig config; - config.quiet = 60s; + config.quiet = Milliseconds(Pokemon::story_arg(call.args, "quiet_ms")); + config.quiet_is_control = Pokemon::story_arg(call.args, "quiet_is_control"); config.min_length = Milliseconds(Pokemon::story_arg(call.args, "min_length_ms")); config.blind_press_after = 5s; return run_scene_machine(backend, "mash_to_move_hints", config, 360s); @@ -259,14 +297,32 @@ Outcome move_hints_step(Pokemon::StoryBackend& backend, const StoryAct // "text_to_choice": B through the scene's text until its choice box // shows, which the next step answers (B: an A as the text ends could land // on the choice). 01.02's Pancham scene takes ~60 s, hence 120 s. -Outcome text_to_choice_step(Pokemon::StoryBackend& backend, const StoryActionCall&, Pokemon::RunState&){ +// "advance_with_a" is for a talk that B closes: Hotel Z's elevator before +// "Which floor?" (02.05, console B 2026-11-10). +Outcome text_to_choice_step(Pokemon::StoryBackend& backend, const StoryActionCall& call, Pokemon::RunState&){ SceneMachineConfig config; config.stop_at_choice = true; - config.text_button = BUTTON_B; + config.text_button = Pokemon::story_arg(call.args, "advance_with_a") ? BUTTON_A : BUTTON_B; return run_scene_machine(backend, "text_to_choice", config, 120s); } +// A step's scene ("scene" "a"): A through its text until the party bar +// holds a second, 120 s at most. Fails as "scene_never_started" when +// neither text, a choice, a battle nor control shows within 45 s: the +// player is not at the scene's trigger. +Outcome scene_step(Pokemon::StoryBackend& backend, const StoryActionCall&, Pokemon::RunState&){ + SceneMachineConfig config; + config.start_window = 45s; + return run_scene_machine(backend, "scene", config, 120s); +} + +// "walk_to_prompt": straight on until an A prompt shows (walk_to_prompt()). +Outcome walk_to_prompt_step(Pokemon::StoryBackend& backend, const StoryActionCall& call, Pokemon::RunState&){ + return walk_to_prompt(backend, Milliseconds(Pokemon::story_arg(call.args, "timeout_ms"))); +} + + // "story_battle_start": A through the talk before a story battle (a // choice takes its top row) and, every 2 s where no text shows, through // the battle tutorial's cards and the VS splash, until the battle HUD @@ -396,6 +452,12 @@ Handler plza_handler(StoryEnv* env, const StoryActionSpec& spec){ if (spec.name == "talk"){ return talk_step; } + if (spec.name == "a"){ + return scene_step; + } + if (spec.name == "walk_to_prompt"){ + return walk_to_prompt_step; + } if (spec.name == "story_battle_start"){ return battle_start_step; } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h index 5f73a9debb..fb92ba2b6a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h @@ -42,21 +42,28 @@ namespace PokemonLZA{ // has shown and the station platform holds // "wait_for_platform" the station platform holds: a start check // "walk" args "legs", [[turn, ms], ...] as -// story_walk_move() reads them, and "end", +// story_walk_move() reads them, "held", +// "wait_ms", and "end", // "fade_white", "fade_black" or "dialog"; // walked once the screen shows free control // (check_can_walk()), until its end event if it // has one (walk_until()), else until its legs // have run (finish_walk()) // "mash_to_move_hints" A through scenes until the player has control -// (run_scene_machine()): 01.01's arrival; arg -// "min_length_ms", no quiet failure before it +// (run_scene_machine()): 01.01's arrival; args +// "min_length_ms", no quiet failure before it, +// "quiet_ms", "quiet_is_control" and +// "press_a_first" (press_through_prompt()) +// "walk_to_prompt" straight on until an A prompt shows // "text_to_choice" B through a scene's text until its choice box -// shows (run_scene_machine()) +// shows (run_scene_machine()); A with +// "advance_with_a" // "choose_0", "choose_1" that row of the choice box on screen (0 the // top), by the D-pad from the highlighted row, // then A // "talk" (TALK) A at what the player faces, then its text box +// "a" (MASH, "scene") A through a scene until control; it must +// start within 45 s // "story_battle_start" A through the talk before a story battle and // the battle tutorial's cards until the battle // HUD (run_scene_machine()) diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp index 658aaeadb3..b4d4ac6215 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp @@ -64,7 +64,11 @@ const StoryDataCase STORY_DATA_CASES[] = { { .name = "the built-in story loads and passes the lint", .input = {}, - .expectation = {.rows = "01.00:new_game:autosave 01.01:from_save:unverified 01.02:from_save:unverified 01.03:from_save:unverified"}, + .expectation = {.rows = + "01.00:new_game:autosave 01.01:from_save:unverified 01.02:from_save:unverified 01.03:from_save:unverified " + "02.01:from_save:unverified 02.02:from_save:unverified 02.03:from_save:unverified 02.04:from_save:unverified " + "02.05:from_save:unverified 02.06:from_save:autosave 02.07:from_save:unverified" + }, }, }; @@ -164,6 +168,12 @@ const Observation WHITE_FADE = look({ScreenEvent::FADE_WHITE}); const Observation BLACK_FADE = look({ScreenEvent::FADE_BLACK}); const Observation DIALOG = look({ScreenEvent::DIALOG_BOX}); const Observation BATTLE_HUD = look({ScreenEvent::BATTLE_STARTED}); +const Observation A_PROMPT = look({ScreenEvent::INTERACT_PROMPT, ScreenEvent::PLAYER_CAN_MOVE}); + +// The party bar (free control), `at` after the scripts' common start. +Observation party_bar(Milliseconds at){ + return look({ScreenEvent::PLAYER_CAN_MOVE}, /*readings=*/{}, at); +} // A choice box of `rows` rows, row `selected` highlighted. Observation choice(int selected, int rows = 2){ @@ -430,6 +440,76 @@ const RunCase RUN_CASES[] = { .line = "[Save] 01.03: not saved (save unverified)", }, }, + { + .name = "02.01 waits 3 s for the NPCs, then holds its legs", + .input = {.checkpoint = "02.01", .first_step = 0, .steps = 1, .looks = {CUTSCENE}}, + .expectation = { + .verdict = "done", + .inputs = "wait 3000ms, wait 250ms, stick 10deg 4250ms walk, press L, stick 90deg 6000ms walk, press L, stick 90deg 6500ms walk", + }, + }, + { + .name = "02.01's scene after Brigitte: A at the text, done on the party bar held a second, not saved", + .input = {.checkpoint = "02.01", .first_step = 3, .looks = { + look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(0)), party_bar(Milliseconds(500)), party_bar(Milliseconds(1600)), + }}, + .expectation = {.verdict = "done", .inputs = "press A, wait 250ms", .line = "[Save] 02.01: not saved (save unverified)"}, + }, + { + // console B, 2026-11-13: 02.02 after the Brigitte battle walked + // past the street scene's trigger and A-mashed for two minutes. + .name = "02.02's street scene fails when it never starts", + .input = {.checkpoint = "02.02", .first_step = 1, .steps = 1, .looks = { + look(/*events=*/{}, /*readings=*/{}, Milliseconds(0)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(46000)), + }}, + .expectation = {.verdict = "failed at street_scene: scene_never_started", .inputs = "wait 500ms"}, + }, + { + .name = "02.02 walks on to the gate's A prompt", + .input = {.checkpoint = "02.02", .first_step = 2, .steps = 1, .looks = {CUTSCENE, CUTSCENE, A_PROMPT}}, + .expectation = { + .verdict = "done", + .inputs = "hold north 250ms walk, hold north 250ms walk", + .line = "[PLZA] walk_to_prompt: the A prompt shows after 500 ms of walking", + }, + }, + { + .name = "02.02's walk to the gate fails with no A prompt", + .input = {.checkpoint = "02.02", .first_step = 2, .steps = 1, .looks = {CUTSCENE}}, + .expectation = {.verdict = "failed at to_battle_zone_gate: no_prompt"}, + }, + { + .name = "02.03's lobby: A at the door's prompt until the fade, then the scene to the party bar", + .input = {.checkpoint = "02.03", .first_step = 1, .looks = { + A_PROMPT, BLACK_FADE, + look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(1000)), party_bar(Milliseconds(1500)), party_bar(Milliseconds(2600)), + }}, + .expectation = {.verdict = "done", .inputs = "press A, wait 250ms, press A, wait 250ms"}, + }, + { + .name = "02.05's elevator: A through its line to the floor choice", + .input = {.checkpoint = "02.05", .first_step = 2, .steps = 1, .looks = {DIALOG, choice(0, 3)}}, + .expectation = {.verdict = "done", .inputs = "press A"}, + }, + { + .name = "02.05's ride to 2F: the hall's quiet is control", + .input = {.checkpoint = "02.05", .first_step = 4, .steps = 1, .looks = { + look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(0)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(1000)), + look({ScreenEvent::SCREEN_STILL}, /*readings=*/{}, Milliseconds(6000)), + }}, + .expectation = { + .verdict = "done", + .inputs = "press A, wait 500ms", + .line = "[PLZA mash_to_move_hints] done: quiet, taken as control.", + }, + }, + { + .name = "02.06 ends on the game's autosave", + .input = {.checkpoint = "02.06", .first_step = 4, .looks = { + look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(0)), look({ScreenEvent::SCREEN_STILL}, /*readings=*/{}, Milliseconds(21000)), + }}, + .expectation = {.verdict = "done", .line = "[Save] 02.06: the game autosaved at its end"}, + }, }; UnitTestResult check_run(const RunCase& test, CancellableScope& scope){ diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp index 071d163dec..b1c79c2536 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp @@ -35,9 +35,12 @@ enum class SceneScreen{ MISSION_COMPLETE, // A: a main mission's "COMPLETE" card MISSION_BANNER, // terminal: a main mission's banner, on a second look BANNER_SHOWING, // wait: the banner, on its first look + CAN_MOVE, // terminal: the party bar, held a second + PARTY_BAR, // wait: the party bar, not held a second yet CONTROLS_HINT, // terminal: the tutorial's controls hint, held a second HINT_SHOWING, // wait: the controls hint, not held a second yet - QUIET_END, // terminal, failing: nothing busy for the quiet time, past the minimum length + NEVER_STARTED, // terminal, failing: no scene within start_window + QUIET_END, // terminal, failing unless quiet_is_control: nothing busy for the quiet time, past the minimum length BLIND_PRESS, // A: nothing busy and no sign of control for blind_press_after SCENE_MOVING, // wait: no text, the screen changing SCENE_STILL, // wait: no text, the screen still since the look before @@ -69,10 +72,15 @@ class SceneTimeline{ SceneMachineConfig m_config; WallClock m_quiet_from; WallClock m_last_busy; - // The last look busy or with a sign of control (hint, banner). + WallClock m_start; + // The last look busy or with a sign of control (party bar, hint, + // banner). WallClock m_last_cue; std::optional m_last_blind_press; + std::optional m_party_bar_since; std::optional m_hint_since; + // Text, a choice or a battle has shown: the scene has started. + bool m_scene_seen = false; // The looks in a row with the mission banner. size_t m_banner_looks = 0; }; @@ -80,6 +88,9 @@ class SceneTimeline{ // The controls hint showing this long is free control: two looks or more. constexpr Milliseconds CONTROLS_HINT_HOLD = 1000ms; +// The party bar showing this long is free control: it also shows between +// the lines of a scene. +constexpr Milliseconds PARTY_BAR_HOLD = 1000ms; // The longest a fade is waited out in one step. constexpr Milliseconds FADE_WAIT = 30000ms; // The longest a still screen is waited on in one step. @@ -113,13 +124,25 @@ bool busy(const ScreenObservation& look){ return text_shows(look) || fade_shows(look) || look.readings.contains(MISSION_COMPLETE_READING); } +// A scene has started: text, a choice or a battle. +bool scene_shows(const ScreenObservation& look){ + return text_shows(look) || look.events.has(ScreenEvent::CHOICE_BOX) || look.events.has(ScreenEvent::BATTLE_STARTED); +} + +// Whether the party bar is control for `config`: not in a machine that +// stops at a choice or a battle, whose talk shows it between its lines. +bool party_bar_is_control(const SceneMachineConfig& config){ + return !config.stop_at_choice && !config.stop_at_battle; +} + constexpr SceneScreen ALL_SCREENS[] = { SceneScreen::BATTLE, SceneScreen::FADE_BLACK, SceneScreen::FADE_WHITE, SceneScreen::CHOICE, SceneScreen::DIALOG, SceneScreen::MISSION_COMPLETE, SceneScreen::MISSION_BANNER, SceneScreen::BANNER_SHOWING, + SceneScreen::CAN_MOVE, SceneScreen::PARTY_BAR, SceneScreen::CONTROLS_HINT, SceneScreen::HINT_SHOWING, - SceneScreen::QUIET_END, SceneScreen::BLIND_PRESS, + SceneScreen::NEVER_STARTED, SceneScreen::QUIET_END, SceneScreen::BLIND_PRESS, SceneScreen::SCENE_MOVING, SceneScreen::SCENE_STILL, }; @@ -152,10 +175,16 @@ std::string_view scene_screen_name(SceneScreen screen){ return "mission_banner"; case SceneScreen::BANNER_SHOWING: return "banner_showing"; + case SceneScreen::CAN_MOVE: + return "can_move"; + case SceneScreen::PARTY_BAR: + return "party_bar"; case SceneScreen::CONTROLS_HINT: return "controls_hint"; case SceneScreen::HINT_SHOWING: return "hint_showing"; + case SceneScreen::NEVER_STARTED: + return "never_started"; case SceneScreen::QUIET_END: return "quiet_end"; case SceneScreen::BLIND_PRESS: @@ -171,7 +200,8 @@ std::string_view scene_screen_name(SceneScreen screen){ // Whether the machine ends after this state's step. bool scene_screen_terminal(SceneScreen screen){ return screen == SceneScreen::BATTLE || screen == SceneScreen::CHOICE || screen == SceneScreen::MISSION_BANNER || - screen == SceneScreen::CONTROLS_HINT || screen == SceneScreen::QUIET_END; + screen == SceneScreen::CAN_MOVE || screen == SceneScreen::CONTROLS_HINT || + screen == SceneScreen::NEVER_STARTED || screen == SceneScreen::QUIET_END; } // Whether this state's step presses (DIALOG the config's text button, @@ -185,6 +215,7 @@ SceneTimeline::SceneTimeline(SceneMachineConfig config, WallClock start) : m_config(std::move(config)) , m_quiet_from(start + m_config.min_length) , m_last_busy(start) + , m_start(start) , m_last_cue(start) {} @@ -228,12 +259,21 @@ SceneScreen SceneTimeline::classify_open(const ScreenObservation& look) const{ if (look.readings.contains(MISSION_BANNER_READING)){ return m_banner_looks >= 1 ? SceneScreen::MISSION_BANNER : SceneScreen::BANNER_SHOWING; } + if (party_bar_is_control(m_config) && look.events.has(ScreenEvent::PLAYER_CAN_MOVE)){ + if (m_party_bar_since && look.when - *m_party_bar_since >= PARTY_BAR_HOLD){ + return SceneScreen::CAN_MOVE; + } + return SceneScreen::PARTY_BAR; + } if (look.readings.contains(CONTROLS_HINT_READING)){ if (m_hint_since && look.when - *m_hint_since >= CONTROLS_HINT_HOLD){ return SceneScreen::CONTROLS_HINT; } return SceneScreen::HINT_SHOWING; } + if (m_config.start_window && !m_scene_seen && look.when - m_start >= *m_config.start_window){ + return SceneScreen::NEVER_STARTED; + } const std::optional due = quiet_end_due(); if (due && look.when >= *due){ return SceneScreen::QUIET_END; @@ -251,10 +291,13 @@ void SceneTimeline::record(const ScreenObservation& look){ if (busy(look)){ m_last_busy = look.when; } + m_scene_seen = m_scene_seen || scene_shows(look); const bool box = look.events.has(ScreenEvent::DIALOG_BOX); + const bool party_bar = party_bar_is_control(m_config) && look.events.has(ScreenEvent::PLAYER_CAN_MOVE); + track_since(party_bar && !box, look.when, m_party_bar_since); track_since(look.readings.contains(CONTROLS_HINT_READING) && !box, look.when, m_hint_since); m_banner_looks = look.readings.contains(MISSION_BANNER_READING) && !box ? m_banner_looks + 1 : 0; - if (busy(look) || m_hint_since || m_banner_looks > 0){ + if (busy(look) || m_party_bar_since || m_hint_since || m_banner_looks > 0){ m_last_cue = look.when; } } @@ -265,7 +308,8 @@ std::string describe_look(const ScreenObservation& look){ const std::pair events[] = { {ScreenEvent::FADE_BLACK, "black fade"}, {ScreenEvent::FADE_WHITE, "white fade"}, {ScreenEvent::DIALOG_BOX, "text box"}, {ScreenEvent::CHOICE_BOX, "choice box"}, - {ScreenEvent::BATTLE_STARTED, "battle"}, {ScreenEvent::SCREEN_STILL, "still"}, + {ScreenEvent::BATTLE_STARTED, "battle"}, {ScreenEvent::PLAYER_CAN_MOVE, "party bar"}, + {ScreenEvent::INTERACT_PROMPT, "A prompt"}, {ScreenEvent::SCREEN_STILL, "still"}, }; const std::pair readings[] = { {CONTROLS_HINT_READING, "controls hint"}, {ADVANCE_ARROW_READING, "advance arrow"}, @@ -337,6 +381,7 @@ class SceneRunner{ !look.events.has(ScreenEvent::SCREEN_STILL); }); return; + case SceneScreen::PARTY_BAR: case SceneScreen::HINT_SHOWING: case SceneScreen::BANNER_SHOWING: m_backend.wait(POLL); @@ -391,6 +436,7 @@ Milliseconds max_still(SceneScreen screen){ case SceneScreen::BLIND_PRESS: // A blind A press need not change the screen. return SCENE_STILL_WAIT; + case SceneScreen::PARTY_BAR: case SceneScreen::HINT_SHOWING: case SceneScreen::BANNER_SHOWING: return STILL_WAIT; @@ -436,8 +482,19 @@ Pokemon::Outcome scene_outcome( const std::string_view kind = result.failure.starts_with("Did not finish") ? "scene_timeout" : "scene_stuck"; return Pokemon::outcome_failed(std::string(kind), std::format("{}: {}", label, result.failure)); } + if (result.terminal == scene_screen_name(SceneScreen::NEVER_STARTED)){ + return Pokemon::outcome_failed("scene_never_started", std::format( + "{}: the scene never started (player not at its trigger?): no text, choice or battle in {} ms.", + label, config.start_window ? config.start_window->count() : 0 + )); + } + if (result.terminal == scene_screen_name(SceneScreen::QUIET_END) && config.quiet_is_control){ + backend.log(std::format("[PLZA {}] done: quiet, taken as control.", label)); + return Pokemon::outcome_ok(); + } if (result.terminal == scene_screen_name(SceneScreen::QUIET_END)){ - // Nothing busy for the quiet time, and no controls hint or banner: + // Nothing busy for the quiet time, and no party bar, controls hint + // or banner: // a cutscene with no text, or control the detectors miss. return Pokemon::outcome_failed("scene_quiet", std::format( "{}: nothing busy for {} ms and no sign of control.", label, config.quiet ? config.quiet->count() : 0 diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h index 21a756e14d..e615a56dda 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h @@ -8,8 +8,9 @@ * every look picks one state, the state takes one step, and each change of * state is logged with the look's events. A text box (with or without a * choice, whose top row A takes) or the advance chevron - * (ADVANCE_ARROW_READING) gets A. The player has control when the - * tutorial's controls hint (CONTROLS_HINT_READING) holds a second, or when + * (ADVANCE_ARROW_READING) gets A. The player has control when the party + * bar (PLAYER_CAN_MOVE) or, in the tutorial, which has no party bar, the + * controls hint (CONTROLS_HINT_READING) holds a second, or when * a main mission's banner (MISSION_BANNER_READING) shows on two looks in a * row: it shows as the scene hands over control, and the machine then * waits for it to go, pressing A if it stays (01.03's "MAIN MISSION 02"). @@ -19,7 +20,8 @@ * (SceneMachineConfig::stop_at_choice) ends when the choice box shows * instead: 01.02's "Battle with Pokemon!"; one that stops at a battle * (stop_at_battle) ends on the battle HUD (BATTLE_STARTED): 01.03's - * battle with Andi. + * battle with Andi; neither takes the party bar for control, as it shows + * between the lines of a talk. * */ @@ -58,6 +60,15 @@ struct SceneMachineConfig{ // The button that advances text: B where an A could land on a choice // that shows the moment the text ends. Button text_button = BUTTON_A; + // The quiet end is control, not a failure: Hotel Z's lobby, halls and + // rooms show no party bar or prompt (02.04-02.06, console B + // 2026-11-10). + bool quiet_is_control = false; + // Fails ("scene_never_started") when no text, choice or battle has + // shown this long after the start, and no sign of control either: the + // player is not at the scene's trigger (02.02 run after the Brigitte + // battle walked past the street scene's, console B 2026-11-13). + std::optional start_window = std::nullopt; }; // Presses through scenes until the controls hint has held a second, or @@ -67,9 +78,10 @@ struct SceneMachineConfig{ // `config.stop_at_battle` the battle HUD, on // run_screen_machine(). `label` names its log lines ("[PLZA // mash_to_move_hints] dialog: text box"). Fails as "scene_quiet" on the -// quiet end, "scene_timeout" when `timeout` passes (by the looks' time), -// and "scene_stuck" on a state that comes up too often or a screen that -// stops changing. +// quiet end (unless `config.quiet_is_control`), "scene_never_started" +// past `config.start_window`, "scene_timeout" when `timeout` passes (by +// the looks' time), and "scene_stuck" on a state that comes up too often +// or a screen that stops changing. Pokemon::Outcome run_scene_machine( PlzaBackend& backend, std::string_view label, const SceneMachineConfig& config, Milliseconds timeout ); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine_Tests.cpp index 87cccd3808..7b33477429 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine_Tests.cpp @@ -60,6 +60,7 @@ const ScreenEvents WHITE{ScreenEvent::FADE_WHITE}; const ScreenEvents BLACK{ScreenEvent::FADE_BLACK}; const ScreenEvents CHOICE{ScreenEvent::DIALOG_BOX, ScreenEvent::CHOICE_BOX}; const ScreenEvents BATTLE{ScreenEvent::BATTLE_STARTED}; +const ScreenEvents PARTY{ScreenEvent::PLAYER_CAN_MOVE}; // mash_to_move_hints' config: a minute quiet, blind A after 5 s. SceneMachineConfig arrival_config(){ @@ -93,6 +94,22 @@ std::vector> banner_then_gone(size_t count){ return looks; } +// A "scene" step's config: no quiet time, no blind A, the scene must +// start within 45 s. +SceneMachineConfig scene_step_config(){ + SceneMachineConfig config; + config.start_window = 45000ms; + return config; +} + +// Hotel Z's rooms: 3 s quiet is control. +SceneMachineConfig quiet_room_config(){ + SceneMachineConfig config; + config.quiet = 3000ms; + config.quiet_is_control = true; + return config; +} + // A quiet time of 8 s after a scene of at least `min_length`, no blind A. SceneMachineConfig quiet_config(Milliseconds min_length){ SceneMachineConfig config; @@ -405,6 +422,90 @@ const RunCase RUN_CASES[] = { .input = {.looks = {look_at(0ms), look_at(5000ms, DIALOG), look_at(6000ms, DIALOG), look_at(7000ms, CHOICE)}, .config = choice_config()}, .expectation = {.verdict = "done", .a_presses = 0, .b_presses = 2, .line = "[PLZA test] done on choice."}, }, + { + .name = "the party bar held a second ends the scene; a box over it starts the second again", + .input = { + .looks = { + look_at(0ms, PARTY), look_at(600ms, DIALOG), look_at(900ms, PARTY), look_at(1800ms, PARTY), + look_at(1900ms, PARTY), + }, + .config = quiet_config(0ms), + }, + .expectation = { + .verdict = "done", + .a_presses = 1, + .line = "[PLZA test] screen 4: can_move at 1.9s", + .states = "party_bar, dialog, party_bar, can_move", + }, + }, + { + // It shows between the lines of a talk. + .name = "a machine that stops at a battle does not take the party bar for control", + .input = { + .looks = {look_at(0ms, STILL), look_at(1000ms, PARTY), look_at(2500ms, PARTY), look_at(3000ms, BATTLE)}, + .config = battle_config(), + }, + .expectation = {.verdict = "done", .a_presses = 2, .states = "blind_press, scene_moving, blind_press, battle"}, + }, + { + .name = "a machine that stops at a choice does not take the party bar for control", + .input = { + .looks = {look_at(0ms, PARTY), look_at(1500ms, PARTY), look_at(2000ms, CHOICE)}, + .config = choice_config(), + }, + .expectation = {.verdict = "done", .a_presses = 0, .states = "scene_moving, choice"}, + }, + { + .name = "no text, choice or battle within the start window: the scene never started", + .input = { + .looks = {look_at(0ms), look_at(10000ms, BLACK), look_at(44900ms, STILL), look_at(45000ms, STILL)}, + .config = scene_step_config(), + }, + .expectation = { + .verdict = "failed: scene_never_started", + .a_presses = 0, + .states = "scene_moving, fade_black, never_started", + }, + }, + { + .name = "a box within the start window: the scene started, a still screen past it waits", + .input = { + .looks = { + look_at(0ms), look_at(10000ms, DIALOG), look_at(50000ms, STILL), look_at(51000ms, PARTY), + look_at(52000ms, PARTY), look_at(53100ms, PARTY), + }, + .config = scene_step_config(), + }, + .expectation = { + .verdict = "done", + .a_presses = 1, + .states = "scene_moving, dialog, scene_still, party_bar, can_move", + }, + }, + { + .name = "after Brigitte: A at the text, done on the party bar held a second", + .input = {.looks = { + look_at(0ms, DIALOG), look_at(500ms, DIALOG), look_at(1000ms, PARTY), look_at(1500ms, PARTY), look_at(2100ms, PARTY), + }}, + .expectation = {.verdict = "done", .a_presses = 2, .line = "[PLZA test] done on can_move."}, + }, + { + .name = "Hotel Z's room: the quiet end is control", + .input = {.looks = {look_at(0ms, DIALOG), look_at(1000ms), look_at(4100ms, STILL)}, .config = quiet_room_config()}, + .expectation = {.verdict = "done", .a_presses = 1, .line = "[PLZA test] done: quiet, taken as control."}, + }, + { + // console B, 2026-11-13: 02.02 after the Brigitte battle walked + // past the street scene's trigger and A-mashed for two minutes. + .name = "a scene step past its trigger fails as scene_never_started", + .input = {.looks = {look_at(0ms, BLACK), look_at(2000ms), look_at(46000ms)}, .config = scene_step_config()}, + .expectation = {.verdict = "failed: scene_never_started", .a_presses = 0}, + }, + { + .name = "a scene step whose scene played out before it ends on the party bar", + .input = {.looks = {look_at(0ms, PARTY), look_at(1000ms, PARTY)}, .config = scene_step_config()}, + .expectation = {.verdict = "done", .a_presses = 0, .line = "[PLZA test] done on can_move."}, + }, { .name = "a minute with nothing going on fails as scene_quiet", .input = {.looks = {look_at(0ms), look_at(60000ms)}}, diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp index 4ee1785ca6..c7b494f91a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp @@ -16,6 +16,11 @@ namespace PokemonLZA{ namespace{ +// Where an interact prompt shows: over the scene, above the bottom hints. +// run_towards_gate_with_A_button()'s box (PokemonLZA_BasicNavigation) cut +// 0.05 shorter at the bottom, where upstream's reaches the battle HUD's +// hints (BATTLE_HINT_BOX) and would read every battle frame as a prompt. +const ImageFloatBox INTERACT_PROMPT_BOX{0.3, 0.2, 0.4, 0.65}; // The battle HUD's hints at the bottom centre: the A of "X A: Select Move" // (lab-B frames za2_hud_s3, za2_atk*: 15 of 15 battle frames, none of 442 // others, 2026-11-08). @@ -27,7 +32,9 @@ const ImageFloatBox BATTLE_HINT_BOX{0.40, 0.84, 0.20, 0.10}; PlzaScreenObserver::PlzaScreenObserver() : m_dialog({.white = WhiteDialogPart::BOX_ONLY}) , m_choice_arrow(COLOR_YELLOW, nullptr, SelectionArrowType::RIGHT, dialog_choice_box()) + , m_interact(COLOR_RED, ButtonType::ButtonA, INTERACT_PROMPT_BOX) , m_battle_hint(COLOR_CYAN, ButtonType::ButtonA, BATTLE_HINT_BOX) + , m_party(COLOR_WHITE) {} ScreenEvents PlzaScreenObserver::observe(const VideoSnapshot& frame, WallClock){ @@ -42,16 +49,21 @@ ScreenEvents PlzaScreenObserver::read(const ImageViewRGB32& screen){ if (fade_in(out) != WarpFade::NONE){ return out; } - out.set(ScreenEvent::DIALOG_BOX, m_dialog.detect(screen)); + const bool box = m_dialog.detect(screen); + out.set(ScreenEvent::DIALOG_BOX, box); out.set(ScreenEvent::CHOICE_BOX, m_choice_arrow.detect(screen)); + out.set(ScreenEvent::INTERACT_PROMPT, !box && m_interact.detect(screen)); out.set(ScreenEvent::BATTLE_STARTED, m_battle_hint.detect(screen)); + out.set(ScreenEvent::PLAYER_CAN_MOVE, !box && m_party.detect(screen)); return out; } void PlzaScreenObserver::make_overlays(VideoOverlaySet& items) const{ m_dialog.make_overlays(items); m_choice_arrow.make_overlays(items); + m_interact.make_overlays(items); m_battle_hint.make_overlays(items); + m_party.make_overlays(items); } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h index 0dc2d76ef7..9f10dfbc2c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h @@ -13,6 +13,7 @@ #include "Common/Cpp/Time.h" #include "CommonTools/ScreenEvents/ScreenEvents.h" #include "VideoGames/PokemonLZA/Inference/PokemonLZA_ButtonDetector.h" +#include "VideoGames/PokemonLZA/Inference/PokemonLZA_OverworldPartySelectionDetector.h" #include "VideoGames/PokemonLZA/Inference/PokemonLZA_SelectionArrowDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDialogDetector.h" @@ -28,6 +29,11 @@ namespace PokemonLZA{ // teal box; // - CHOICE_BOX: the selection arrow where a dialogue's choices are drawn // (dialog_choice_box()); +// - INTERACT_PROMPT: an A prompt over the scene ("A Talk", "A Leave"), +// with no box; +// - PLAYER_CAN_MOVE: the party bar at the bottom left +// (OverworldPartySelectionDetector), with no box. Hotel Z's lobby, +// halls and rooms do not show it; // - BATTLE_STARTED: the battle HUD's hints at the bottom centre ("X A: // Select Move"), read by their A icon. Story battles show no Run // prompt, so RunFromBattleDetector misses them. @@ -46,7 +52,9 @@ class PlzaScreenObserver : public ScreenEventObserver{ private: StoryDialogDetector m_dialog; SelectionArrowDetector m_choice_arrow; + ButtonDetector m_interact; ButtonDetector m_battle_hint; + OverworldPartySelectionDetector m_party; }; diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp new file mode 100644 index 0000000000..faabc22bf2 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp @@ -0,0 +1,183 @@ +/* PokemonLZA AutoStory - Screen events Tests + * + * From: https://github.com/PokemonAutomation/ + * + * Console frames (1920x1080) from CommandLineTests/PokemonLZA/. A frame + * of a folder names what it shows ("0076-interact_prompt+player_can_move.png", + * lab-B captures 2026-11-13). + * + */ + +#include +#include +#include +#include "Common/Cpp/Filesystem/Filesystem.h" +#include "Common/Cpp/TestRunners/UnitTest.h" +#include "CommonFramework/GlobalAutoPaths.h" +#include "CommonFramework/ImageTypes/ImageRGB32.h" +#include "PokemonLZA_AutoStoryScreenEvents.h" +#include "PokemonLZA_AutoStoryScreenEvents_Tests.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonLZA{ + + +namespace{ + +// The events these tests check on a frame. +struct PromptAndControl{ + bool interact_prompt = false; + bool can_move = false; + + bool operator==(const PromptAndControl&) const = default; +}; + +std::string to_text(const PromptAndControl& events){ + return std::format("A prompt {}, party bar {}", events.interact_prompt ? "yes" : "no", events.can_move ? "yes" : "no"); +} + +// What the observer reads on the frame at `path`. +PromptAndControl observed(const std::string& path){ + PlzaScreenObserver observer; + const ScreenEvents events = observer.read(ImageRGB32(path)); + return PromptAndControl{ + .interact_prompt = events.has(ScreenEvent::INTERACT_PROMPT), + .can_move = events.has(ScreenEvent::PLAYER_CAN_MOVE), + }; +} + +// What a folder frame's name says it shows. +PromptAndControl as_named(std::string_view name){ + return PromptAndControl{ + .interact_prompt = name.find("interact_prompt") != std::string_view::npos, + .can_move = name.find("player_can_move") != std::string_view::npos, + }; +} + + +struct FrameCase{ + std::string name; + struct Input{ + std::string_view path; // In CommandLineTests/PokemonLZA/. + }; + Input input; + struct Expectation{ + PromptAndControl events; + }; + Expectation expectation; +}; + +const FrameCase FRAME_CASES[] = { + { + .name = "an A prompt while the player is held", + .input = {.path = "AutoStoryScreenEvents/za2_m3v_s1.png"}, + .expectation = {.events = {.interact_prompt = true, .can_move = false}}, + }, +}; + +struct FolderCase{ + std::string name; + struct Input{ + std::string_view folder; // In CommandLineTests/PokemonLZA/. + }; + Input input; + struct Expectation{ + // How many frames the folder holds; each shows what its name says. + size_t frames = 0; + }; + Expectation expectation; +}; + +const FolderCase FOLDER_CASES[] = { + { + // A black fade, the zone's gate with its "A" prompt and the party + // bar after the catches (03.07). + .name = "the catches to the zone's start", + .input = {.folder = "AutoStoryDetectors/CatchesToZone1Start"}, + .expectation = {.frames = 8}, + }, +}; + +UnitTestResult check_frame(const FrameCase& test){ + const std::string path = std::format("{}PokemonLZA/{}", UNIT_TEST_RESOURCE_PATH(), test.input.path); + const PromptAndControl got = observed(path); + if (got != test.expectation.events){ + return std::format("{}: expected {}, got {}", test.input.path, to_text(test.expectation.events), to_text(got)); + } + return true; +} + +UnitTestResult check_folder(const FolderCase& test){ + const Filesystem::Path folder(std::format("{}PokemonLZA/{}/", UNIT_TEST_RESOURCE_PATH(), test.input.folder)); + if (!Filesystem::is_directory(folder)){ + return std::format("{} is not a folder.", folder.string()); + } + size_t frames = 0; + std::string failures; + for (const Filesystem::Path& path : Filesystem::list_directory(folder)){ + const std::string name = path.filename().string(); + if (!name.ends_with(".jpg") && !name.ends_with(".png")){ + continue; + } + frames++; + const PromptAndControl got = observed(path.string()); + if (got != as_named(name)){ + failures += std::format(" {}: {};", name, to_text(got)); + } + } + if (frames != test.expectation.frames){ + return std::format("Expected {} frames in {}, found {}.", test.expectation.frames, folder.string(), frames); + } + if (!failures.empty()){ + return std::format("Wrong on:{}", failures); + } + return true; +} + + +class Test_Frame : public UnitTest{ +public: + explicit Test_Frame(const FrameCase& test) + : UnitTest(std::format("PokemonLZA::AutoStoryScreenEvents - console frame: {}", test.name)) + , m_test(test) + {} + virtual UnitTestResult run(Logger&, CancellableScope&) const override{ + return check_frame(m_test); + } + +private: + const FrameCase& m_test; +}; + +class Test_Folder : public UnitTest{ +public: + explicit Test_Folder(const FolderCase& test) + : UnitTest(std::format("PokemonLZA::AutoStoryScreenEvents - console frames: {}", test.name)) + , m_test(test) + {} + virtual UnitTestResult run(Logger&, CancellableScope&) const override{ + return check_folder(m_test); + } + +private: + const FolderCase& m_test; +}; + +} // namespace + + +void add_tests_AutoStoryScreenEvents(UnitTestDatabase& database){ + for (const FrameCase& test : FRAME_CASES){ + database.add(test); + } + for (const FolderCase& test : FOLDER_CASES){ + database.add(test); + } +} + + + +} // namespace PokemonLZA +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.h new file mode 100644 index 0000000000..0323ab5d4a --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.h @@ -0,0 +1,27 @@ +/* PokemonLZA AutoStory - Screen events Tests + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#ifndef PokemonAutomation_PokemonLZA_AutoStoryScreenEvents_Tests_H +#define PokemonAutomation_PokemonLZA_AutoStoryScreenEvents_Tests_H + +#include "Common/Cpp/TestRunners/UnitTestDatabase.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonLZA{ + + +// Registers PlzaScreenObserver's tests on console frames from +// CommandLineTests/PokemonLZA/: its A prompt (INTERACT_PROMPT) and party +// bar (PLAYER_CAN_MOVE) events. +void add_tests_AutoStoryScreenEvents(UnitTestDatabase& database); + + + +} // namespace PokemonLZA +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.01.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.01.plan.json new file mode 100644 index 0000000000..995d3eb65e --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.01.plan.json @@ -0,0 +1,49 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "plza", + "checkpoint": { + "id": "02.01", + "title": "Main Mission 02: Battle Zone to Brigitte", + "start": { + "place": "LumioseCity" + }, + "events": [ + { + "id": "battle_zone_to_brigitte", + "kind": "game_action", + "why": "step 18: through the Battle Zone until Taunie's \"Almost there!\" and Brigitte's scene. Held legs, played on console B over CFR 2026-11-10: wait 3 s, +10 deg 4.25 s, L then right 6 s, L then right 6.5 s.", + "action": "walk", + "args": { + "legs": [[10, 4250], [90, 6000], [90, 6500]], + "held": true, + "wait_ms": 3000 + } + }, + { + "id": "brigitte_battle_start", + "kind": "game_action", + "why": "step 19: A through her talk to \"Brigitte sent out Cleffa!\"", + "action": "story_battle_start" + }, + { + "id": "brigitte_battle", + "kind": "game_action", + "why": "step 19: beat Brigitte's Cleffa (Lv 7), until her speech", + "action": "story_battle" + }, + { + "id": "after_brigitte", + "kind": "scene", + "why": "step 20: Brigitte's and Taunie's talk, until free control alone in the plaza", + "action": "a" + } + ], + "metadata": { + "phase": "testing", + "source": "console B recording, 2026-11-08/09: played step by step from a new game; split at the autosave after Brigitte (2026-11-10). Save unverified: reloads put the player at the next checkpoint's start (console B, 2026-11-10/13), but no run log shows the autosave badge here." + } + }, + "execution": { + "save": "unverified" + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.02.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.02.plan.json new file mode 100644 index 0000000000..09dbe70a3d --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.02.plan.json @@ -0,0 +1,71 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "plza", + "checkpoint": { + "id": "02.02", + "title": "Main Mission 02: after Brigitte to Hotel Z", + "start": { + "place": "LumioseCity" + }, + "events": [ + { + "id": "to_blocked_street", + "kind": "game_action", + "why": "step 21: on until the black fade into the street the trainers block. Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": { + "legs": [[0, 2000], [-75, 3500], [90, 3000]] + } + }, + { + "id": "street_scene", + "kind": "scene", + "why": "step 21: a Pokemon drives the trainers off (no battle)", + "action": "a" + }, + { + "id": "to_battle_zone_gate", + "kind": "game_action", + "why": "step 22: on to the gate's \"A Leave\" until its prompt shows. From the save the street scene ends at the gate (console B, 2026-11-10: no walk then); after the Brigitte battle it ended at the near end of the street, facing the gate (2026-11-13).", + "action": "walk_to_prompt", + "args": { + "timeout_ms": 10000 + } + }, + { + "id": "leave_battle_zone", + "kind": "talk", + "why": "step 22: A at the gate's \"A Leave\" (to_battle_zone_gate walked there); Taunie's first line ~3.5 s later (console B, 2026-11-10)" + }, + { + "id": "out_of_battle_zone", + "kind": "scene", + "why": "step 23: Taunie: out of the Battle Zone, Hotel Z's just through here", + "action": "a" + }, + { + "id": "through_covered_passage", + "kind": "game_action", + "why": "step 23: through the wooden door and the covered passage into the Hotel Z scene. Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": { + "legs": [[75, 3000], [40, 1500], [0, 3000]], + "held": true + } + }, + { + "id": "hotel_z_arrival", + "kind": "scene", + "why": "step 23: the Hotel Z arrival scene", + "action": "a" + } + ], + "metadata": { + "phase": "testing", + "source": "console B recording, 2026-11-08/09: played step by step from a new game; split from 02.01 at the autosave after Brigitte (2026-11-10); split at the autosave in front of Hotel Z (2026-11-10). Save unverified: reloads put the player at the next checkpoint's start (console B, 2026-11-10/13), but no run log shows the autosave badge here." + } + }, + "execution": { + "save": "unverified" + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.03.plan.json new file mode 100644 index 0000000000..3cddcda5d9 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.03.plan.json @@ -0,0 +1,34 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "plza", + "checkpoint": { + "id": "02.03", + "title": "Main Mission 02: into the Hotel Z lobby", + "start": { + "place": "LumioseCity" + }, + "events": [ + { + "id": "to_hotel_z_door", + "kind": "game_action", + "why": "step 24: up the steps to the door's \"A Enter\". 3-4.5 s, the longest. Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": {"legs": [[0, 4500]]} + }, + { + "id": "hotel_z_lobby", + "kind": "game_action", + "why": "steps 24-25: A Enter at the door, the loading screen, the lobby scene with Taunie (a plain scene step ends at once on the door's prompt; console B, 2026-11-10). The game autosaves in the lobby here: loading this stretch's save puts you inside, before the clerk (console B, 2026-11-13)", + "action": "mash_to_move_hints", + "args": {"press_a_first": true} + } + ], + "metadata": { + "phase": "testing", + "source": "console B recording, 2026-11-08/09: played step by step from a new game; split from 02.02 at the autosave in front of Hotel Z (2026-11-10); ends at the lobby autosave, the check-in moved to 02.04 (2026-11-13). Save unverified: reloads put the player at the next checkpoint's start (console B, 2026-11-10/13), but no run log shows the autosave badge here." + } + }, + "execution": { + "save": "unverified" + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.04.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.04.plan.json new file mode 100644 index 0000000000..b29b1ffd4d --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.04.plan.json @@ -0,0 +1,39 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "plza", + "checkpoint": { + "id": "02.04", + "title": "Main Mission 02: Hotel Z check-in", + "start": { + "place": "LumioseCity" + }, + "events": [ + { + "id": "to_front_counter", + "kind": "game_action", + "why": "step 26: along the counter to the clerk's \"A Talk\". 2.25 s was one step short. Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": {"legs": [[-5, 2500], [-85, 0]]} + }, + { + "id": "talk_to_clerk", + "kind": "talk", + "why": "step 26: A at the clerk (\"A Talk ???\")" + }, + { + "id": "check_in", + "kind": "game_action", + "why": "steps 26-27: from the clerk's talk straight through Taunie, AZ, the check-in scene and the Key to Room 202, until control facing the elevator, where the game autosaves (autosave B). There is no free control between the clerk and the elevator: AZ was already talking when the clerk's talk ended (console B, 2026-11-13), so the old turn to AZ is gone. The lobby shows the party bar without its D-pad hint, which the party bar detector keys on, so the step ends on 5 s quiet after the scene, before any blind A (console B, 2026-11-13: the scene ended at ~76 s, then a minute of blind A and scene_quiet). The 30 s minimum covers the text-free ~17 s opening with AZ", + "action": "mash_to_move_hints", + "args": {"press_a_first": true, "quiet_ms": 5000, "min_length_ms": 30000, "quiet_is_control": true} + } + ], + "metadata": { + "phase": "testing", + "source": "console B recording, 2026-11-08/09: played step by step from a new game; split from 02.03 at the autosave after the check-in (2026-11-10); starts at the lobby autosave just inside the door, before the clerk, which is where loading its save puts you (console B, 2026-11-13). Ends at the autosave after the check-in scene: ~3 tiles in front of the elevator, facing it, holding the suitcase, Taunie beside, AZ at the counter (reloaded there on console B, 2026-11-13); the elevator ride is 02.05. Save unverified: reloads put the player at the next checkpoint's start (console B, 2026-11-10/13), but no run log shows the autosave badge here." + } + }, + "execution": { + "save": "unverified" + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.05.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.05.plan.json new file mode 100644 index 0000000000..2996652502 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.05.plan.json @@ -0,0 +1,66 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "plza", + "checkpoint": { + "id": "02.05", + "title": "Main Mission 02: Hotel Z elevator to Room 202", + "start": { + "place": "LumioseCity" + }, + "events": [ + { + "id": "to_lobby_elevator", + "kind": "game_action", + "why": "step 28: to the elevator's \"A Take Elevator\". Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": {"legs": [[0, 2000]]} + }, + { + "id": "take_elevator_up", + "kind": "talk", + "why": "step 28: A Take Elevator, \"Which floor?\"" + }, + { + "id": "floor_question", + "kind": "game_action", + "why": "step 28: the elevator line, then \"Which floor?\", before the choice shows; B would close the talk (console B, 2026-11-10)", + "action": "text_to_choice", + "args": {"advance_with_a": true} + }, + { + "id": "ride_to_2f", + "kind": "game_action", + "why": "step 28: \"2F\", the first floor listed", + "action": "choose_0" + }, + { + "id": "arrive_2f", + "kind": "game_action", + "why": "step 28: the ride, until control on 2F; the hall shows no party bar or prompt, so the quiet time is control (console B, 2026-11-10)", + "action": "mash_to_move_hints", + "args": {"quiet_ms": 3000, "min_length_ms": 5000, "quiet_is_control": true} + }, + { + "id": "to_room_202", + "kind": "game_action", + "why": "step 29: to \"Room 202 / A Enter\". Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": {"legs": [[-15, 2000]]} + }, + { + "id": "enter_room_202", + "kind": "game_action", + "why": "step 30: A Enter, \"Here's room 202.\", the fade, until control in the room; no party bar or prompt there (console B, 2026-11-10)", + "action": "mash_to_move_hints", + "args": {"press_a_first": true, "quiet_ms": 3000, "min_length_ms": 5000, "quiet_is_control": true} + } + ], + "metadata": { + "phase": "testing", + "source": "console B recording, 2026-11-08/09: played step by step from a new game; split from 02.04 at the autosave after the check-in scene (2026-11-13). Starts at that autosave: the lobby ~3 tiles in front of the elevator, facing it, holding the suitcase, Taunie beside, AZ at the counter (reloaded there on console B, 2026-11-13; 02.04 from there failed at talk_to_clerk). Ends at the autosave on entering Room 202. Save unverified: reloads put the player at the next checkpoint's start (console B, 2026-11-10/13), but no run log shows the autosave badge here." + } + }, + "execution": { + "save": "unverified" + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.06.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.06.plan.json new file mode 100644 index 0000000000..1992801f66 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.06.plan.json @@ -0,0 +1,52 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "plza", + "checkpoint": { + "id": "02.06", + "title": "Main Mission 02: the night in Room 202", + "start": { + "place": "LumioseCity" + }, + "events": [ + { + "id": "to_bed", + "kind": "game_action", + "why": "step 31: to the bed's \"A Rest\". 1.5 s explored, 1 s enough. Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": {"legs": [[45, 1000]], "held": true} + }, + { + "id": "rest", + "kind": "talk", + "why": "step 31: A Rest, \"Rest until tomorrow morning?\"" + }, + { + "id": "rest_question", + "kind": "game_action", + "why": "step 31: \"Rest until tomorrow morning?\" before the choice shows", + "action": "text_to_choice", + "args": {"advance_with_a": true} + }, + { + "id": "rest_until_morning", + "kind": "game_action", + "why": "step 31: yes", + "action": "choose_0" + }, + { + "id": "wake_up", + "kind": "game_action", + "why": "step 32: sleep and wake up, until control facing the door; the room shows no party bar or prompt, so the quiet time is control", + "action": "mash_to_move_hints", + "args": {"quiet_ms": 3000, "min_length_ms": 20000, "quiet_is_control": true} + } + ], + "metadata": { + "phase": "testing", + "source": "console B recording, 2026-11-08/09: played step by step from a new game; split from 02.04 at the autosave on entering Room 202 (2026-11-10); starts at that autosave, in the room. Renumbered from 02.05 when 02.04 was split at the elevator autosave (2026-11-13). Autosave: the run log showed the badge at wake_up's end (\"[Autosave] 02.06/6 wake_up\", console B, 2026-11-13 14:13)." + } + }, + "execution": { + "save": "autosave" + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.07.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.07.plan.json new file mode 100644 index 0000000000..c0e7f4d8a9 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-02.07.plan.json @@ -0,0 +1,35 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "plza", + "checkpoint": { + "id": "02.07", + "title": "Main Mission 02: the first evening to Main Mission 03", + "start": { + "place": "LumioseCity" + }, + "events": [ + { + "id": "to_room_door", + "kind": "game_action", + "why": "step 33: to the door's \"A Leave\". Measured 2026-11-08 on console B, walk not run.", + "action": "walk", + "args": {"legs": [[0, 2000]]} + }, + { + "id": "first_evening", + "kind": "game_action", + "why": "steps 33-35: A Leave at the door, Taunie, the rooftop, AZ, the Main Mission 03 banner and its autosave", + "action": "mash_to_move_hints", + "args": {"press_a_first": true} + } + ], + "metadata": { + "phase": "testing", + "source": "console B recording, 2026-11-08/09: played step by step from a new game; split from 02.05 at the autosave after waking up (2026-11-10); renumbered from 02.06 when 02.04 was split at the elevator autosave (2026-11-13). Save unverified: its run passed on the MAIN MISSION 03 banner with no autosave badge in the log (console B, 2026-11-13 14:16)." + } + }, + "execution": { + "save": "unverified", + "reload_when_chained": true + } +} diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 802cf33612..4797665529 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2357,6 +2357,8 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine_Tests.h Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h + Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp + Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.h Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryStoryFiles.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryStoryFiles.h Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryTable.cpp