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"
@@ -72,6 +73,11 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
7273 LockMode::LOCK_WHILE_RUNNING,
7374 Route::NO_MOVEMENT
7475 )
76+ , NUM_RESETS(
77+ " <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." ,
78+ LockMode::UNLOCK_WHILE_RUNNING,
79+ 0 , 0
80+ )
7581 , NOTIFICATION_STATUS(" Status Update" , true , false , std::chrono::seconds(3600 ))
7682 , NOTIFICATIONS({
7783 &NOTIFICATION_STATUS,
@@ -83,6 +89,7 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
8389{
8490 PA_ADD_STATIC (SHINY_REQUIRES_AUDIO);
8591 PA_ADD_OPTION (ROUTE);
92+ PA_ADD_OPTION (NUM_RESETS);
8693 PA_ADD_OPTION (SHINY_DETECTED);
8794 PA_ADD_OPTION (NOTIFICATIONS);
8895}
@@ -245,6 +252,7 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
245252 );
246253 }
247254
255+ uint64_t num_resets = 0 ;
248256 bool to_zoom_to_max = true ;
249257 run_until<ProControllerContext>(
250258 env.console , context,
@@ -254,11 +262,19 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
254262 shiny_sound_handler.process_pending (context);
255263 route (env, context, stats, to_zoom_to_max);
256264 to_zoom_to_max = false ;
265+ num_resets++;
257266 stats.resets ++;
258267 env.update_stats ();
259268 if (stats.resets .load (std::memory_order_relaxed) % 10 == 0 ){
260269 send_program_status_notification (env, NOTIFICATION_STATUS);
261270 }
271+
272+ uint64_t num_resets_temp = NUM_RESETS;
273+ if (num_resets_temp != 0 && num_resets >= num_resets_temp){
274+ env.log (" Number of resets hit. Going to home to pause the game." );
275+ go_home (env.console , context);
276+ break ;
277+ }
262278 } // end while
263279 },
264280 {{shiny_detector}}
0 commit comments