Skip to content

Commit c079fb7

Browse files
kichithewolfGin890
authored andcommitted
za fly spot num of resets option
1 parent 753fa40 commit c079fb7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
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}}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef PokemonAutomation_PokemonLZA_ShinyHunt_FlySpotReset_H
1010
#define PokemonAutomation_PokemonLZA_ShinyHunt_FlySpotReset_H
1111

12+
#include "Common/Cpp/Options/SimpleIntegerOption.h"
1213
#include "CommonFramework/Notifications/EventNotificationsTable.h"
1314
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
1415
#include "PokemonLA/Options/PokemonLA_ShinyDetectedAction.h"
@@ -47,6 +48,7 @@ class ShinyHunt_FlySpotReset : public SingleSwitchProgramInstance{
4748
PokemonLA::ShinyRequiresAudioText SHINY_REQUIRES_AUDIO;
4849
ShinySoundDetectedActionOption SHINY_DETECTED;
4950
EnumDropdownOption<Route> ROUTE;
51+
SimpleIntegerOption<uint64_t> NUM_RESETS;
5052

5153
EventNotificationOption NOTIFICATION_STATUS;
5254
EventNotificationsOption NOTIFICATIONS;

0 commit comments

Comments
 (0)