1313#include " CommonTools/StartupChecks/VideoResolutionCheck.h"
1414#include " NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
1515#include " NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
16+ #include " NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1617#include " Pokemon/Pokemon_Strings.h"
1718#include " PokemonLA/Inference/Sounds/PokemonLA_ShinySoundDetector.h"
1819#include " PokemonLZA/Programs/PokemonLZA_BasicNavigation.h"
@@ -71,6 +72,11 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
7172 LockMode::LOCK_WHILE_RUNNING,
7273 Route::NO_MOVEMENT
7374 )
75+ , NUM_RESETS(
76+ " <b>Resets:</b><br>Number of resets, for use when performing fly resets in Hyperspace Wild Zones. Each fly takes about 1 Cal. of time. Make sure to leave enough time to catch found shinies. Zero disables this option." ,
77+ LockMode::UNLOCK_WHILE_RUNNING,
78+ 0 , 0
79+ )
7480 , NOTIFICATION_STATUS(" Status Update" , true , false , std::chrono::seconds(3600 ))
7581 , NOTIFICATIONS({
7682 &NOTIFICATION_STATUS,
@@ -82,6 +88,7 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
8288{
8389 PA_ADD_STATIC (SHINY_REQUIRES_AUDIO);
8490 PA_ADD_OPTION (ROUTE);
91+ PA_ADD_OPTION (NUM_RESETS);
8592 PA_ADD_OPTION (SHINY_DETECTED);
8693 PA_ADD_OPTION (NOTIFICATIONS);
8794}
@@ -221,6 +228,7 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
221228 );
222229 }
223230
231+ uint64_t num_resets = 0 ;
224232 bool to_zoom_to_max = true ;
225233 run_until<ProControllerContext>(
226234 env.console , context,
@@ -230,11 +238,19 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
230238 shiny_sound_handler.process_pending (context);
231239 route (env, context, stats, to_zoom_to_max);
232240 to_zoom_to_max = false ;
241+ num_resets++;
233242 stats.resets ++;
234243 env.update_stats ();
235244 if (stats.resets .load (std::memory_order_relaxed) % 10 == 0 ){
236245 send_program_status_notification (env, NOTIFICATION_STATUS);
237246 }
247+
248+ uint64_t num_resets_temp = NUM_RESETS;
249+ if (num_resets_temp != 0 && num_resets >= num_resets_temp){
250+ env.log (" Number of resets hit. Going to home to pause the game." );
251+ go_home (env.console , context);
252+ break ;
253+ }
238254 } // end while
239255 },
240256 {{shiny_detector}}
0 commit comments