Skip to content

Commit 4e97107

Browse files
committed
za fly spot num of resets option
1 parent e5e00f2 commit 4e97107

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"
@@ -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}}

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"
@@ -46,6 +47,7 @@ class ShinyHunt_FlySpotReset : public SingleSwitchProgramInstance{
4647
PokemonLA::ShinyRequiresAudioText SHINY_REQUIRES_AUDIO;
4748
ShinySoundDetectedActionOption SHINY_DETECTED;
4849
EnumDropdownOption<Route> ROUTE;
50+
SimpleIntegerOption<uint64_t> NUM_RESETS;
4951

5052
EventNotificationOption NOTIFICATION_STATUS;
5153
EventNotificationsOption NOTIFICATIONS;

0 commit comments

Comments
 (0)