|
15 | 15 | #include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h" |
16 | 16 | #include "Pokemon/Pokemon_Strings.h" |
17 | 17 | #include "PokemonLA/Inference/Sounds/PokemonLA_ShinySoundDetector.h" |
| 18 | +#include "PokemonLZA/Inference/PokemonLZA_AlertEyeDetector.h" |
18 | 19 | #include "PokemonLZA/Programs/PokemonLZA_BasicNavigation.h" |
19 | 20 | #include "PokemonLZA_ShinyHunt_FlySpotReset.h" |
20 | 21 |
|
@@ -65,7 +66,7 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset() |
65 | 66 | {Route::NO_MOVEMENT, "no_movement", "No Movement"}, |
66 | 67 | {Route::WILD_ZONE_19, "wild_zone_19", "Wild Zone 19"}, |
67 | 68 | {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)"}, |
69 | 70 | // {Route::CUSTOMISED_MACRO, "customised_macro", "Customised Macro"}, |
70 | 71 | }, |
71 | 72 | LockMode::LOCK_WHILE_RUNNING, |
@@ -177,6 +178,61 @@ void route_alpha_pidgey( |
177 | 178 | wait_until_overworld(env.console, context); |
178 | 179 | } |
179 | 180 |
|
| 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 | + |
180 | 236 | } // namespace |
181 | 237 |
|
182 | 238 | void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){ |
@@ -213,6 +269,9 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon |
213 | 269 | case Route::ALPHA_PIDGEY: |
214 | 270 | route = route_alpha_pidgey; |
215 | 271 | break; |
| 272 | + case Route::ALPHA_PIKACHU: |
| 273 | + route = route_alpha_pikachu; |
| 274 | + break; |
216 | 275 | default: |
217 | 276 | OperationFailedException::fire( |
218 | 277 | ErrorReport::SEND_ERROR_REPORT, |
|
0 commit comments