Skip to content
Merged
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 @@ -525,6 +525,12 @@ AutoStory::AutoStory()
LockMode::UNLOCK_WHILE_RUNNING,
true
)
, ENSURE_MINIMAP_UNLOCKED(
"<b>Pre-check: Ensure the minimap is unlocked:</b><br>"
"This is to ensure the minimap is unlocked. We use it to detect our direction.",
LockMode::UNLOCK_WHILE_RUNNING,
true
)
, GO_HOME_WHEN_DONE(true)
, NOTIFICATION_STATUS_UPDATE("Status Update", true, false, std::chrono::seconds(30))
, NOTIFICATIONS({
Expand Down Expand Up @@ -764,6 +770,7 @@ AutoStory::AutoStory()
PA_ADD_OPTION(CHANGE_SETTINGS);
PA_ADD_OPTION(ENSURE_TIME_UNSYNCED);
PA_ADD_OPTION(ENSURE_CORRECT_MOVES);
PA_ADD_OPTION(ENSURE_MINIMAP_UNLOCKED);

PA_ADD_OPTION(NOTIFICATIONS);

Expand Down Expand Up @@ -1316,6 +1323,11 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex
confirm_lead_pokemon_moves(env, context, LANGUAGE);
}

if (ENSURE_MINIMAP_UNLOCKED && STORY_SECTION == StorySection::MAIN_STORY){
env.console.log("Ensure the minimap is unlocked.");
confirm_minimap_unlocked(env, context);
}

run_autostory(env, context);

send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste
BooleanCheckBoxOption CHANGE_SETTINGS;
BooleanCheckBoxOption ENSURE_TIME_UNSYNCED;
BooleanCheckBoxOption ENSURE_CORRECT_MOVES;
BooleanCheckBoxOption ENSURE_MINIMAP_UNLOCKED;

GoHomeWhenDoneOption GO_HOME_WHEN_DONE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,22 @@ void confirm_lead_pokemon_moves(SingleSwitchProgramEnvironment& env, ProControll

}

void confirm_minimap_unlocked(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
DirectionDetector direction;
try{
direction.change_direction(env.program_info(), env.console, context, 3.02);
pbf_press_button(context, BUTTON_L, 200ms, 200ms);
}catch(OperationFailedException&){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"confirm_minimap_unlocked(): Unable to confirm that the minimap is unlocked. Likely because the direction cannot be detected. "
"If you manually confirm that the minimap is unlocked, you can disable this precheck in the program setting \"Pre-check: Ensure the minimap is unlocked\".",
env.console
);
}

}

void change_settings_prior_to_autostory_segment_mode(SingleSwitchProgramEnvironment& env, ProControllerContext& context, size_t current_segment_num, Language language){
// get index of `Options` in the Main Menu, which depends on where you are in Autostory
int8_t options_index;
Expand Down Expand Up @@ -814,8 +830,10 @@ void do_action_and_monitor_for_battles_early(
{no_minimap}
);
if (ret == 0){ // if see no minimap. stop and see if we detect a battle. if so, throw Battl exception
stream.log("do_action_and_monitor_for_battles_early: Detected no mini-map. Possibly caught in a battle.");
do_action_and_monitor_for_battles(info, stream, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
// wait 30 seconds to see if we detect a battle. If so, this throws an UnexpectedBattleException.
pbf_wait(context, Seconds(30));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ void swap_starter_moves(SingleSwitchProgramEnvironment& env, ProControllerContex
// start and end in the overworld
void confirm_lead_pokemon_moves(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language);

void confirm_minimap_unlocked(SingleSwitchProgramEnvironment& env, ProControllerContext& context);

// run the given `action`. if detect a battle, stop the action, and throw exception
void do_action_and_monitor_for_battles(
const ProgramInfo& info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ void checkpoint_70(SingleSwitchProgramEnvironment& env, ProControllerContext& co
[&](size_t attempt_number){
context.wait_for_all_requests();
// fly back to North Province Area Three
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, -1, +1, 0ms}, FlyPoint::POKECENTER);
// fly_to_overworld_from_map() may fail since the snowy background on the map will false positive the destinationMenuItemWatcher (MapDestinationMenuDetector at box {0.523000, 0.680000, 0.080000, 0.010000}), which causes the fly to fail
// we can get around this by either placing down a marker, or by zooming out so that that section isn't white snow.
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::ZOOM_OUT, -1, +1, 0ms}, FlyPoint::POKECENTER);

// fly back to Glaseado Mountain Pokecenter
// this clears Pokemon in minimap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ void checkpoint_76(SingleSwitchProgramEnvironment& env, ProControllerContext& co
// pokemon are cleared from minimap after the Snow Slope run

// fly back to Glaseado Gym Pokecenter
// the problem with the snowy background is still there. but the marker placed previously is also still there
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::ZOOM_IN, -1, +1, 0ms}, FlyPoint::POKECENTER);


Expand Down