Skip to content

Commit 7e52906

Browse files
committed
FlySpotReset: add route for alpha pikachu
1 parent cd3a7ac commit 7e52906

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
1616
#include "Pokemon/Pokemon_Strings.h"
1717
#include "PokemonLA/Inference/Sounds/PokemonLA_ShinySoundDetector.h"
18+
#include "PokemonLZA/Inference/PokemonLZA_AlertEyeDetector.h"
1819
#include "PokemonLZA/Programs/PokemonLZA_BasicNavigation.h"
1920
#include "PokemonLZA_ShinyHunt_FlySpotReset.h"
2021

@@ -65,7 +66,7 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
6566
{Route::NO_MOVEMENT, "no_movement", "No Movement"},
6667
{Route::WILD_ZONE_19, "wild_zone_19", "Wild Zone 19"},
6768
{Route::ALPHA_PIDGEY, "alpha_pidgey", "Alpha Pidgey (Wild Zone 1)"},
68-
// {Route::ALPHA_PIKACHU, "alpha_pikachu", "Alpha Pikachu (Wild Zone 6)"},
69+
{Route::ALPHA_PIKACHU, "alpha_pikachu", "Alpha Pikachu (Wild Zone 6)"},
6970
// {Route::CUSTOMISED_MACRO, "customised_macro", "Customised Macro"},
7071
},
7172
LockMode::LOCK_WHILE_RUNNING,
@@ -177,6 +178,61 @@ void route_alpha_pidgey(
177178
wait_until_overworld(env.console, context);
178179
}
179180

181+
void route_alpha_pikachu(
182+
SingleSwitchProgramEnvironment& env,
183+
ProControllerContext& context,
184+
ShinyHunt_FlySpotReset_Descriptor::Stats& stats,
185+
bool to_zoom_to_max){
186+
int ret = -1;
187+
{
188+
BlackScreenOverWatcher black_screen(COLOR_BLUE);
189+
ret = run_until<ProControllerContext>(
190+
env.console, context,
191+
[&](ProControllerContext& context){
192+
ssf_press_button(context, BUTTON_B, 0ms, 500ms, 0ms);
193+
pbf_move_left_joystick(context, 0, 128, 2000ms, 0ms);
194+
pbf_move_left_joystick(context, 128, 0, 2700ms, 0ms);
195+
pbf_move_left_joystick(context, 255, 128, 1000ms, 0ms);
196+
pbf_mash_button(context, BUTTON_A, 500ms); // ladder
197+
pbf_move_left_joystick(context, 128, 0, 5300ms, 0ms);
198+
},
199+
{black_screen}
200+
);
201+
}
202+
if (ret == 0){
203+
wait_until_overworld(env.console, context, 50s);
204+
//TODO: reset game if still get caught by wild pokémon
205+
}
206+
{
207+
AlertEyeOverWatcher eye_watcher(COLOR_WHITE, &env.console.overlay());
208+
ret = run_until<ProControllerContext>(env.console, context, [&](ProControllerContext& context){
209+
pbf_move_left_joystick(context, 255, 128, 3600ms, 0ms);
210+
pbf_move_left_joystick(context, 128, 0, 3000ms, 0ms);
211+
}, {{eye_watcher}});
212+
}
213+
if (ret < 0){
214+
AlertEyeOverWatcher eye_watcher(COLOR_WHITE, &env.console.overlay());
215+
ret = wait_until(env.console, context, 30s, {{eye_watcher}});
216+
}
217+
if (ret < 0){
218+
OperationFailedException::fire(
219+
ErrorReport::SEND_ERROR_REPORT,
220+
"AlertEyeOverWatcher: Unable to fast travel after 30s",
221+
env.console);
222+
}
223+
open_map(env.console, context, to_zoom_to_max);
224+
pbf_move_left_joystick(context, 148, 20, 100ms, 200ms);
225+
if (fly_from_map(env.console, context) == FastTravelState::SUCCESS) {
226+
wait_until_overworld(env.console, context);
227+
return;
228+
} else {
229+
OperationFailedException::fire(
230+
ErrorReport::SEND_ERROR_REPORT,
231+
"fly_from_map(): Unable to fast travel",
232+
env.console);
233+
}
234+
}
235+
180236
} // namespace
181237

182238
void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
@@ -213,6 +269,9 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
213269
case Route::ALPHA_PIDGEY:
214270
route = route_alpha_pidgey;
215271
break;
272+
case Route::ALPHA_PIKACHU:
273+
route = route_alpha_pikachu;
274+
break;
216275
default:
217276
OperationFailedException::fire(
218277
ErrorReport::SEND_ERROR_REPORT,

0 commit comments

Comments
 (0)