Skip to content
Draft
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 @@ -15,6 +15,7 @@
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
#include "Pokemon/Pokemon_Strings.h"
#include "PokemonLA/Inference/Sounds/PokemonLA_ShinySoundDetector.h"
#include "PokemonLZA/Inference/PokemonLZA_AlertEyeDetector.h"
#include "PokemonLZA/Programs/PokemonLZA_BasicNavigation.h"
#include "PokemonLZA_ShinyHunt_FlySpotReset.h"

Expand Down Expand Up @@ -65,7 +66,8 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
{Route::NO_MOVEMENT, "no_movement", "No Movement"},
{Route::WILD_ZONE_19, "wild_zone_19", "Wild Zone 19"},
{Route::ALPHA_PIDGEY, "alpha_pidgey", "Alpha Pidgey (Wild Zone 1)"},
// {Route::ALPHA_PIKACHU, "alpha_pikachu", "Alpha Pikachu (Wild Zone 6)"},
{Route::ALPHA_PATRAT, "alpha_patrat", "Alpha Patrat (Cafe Cyclone)"},
{Route::ALPHA_PIKACHU, "alpha_pikachu", "Alpha Pikachu (Wild Zone 6)"},
// {Route::CUSTOMISED_MACRO, "customised_macro", "Customised Macro"},
},
LockMode::LOCK_WHILE_RUNNING,
Expand Down Expand Up @@ -177,6 +179,93 @@ void route_alpha_pidgey(
wait_until_overworld(env.console, context);
}

void route_alpha_patrat(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
ShinyHunt_FlySpotReset_Descriptor::Stats& stats,
bool to_zoom_to_max){
{
BlackScreenOverWatcher black_screen(COLOR_BLUE);
int ret = run_until<ProControllerContext>(
env.console, context,
[](ProControllerContext& context){
ssf_press_button(context, BUTTON_B, 0ms, 500ms, 0ms);
pbf_move_left_joystick(context, 0, 128, 2000ms, 0ms);
pbf_move_left_joystick(context, 96, 0, 3500ms, 0ms);
},
{black_screen}
);
if (ret == 0){
wait_until_overworld(env.console, context, 50s);
}
}
open_map(env.console, context, to_zoom_to_max);
pbf_move_left_joystick(context, 128, 255, 50ms, 100ms);
if (fly_from_map(env.console, context) != FastTravelState::SUCCESS){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"fly_from_map(): Unable to fast travel",
env.console);
}
wait_until_overworld(env.console, context, 50s);
}


void route_alpha_pikachu(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
ShinyHunt_FlySpotReset_Descriptor::Stats& stats,
bool to_zoom_to_max){
int ret = -1;
{
BlackScreenOverWatcher black_screen(COLOR_BLUE);
ret = run_until<ProControllerContext>(
env.console, context,
[&](ProControllerContext& context){
ssf_press_button(context, BUTTON_B, 0ms, 500ms, 0ms);
pbf_move_left_joystick(context, 0, 128, 2000ms, 0ms);
pbf_move_left_joystick(context, 128, 0, 2700ms, 0ms);
pbf_move_left_joystick(context, 255, 128, 1000ms, 0ms);
pbf_mash_button(context, BUTTON_A, 500ms); // ladder
pbf_move_left_joystick(context, 128, 0, 5300ms, 0ms);
},
{black_screen}
);
}
if (ret == 0){
wait_until_overworld(env.console, context, 50s);
//TODO: reset game if still get caught by wild pokémon
}
{
AlertEyeOverWatcher eye_watcher(COLOR_WHITE, &env.console.overlay());
ret = run_until<ProControllerContext>(env.console, context, [&](ProControllerContext& context){
pbf_move_left_joystick(context, 255, 128, 3600ms, 0ms);
pbf_move_left_joystick(context, 128, 0, 3000ms, 0ms);
}, {{eye_watcher}});
}
if (ret < 0){
AlertEyeOverWatcher eye_watcher(COLOR_WHITE, &env.console.overlay());
ret = wait_until(env.console, context, 30s, {{eye_watcher}});
}
if (ret < 0){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"AlertEyeOverWatcher: Unable to fast travel after 30s",
env.console);
}
open_map(env.console, context, to_zoom_to_max);
pbf_move_left_joystick(context, 148, 20, 100ms, 200ms);
if (fly_from_map(env.console, context) == FastTravelState::SUCCESS) {
wait_until_overworld(env.console, context);
return;
} else {
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"fly_from_map(): Unable to fast travel",
env.console);
}
}

} // namespace

void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
Expand Down Expand Up @@ -213,6 +302,12 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
case Route::ALPHA_PIDGEY:
route = route_alpha_pidgey;
break;
case Route::ALPHA_PATRAT:
route = route_alpha_patrat;
break;
case Route::ALPHA_PIKACHU:
route = route_alpha_pikachu;
break;
default:
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ShinyHunt_FlySpotReset : public SingleSwitchProgramInstance{
NO_MOVEMENT,
WILD_ZONE_19,
ALPHA_PIDGEY,
ALPHA_PATRAT,
ALPHA_PIKACHU,
CUSTOMISED_MACRO = 255,
};
Expand Down
Loading