Skip to content

Commit 3fe87c2

Browse files
committed
regis
1 parent e5fd895 commit 3fe87c2

File tree

2 files changed

+60
-17
lines changed

2 files changed

+60
-17
lines changed

SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_LegendaryHunt-Emerald.cpp

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ std::unique_ptr<StatsTracker> LegendaryHuntEmerald_Descriptor::make_stats() cons
5151

5252
LegendaryHuntEmerald::LegendaryHuntEmerald()
5353
: TARGET(
54-
"<b>Starter:</b><br>",
54+
"<b>Target:</b><br>",
5555
{
5656
{Target::regis, "regis", "Regirock/Regice/Registeel"},
5757
{Target::hooh, "hooh", "Ho-Oh"},
@@ -77,6 +77,61 @@ LegendaryHuntEmerald::LegendaryHuntEmerald()
7777
PA_ADD_OPTION(NOTIFICATIONS);
7878
}
7979

80+
void LegendaryHuntEmerald::reset_regi(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context) {
81+
//turn around, walk down 4/until black screen over
82+
BlackScreenOverWatcher exit_area(COLOR_RED, {0.282, 0.064, 0.448, 0.871});
83+
BlackScreenOverWatcher enter_area(COLOR_RED, {0.282, 0.064, 0.448, 0.871});
84+
int ret = run_until<SwitchControllerContext>(
85+
env.console, context,
86+
[](SwitchControllerContext& context){
87+
ssf_press_button(context, BUTTON_B, 0, 120);
88+
pbf_press_dpad(context, DPAD_DOWN, 120, 20);
89+
pbf_wait(context, 300);
90+
},
91+
{exit_area}
92+
);
93+
context.wait_for_all_requests();
94+
if (ret != 0){
95+
env.log("Failed to exit area.", COLOR_RED);
96+
OperationFailedException::fire(
97+
ErrorReport::SEND_ERROR_REPORT,
98+
"Failed to exit area.",
99+
env.console
100+
);
101+
}
102+
else {
103+
env.log("Left area.");
104+
}
105+
pbf_wait(context, 50);
106+
context.wait_for_all_requests();
107+
108+
//turn around, up one/black screen over
109+
int ret2 = run_until<SwitchControllerContext>(
110+
env.console, context,
111+
[](SwitchControllerContext& context){
112+
pbf_press_dpad(context, DPAD_UP, 120, 20);
113+
pbf_wait(context, 300);
114+
},
115+
{enter_area}
116+
);
117+
context.wait_for_all_requests();
118+
if (ret2 != 0){
119+
env.log("Failed to enter area.", COLOR_RED);
120+
OperationFailedException::fire(
121+
ErrorReport::SEND_ERROR_REPORT,
122+
"Failed to enter area.",
123+
env.console
124+
);
125+
}
126+
else {
127+
env.log("Entered area.");
128+
}
129+
130+
//walk back up to the regi
131+
ssf_press_button(context, BUTTON_B, 0, 60);
132+
pbf_press_dpad(context, DPAD_UP, 60, 20);
133+
}
134+
80135
void LegendaryHuntEmerald::reset_hooh(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context) {
81136
BlackScreenOverWatcher exit_area(COLOR_RED, {0.282, 0.064, 0.448, 0.871});
82137
//Turn around, 10 steps down
@@ -228,11 +283,7 @@ void LegendaryHuntEmerald::program(SingleSwitchProgramEnvironment& env, SwitchCo
228283
//Step forward to start the encounter.
229284
pbf_press_dpad(context, DPAD_UP, 10, 50);
230285
}
231-
else {
232-
//All other legendaries.
233-
pbf_press_button(context, BUTTON_A, 20, 40);
234-
}
235-
286+
236287
bool legendary_shiny = handle_encounter(env.console, context, true);
237288
if (legendary_shiny) {
238289
stats.shinies++;
@@ -242,24 +293,15 @@ void LegendaryHuntEmerald::program(SingleSwitchProgramEnvironment& env, SwitchCo
242293
}
243294
env.log("No shiny found.");
244295
flee_battle(env.console, context);
245-
296+
246297
//Close out dialog box
247298
pbf_mash_button(context, BUTTON_B, 250);
248299
context.wait_for_all_requests();
249300

250301
//Exit and re-enter the room
251302
switch (TARGET) {
252303
case Target::regis:
253-
//turn around, walk down 4
254-
255-
//black screen over
256-
257-
//turn around, up one
258-
259-
//black screen over
260-
261-
//reverse the above
262-
304+
reset_regi(env, context);
263305
break;
264306
case Target::hooh:
265307
reset_hooh(env, context);

SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_LegendaryHunt-Emerald.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class LegendaryHuntEmerald : public SingleSwitchProgramInstance{
4141
EventNotificationOption NOTIFICATION_STATUS_UPDATE;
4242
EventNotificationsOption NOTIFICATIONS;
4343

44+
void reset_regi(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context);
4445
void reset_hooh(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context);
4546
void reset_lugia(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context);
4647
};

0 commit comments

Comments
 (0)