Skip to content

Commit d21958a

Browse files
committed
fixes
1 parent 0bf25f9 commit d21958a

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_MegaShardFarmer.cpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
*/
66

7+
#include "CommonFramework/GlobalSettingsPanel.h"
78
#include "CommonFramework/ProgramStats/StatsTracking.h"
89
#include "CommonTools/Async/InferenceRoutines.h"
910
#include "CommonTools/VisualDetectors/BlackScreenDetector.h"
@@ -53,7 +54,17 @@ std::unique_ptr<StatsTracker> MegaShardFarmer_Descriptor::make_stats() const{
5354

5455

5556

56-
MegaShardFarmer::MegaShardFarmer(){}
57+
MegaShardFarmer::MegaShardFarmer()
58+
: SKIP_SHARDS(
59+
"<b>Skip getting Shards (for testing purposes):</b>",
60+
LockMode::UNLOCK_WHILE_RUNNING,
61+
false
62+
)
63+
{
64+
if (PreloadSettings::instance().DEVELOPER_MODE){
65+
PA_ADD_OPTION(SKIP_SHARDS);
66+
}
67+
}
5768

5869
void MegaShardFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
5970
MegaShardFarmer_Descriptor::Stats& stats = env.current_stats<MegaShardFarmer_Descriptor::Stats>();
@@ -95,15 +106,15 @@ void MegaShardFarmer::program(SingleSwitchProgramEnvironment& env, ProController
95106
// Bring out a Pokemon.
96107
pbf_press_dpad(context, DPAD_UP, 1000ms, 0ms);
97108

98-
#if 1
99-
// Break all the shards.
100-
uint8_t x = stats.rounds % 2 == 0 ? 128 - 32 : 128 + 32;
101-
ssf_press_right_joystick(context, x, 128, 0ms, 40000ms, 0ms);
102-
for (int c = 0; c < 40; c++){
103-
ssf_press_button(context, BUTTON_ZL, 240ms, 400ms, 80ms);
104-
pbf_press_button(context, BUTTON_B, 160ms, 520ms);
109+
if (!SKIP_SHARDS){
110+
// Break all the shards.
111+
uint8_t x = stats.rounds % 2 == 0 ? 128 - 32 : 128 + 32;
112+
ssf_press_right_joystick(context, x, 128, 0ms, 40000ms, 0ms);
113+
for (int c = 0; c < 40; c++){
114+
ssf_press_button(context, BUTTON_ZL, 240ms, 400ms, 80ms);
115+
pbf_press_button(context, BUTTON_B, 160ms, 520ms);
116+
}
105117
}
106-
#endif
107118
},
108119
{{black_screen}}
109120
);
@@ -128,8 +139,8 @@ void MegaShardFarmer::fly_back(SingleSwitchProgramEnvironment& env, ProControlle
128139
pbf_move_right_joystick(context, 128, 255, 80ms, 80ms);
129140

130141
// Tap the stick to lock on to Le Yeah if you're already on top of it.
131-
pbf_move_left_joystick(context, 32, 128, 40ms, 500ms);
132-
// pbf_move_left_joystick(context, 128, 255, 80ms, 500ms);
142+
pbf_move_left_joystick(context, 128, 192, 40ms, 120ms);
143+
pbf_move_left_joystick(context, 128, 64, 40ms, 500ms);
133144

134145
BlackScreenOverWatcher black_screen(COLOR_BLUE, {0.1, 0.1, 0.8, 0.2});
135146

SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_MegaShardFarmer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef PokemonAutomation_PokemonLZA_MegaShardFarmer_H
88
#define PokemonAutomation_PokemonLZA_MegaShardFarmer_H
99

10+
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
1011
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
1112

1213
namespace PokemonAutomation{
@@ -32,7 +33,7 @@ class MegaShardFarmer : public SingleSwitchProgramInstance{
3233
private:
3334
void fly_back(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
3435

35-
36+
BooleanCheckBoxOption SKIP_SHARDS;
3637
};
3738

3839

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ void enter_wild_zone_entrance(
125125
);
126126
if (ret == 0){
127127
env.console.log("[WildZoneEntrance] Detected day/night change after entering.");
128+
ShinyHunt_WildZoneEntrance_Descriptor::Stats& stats =
129+
env.current_stats<ShinyHunt_WildZoneEntrance_Descriptor::Stats>();
130+
stats.day_changes++;
128131
context.wait_for(std::chrono::milliseconds(2000));
129132
pbf_mash_button(context, BUTTON_B, 200ms); // dismiss menu if any
130133
pbf_press_button(context, BUTTON_PLUS, 100ms, 100ms); // open map again
131134
}else{
132-
ShinyHunt_WildZoneEntrance_Descriptor::Stats& stats =
133-
env.current_stats<ShinyHunt_WildZoneEntrance_Descriptor::Stats>();
134-
stats.day_changes++;
135135
}
136136
pbf_mash_button(context, BUTTON_A, 800ms); // teleporting or just mashing button
137137
pbf_mash_button(context, BUTTON_B, 200ms); // in case need to dismiss map

0 commit comments

Comments
 (0)