Skip to content

Commit e5fd895

Browse files
committed
ho-oh
1 parent 9566813 commit e5fd895

File tree

2 files changed

+69
-17
lines changed

2 files changed

+69
-17
lines changed

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

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,73 @@ LegendaryHuntEmerald::LegendaryHuntEmerald()
7777
PA_ADD_OPTION(NOTIFICATIONS);
7878
}
7979

80+
void LegendaryHuntEmerald::reset_hooh(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context) {
81+
BlackScreenOverWatcher exit_area(COLOR_RED, {0.282, 0.064, 0.448, 0.871});
82+
//Turn around, 10 steps down
83+
ssf_press_button(context, BUTTON_B, 0, 180);
84+
pbf_press_dpad(context, DPAD_DOWN, 180, 20);
85+
86+
//Turn right, take 1 step. Wait for black screen over.
87+
int ret = run_until<SwitchControllerContext>(
88+
env.console, context,
89+
[](SwitchControllerContext& context){
90+
ssf_press_button(context, BUTTON_B, 0, 30);
91+
pbf_press_dpad(context, DPAD_RIGHT, 30, 20);
92+
pbf_wait(context, 300);
93+
},
94+
{exit_area}
95+
);
96+
context.wait_for_all_requests();
97+
if (ret != 0){
98+
env.log("Failed to exit area.", COLOR_RED);
99+
OperationFailedException::fire(
100+
ErrorReport::SEND_ERROR_REPORT,
101+
"Failed to exit area.",
102+
env.console
103+
);
104+
}
105+
else {
106+
env.log("Left area.");
107+
}
108+
109+
BlackScreenOverWatcher enter_area(COLOR_RED, {0.282, 0.064, 0.448, 0.871});
110+
//turn left, take one step. now turn back right and take a step. wait for black screen over.
111+
int ret2 = run_until<SwitchControllerContext>(
112+
env.console, context,
113+
[](SwitchControllerContext& context){
114+
ssf_press_button(context, BUTTON_B, 0, 40);
115+
pbf_press_dpad(context, DPAD_LEFT, 40, 20);
116+
117+
ssf_press_button(context, BUTTON_B, 0, 40);
118+
pbf_press_dpad(context, DPAD_RIGHT, 40, 20);
119+
pbf_wait(context, 300);
120+
},
121+
{enter_area}
122+
);
123+
context.wait_for_all_requests();
124+
if (ret2 != 0){
125+
env.log("Failed to enter area.", COLOR_RED);
126+
OperationFailedException::fire(
127+
ErrorReport::SEND_ERROR_REPORT,
128+
"Failed to enter area.",
129+
env.console
130+
);
131+
}
132+
else {
133+
env.log("Entered area.");
134+
}
135+
136+
//reverse above steps, but only take 9 steps up
137+
//doesn't really matter since we want to trigger the encounter anyway
138+
ssf_press_button(context, BUTTON_B, 0, 30);
139+
pbf_press_dpad(context, DPAD_LEFT, 30, 20);
140+
141+
ssf_press_button(context, BUTTON_B, 0, 170);
142+
pbf_press_dpad(context, DPAD_UP, 170, 20);
143+
144+
context.wait_for_all_requests();
145+
}
146+
80147
void LegendaryHuntEmerald::reset_lugia(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context) {
81148
BlackScreenOverWatcher exit_area(COLOR_RED, {0.282, 0.064, 0.448, 0.871});
82149
//Turn around, 5 steps down
@@ -195,23 +262,7 @@ void LegendaryHuntEmerald::program(SingleSwitchProgramEnvironment& env, SwitchCo
195262

196263
break;
197264
case Target::hooh:
198-
//Turn around
199-
200-
//10 steps down
201-
202-
//Turn right
203-
204-
//Take one step
205-
206-
//Wait for black screen over
207-
208-
//Turn left and take a step
209-
210-
//now turn right and take a step
211-
212-
//wait for black screen over
213-
214-
//now reverse the above, but only take 9 steps up
265+
reset_hooh(env, context);
215266
break;
216267
case Target::lugia:
217268
reset_lugia(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_hooh(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context);
4445
void reset_lugia(SingleSwitchProgramEnvironment& env, SwitchControllerContext& context);
4546
};
4647

0 commit comments

Comments
 (0)