Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -61,7 +61,7 @@
"#####################################..####.#S....###.....######",
"###########################################.......####.......###",
"############################################.....#####.......###",
"############################################.....#####.....#####",
"############################################DDDDD#####.....#####",
"######################################################..#..#####",
"################################################################",
"################################################################",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "OreburghMineB1F",
"source": {"decomp_file": "pret/pokediamond: files/fielddata/land_data/land_data_release/narc_0313.bin; zone_event narc_0196", "revision": "default branch", "date": "2026-10-31"},
"tiles": [
"################################",
"###########DDD##################",
"######...##...##.###############",
"######...##...##.###############",
"####.................###########",
"####.................###########",
"####.................###########",
"####.................###########",
"####.................###########",
"####.................###########",
"######.............#############",
"######.............#############",
"######.............#############",
"######.............#############",
"########.........###############",
"########.........###############",
"########.........###############",
"########.........###############",
"##########.....#################",
"##########.....#################",
"##########.....#################",
"##########.....#################",
"############D###################",
"################################",
"################################",
"################################",
"################################",
"################################",
"################################",
"################################",
"################################",
"################################"
],
"objects": [
{"name": "worker_0", "kind": "npc", "x": 7, "y": 4},
{"name": "item_1", "kind": "item", "x": 19, "y": 4},
{"name": "twin_2", "kind": "npc", "x": 6, "y": 3}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const StoryEvents& story_events(){
add_lake_events(ret);
add_sandgem_events(ret);
add_jubilife_events(ret);
add_route203_events(ret);
add_oreburgh_events(ret);
add_route204_events(ret);
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
*
* The story's steps that only BDSP has, by name: a step of the table whose
* variant names one of these runs it (StoryExecutor::run()). Some are the
* scripted scenes (the intro's briefcase, the starter, the Starly battle,
* the Pokedex); most are segment 01's walks, which were measured on the
* console as holds, taps and walks until stopped rather than planned, and
* are kept as they ran there. Each fails by throwing, with a screenshot;
* the executor turns that into a failed step.
* scripted scenes (the Azure Flute, the lake's briefcase, the starter,
* Dawn's catching tutorial and the catch); the rest do what the shared
* steps cannot, as they ran on the console: the Poke Mart lady's Potions
* and the stairs into Jubilife (00.04c, 00.04d), a clown who wanders
* (00.05b), the Gym's tries from the Pokemon Center (01.04) and Rock Smash
* (01.09). Each fails by throwing, with a screenshot; the executor turns
* that into a failed step.
*
* They are in files by area: _Events_Lake (00.00 to 00.03), _Sandgem
* (00.04), _Jubilife (00.05, 01.01), _Route203 (01.02), _Oreburgh (01.03
* and 01.04) and _Route204 (01.09's Rock Smash, 01.11). 01.05 to 01.10
* are planned walks in the story table.
* They are in files by area: _Events_Lake (00.00 to 00.04), _Sandgem
* (00.04c, 00.04d), _Jubilife (00.05b), _Oreburgh (01.04) and _Route204
* (01.09).
*
*/

Expand Down Expand Up @@ -46,7 +47,6 @@ StoryEvent console_event(std::function<void(VideoStream& stream, ProControllerCo
void add_lake_events(StoryEvents& events);
void add_sandgem_events(StoryEvents& events);
void add_jubilife_events(StoryEvents& events);
void add_route203_events(StoryEvents& events);
void add_oreburgh_events(StoryEvents& events);
void add_route204_events(StoryEvents& events);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
/* BDSP AutoStory - Events: Jubilife City (00.05, 01.01)
/* BDSP AutoStory - Events: Jubilife City (00.05b)
*
* From: https://github.com/PokemonAutomation/
*
* The Jubilife beats of 00.05 the story table cannot plan (up the steps,
* Barry's Town Map, the talk to a wandering clown), and segment 01's walk
* out of the Center to Barry.
* The Jubilife beat of 00.05b the story table cannot plan: the talk to a
* wandering clown.
*
*/

#include <cmath>
#include <format>
#include <optional>
#include "CommonFramework/ImageTools/ImageBoxes.h"
#include "CommonFramework/VideoPipeline/VideoFeed.h"
#include "CommonTools/Async/InferenceRoutines.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "PokemonBDSP/Inference/PokemonBDSP_DialogDetector.h"
#include "PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Indoors.h"
#include "PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_RouteWalk.h"
#include "PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Walk.h"
#include "PokemonBDSP_AutoStory_Center.h"
#include "PokemonBDSP_AutoStory_Talks.h"
#include "PokemonBDSP_AutoStory_Walks.h"
#include "PokemonBDSP_AutoStory_WildBattle.h"
Expand All @@ -35,37 +31,6 @@ using Pokemon::Direction;

namespace{

// 00.05: from the save below Jubilife's steps, against the wall east of
// them: a tile west (the first press only turns), then up the steps.
void up_the_steps(VideoStream& stream, ProControllerContext& context){
// D-pad taps, a tile each: the stick holds this was (200 ms west, 480 ms
// north) left us between tiles, and every leg after it a column off
// (r57 to r61). By hand: a tap west and taps north from the save land
// on the map's tiles (between the lamps at x 43 and 49 after six).
route_turn(stream, context, Direction::WEST);
walk_tiles_dpad(stream, context, run_from_wild_battle, {-1, 0}, 1, "To the steps");
route_turn(stream, context, Direction::NORTH);
const WalkResult up = walk_tiles_dpad(stream, context, run_from_wild_battle, {0, 1}, 2, "Up the steps");
if (up.stop == WalkStop::DIALOG || up.stop == WalkStop::TRANSITION){
fail_step(stream, std::string("Up the steps: ") + walk_stop_name(up.stop) + ".");
}
}

// 00.05: Barry stands at the blackboard a tile west of the door's column,
// and that column is clear to the back wall: north to it, face west, his
// scene to "You obtained a Town Map!" (A closes it). A tile west by a hold
// went two in r149a and the boy at the table stopped us.
void barry_town_map(VideoStream& stream, ProControllerContext& context){
for (size_t attempt = 0; attempt < 2; attempt++){
const DialogueRead read = talk_facing(stream, context, Direction::WEST, BUTTON_A, "Barry");
if (read.opened && read.closed){
return;
}
walk_until_stopped(stream, context, Direction::NORTH, 4, "North to the back wall");
}
fail_step(stream, "Trainers' School: Barry did not answer from beside the back wall.");
}

// 00.05b: a talk to someone who wanders a tile either side of home along a
// row (the clowns by the Mart and the Poketch Company, WANDER_AROUND with
// x range 1). Waiting under home alone missed him for a minute (r66: he
Expand Down Expand Up @@ -117,107 +82,11 @@ Pokemon::Outcome talk_to_wanderer(StoryExecutor& executor, Pokemon::RunState&, c
fail_step(stream, step.name + ": no answer from any tile below his range.");
}


// 01.01 from the save at the Jubilife Center's PC: healed at the nurse,
// out of the door and through the plaza to the street east to Route 203.
void jubilife_heal_and_out_to_street(VideoStream& stream, ProControllerContext& context){
// The save stands us at the PC, right of the counter, facing it; west
// is the counter's end. Two tiles south clears it, then three west is
// the floor emblem's column, with the nurse north and the door south.
route_turn(stream, context, Direction::SOUTH);
pbf_move_left_joystick(context, {0, -1}, route_open_hold(Direction::SOUTH, 2), 200ms);
route_turn(stream, context, Direction::WEST);
pbf_move_left_joystick(context, {-1, 0}, route_open_hold(Direction::WEST, 3), 200ms);
if (walk_to_talk(stream, context, run_from_wild_battle, {0, 1}, 3000ms, "to the nurse").stop != WalkStop::DIALOG){
fail_step(stream, "Jubilife Pokemon Center: the nurse did not answer.");
}
// A throughout: Yes to "rest your Pokemon?" (B would answer No).
finish_dialogue(stream, context, BUTTON_A, "Nurse");
// Healing shows no text box for a few seconds, which reads as the end;
// her "Thank you for waiting" lines follow it.
if (dialogue_opens(stream, context, 6000ms)){
finish_dialogue(stream, context, BUTTON_B, "Nurse, after healing");
}
// South through the door until a girl standing below it stops us. The
// door's fade may or may not read as a transition.
WalkResult out{WalkStop::LIMIT, 0ms, 0};
for (size_t walk = 0; walk < 3 && out.stop != WalkStop::BLOCKED; walk++){
out = walk_until(stream, context, run_from_wild_battle, {0, -1}, 8000ms, "out of the Pokemon Center");
if (out.stop == WalkStop::DIALOG || out.stop == WalkStop::ARRIVED){
break;
}
}
if (out.stop != WalkStop::BLOCKED){
fail_step(stream, std::string("Jubilife Pokemon Center: walking out ended with ") + walk_stop_name(out.stop) + ", not at the girls below the door.");
}

// Jubilife's plaza has too few walls the grid gets right to plan on (a
// leg to a wall the map shows walked on 19 tiles). These are the holds
// that worked on the console: west onto the main road, north to the
// street east to Route 203, and back a couple of tiles.
route_turn(stream, context, Direction::WEST);
pbf_move_left_joystick(context, {-1, 0}, 720ms, 300ms);
route_turn(stream, context, Direction::NORTH);
pbf_move_left_joystick(context, {0, 1}, 3960ms, 300ms);
route_turn(stream, context, Direction::SOUTH);
pbf_move_left_joystick(context, {0, -1}, 600ms, 300ms);
context.wait_for_all_requests();
}

// 01.01: from the Center's PC, the nurse and out, then the holds to the street east to Route 203;
// nothing when 00.05 has left us outdoors on that street.
void jubilife_center_to_street(VideoStream& stream, ProControllerContext& context){
// From 00.05g we are already outdoors on the street east to Route 203,
// healed on arriving in Jubilife: straight to the walk east.
bool outdoors = false;
context.wait_for_all_requests();
if (VideoSnapshot screen = stream.video().snapshot()){
outdoors = !indoors(*screen.frame);
}
if (outdoors){
stream.log("[Route] 01.01: outdoors; skipping the Pokemon Center.");
}else{
jubilife_heal_and_out_to_street(stream, context);
}
}

// 01.01: east along the street until Barry stops us at the entrance to Route 203.
void east_to_barry(VideoStream& stream, ProControllerContext& context){
// East along the street. The opening to the route is a few rows high;
// Barry stops us a little way in. A wall means we are a row off it: try
// rows to the south, then to the north.
static const int ROW_CHANGES[] = {0, 1, 1, -3, -1};
bool barry = false;
for (int change : ROW_CHANGES){
if (barry){
break;
}
for (int i = 0; i < std::abs(change); i++){
const Direction dir = change > 0 ? Direction::SOUTH : Direction::NORTH;
route_turn(stream, context, dir);
pbf_move_left_joystick(context, {0, change > 0 ? -1.0 : 1.0}, route_open_hold(dir, 1), 200ms);
}
context.wait_for_all_requests();
WalkResult walk{WalkStop::LIMIT, 0ms, 0};
for (size_t stretch = 0; stretch < 3 && walk.stop == WalkStop::LIMIT; stretch++){
walk = walk_until(stream, context, run_from_wild_battle, {1, 0}, 9000ms, "east to Route 203");
}
barry = walk.stop == WalkStop::DIALOG;
}
if (!barry){
fail_step(stream, "Route 203: Barry did not stop us at the entrance.");
}
}

}


void add_jubilife_events(StoryEvents& events){
events.emplace("up_the_steps", console_event(up_the_steps));
events.emplace("barry_town_map", console_event(barry_town_map));
events.emplace("talk_to_wanderer", talk_to_wanderer);
events.emplace("jubilife_center_to_street", console_event(jubilife_center_to_street));
events.emplace("east_to_barry", console_event(east_to_barry));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* Adapted from PokemonAutomation/Arduino-Source#1717 by Developer-Butters.
*
* The scenes of the story's start that need scripted input: the briefcase
* at Lake Verity, the starter, the Starly battle and the scene after it,
* the Pokedex in Rowan's lab, Mom's and Barry's mother's lines, and Dawn's
* catching tutorial. The button sequences are Butters' (#1717); they ran on
* at Lake Verity, the starter, Mom's and Barry's mother's lines, and Dawn's
* catching tutorial. The button sequences are
* Butters' (#1717); they ran on
* the console in his recordings, but not yet from the planned walks around
* them.
*
Expand Down Expand Up @@ -116,24 +116,7 @@ void azure_flute_if_there(VideoStream& stream, ProControllerContext& context){
}
}

// 00.02: after the Starly battle, Rowan's lines and the walk out of the
// lake, B for a minute.
void after_starly(VideoStream&, ProControllerContext& context){
pbf_mash_button(context, BUTTON_B, 60000ms);
context.wait_for_all_requests();
}

// 00.03: Dawn walks us into Rowan's lab: his lines, "give a nickname?"
// (B: No), and the Pokedex, taken with A.
void rowan_gives_pokedex(VideoStream& stream, ProControllerContext& context){
wait_for_dialogue(stream, context, "Dawn at Sandgem's entrance");
pbf_mash_button(context, BUTTON_B, 50000ms);
wait_for_dialogue(stream, context, "Nickname: no");
pbf_mash_button(context, BUTTON_B, 40000ms);
wait_for_dialogue(stream, context, "The Pokedex");
pbf_mash_button(context, BUTTON_A, 40000ms);
context.wait_for_all_requests();
}

// 00.04: Dawn's catching tutorial on Route 202: her lines and her demo
// battle, B for 70 s.
Expand All @@ -151,9 +134,8 @@ void add_lake_events(StoryEvents& events){
events.emplace("azure_flute_if_there", console_event(azure_flute_if_there));
events.emplace("starter_briefcase", console_event(starter_briefcase));
events.emplace("choose_starter", choose_starter);
events.emplace("fight_starly", console_event(fight_starly));
events.emplace("after_starly", console_event(after_starly));
events.emplace("rowan_gives_pokedex", console_event(rowan_gives_pokedex));


events.emplace("catch_tutorial", console_event(catch_tutorial));
events.emplace("catch_pokemon", console_event(catch_1_pokemon));
}
Expand Down
Loading
Loading