@@ -155,6 +155,7 @@ void LegendaryHuntEmerald::reset_groudon(SingleSwitchProgramEnvironment& env, Sw
155155 // Turn left. Take 4 steps.
156156 ssf_press_button (context, BUTTON_B, 0 , 80 );
157157 pbf_press_dpad (context, DPAD_LEFT, 80 , 20 );
158+ context.wait_for_all_requests ();
158159
159160 // Turn down. Exit. Black screen over.
160161 BlackScreenOverWatcher exit_area (COLOR_RED, {0.282 , 0.064 , 0.448 , 0.871 });
@@ -222,7 +223,96 @@ void LegendaryHuntEmerald::reset_groudon(SingleSwitchProgramEnvironment& env, Sw
222223}
223224
224225void LegendaryHuntEmerald::reset_kyogre (SingleSwitchProgramEnvironment& env, SwitchControllerContext& context) {
226+ // Turn down. Take 1 step.
227+ ssf_press_button (context, BUTTON_B, 0 , 20 );
228+ pbf_press_dpad (context, DPAD_DOWN, 20 , 20 );
229+
230+ // Turn right. Take 9 steps.
231+ ssf_press_button (context, BUTTON_B, 0 , 160 );
232+ pbf_press_dpad (context, DPAD_RIGHT, 160 , 20 );
233+
234+ // Turn up. 13 steps. Wall.
235+ ssf_press_button (context, BUTTON_B, 0 , 220 );
236+ pbf_press_dpad (context, DPAD_UP, 220 , 20 );
237+
238+ // Turn left. 4 steps. Wall.
239+ ssf_press_button (context, BUTTON_B, 0 , 80 );
240+ pbf_press_dpad (context, DPAD_LEFT, 80 , 20 );
241+
242+ // Turn up. 10 steps.
243+ ssf_press_button (context, BUTTON_B, 0 , 180 );
244+ pbf_press_dpad (context, DPAD_UP, 180 , 20 );
245+
246+ // Turn right. 6 steps.
247+ ssf_press_button (context, BUTTON_B, 0 , 110 );
248+ pbf_press_dpad (context, DPAD_RIGHT, 110 , 20 );
249+
250+ // Turn down. Exit. Black screen over.
251+ BlackScreenOverWatcher exit_area (COLOR_RED, {0.282 , 0.064 , 0.448 , 0.871 });
252+ int ret = run_until<SwitchControllerContext>(
253+ env.console , context,
254+ [](SwitchControllerContext& context){
255+ ssf_press_button (context, BUTTON_B, 0 , 90 );
256+ pbf_press_dpad (context, DPAD_DOWN, 90 , 20 );
257+ pbf_wait (context, 300 );
258+ },
259+ {exit_area}
260+ );
261+ context.wait_for_all_requests ();
262+ if (ret != 0 ){
263+ env.log (" Failed to exit area." , COLOR_RED);
264+ OperationFailedException::fire (
265+ ErrorReport::SEND_ERROR_REPORT,
266+ " Failed to exit area." ,
267+ env.console
268+ );
269+ }
270+ else {
271+ env.log (" Left area." );
272+ }
273+
274+ BlackScreenOverWatcher enter_area (COLOR_RED, {0.282 , 0.064 , 0.448 , 0.871 });
275+ int ret2 = run_until<SwitchControllerContext>(
276+ env.console , context,
277+ [](SwitchControllerContext& context){
278+ ssf_press_button (context, BUTTON_B, 0 , 90 );
279+ pbf_press_dpad (context, DPAD_UP, 90 , 20 );
280+ pbf_wait (context, 300 );
281+ },
282+ {enter_area}
283+ );
284+ context.wait_for_all_requests ();
285+ if (ret2 != 0 ){
286+ env.log (" Failed to enter area." , COLOR_RED);
287+ OperationFailedException::fire (
288+ ErrorReport::SEND_ERROR_REPORT,
289+ " Failed to enter area." ,
290+ env.console
291+ );
292+ }
293+ else {
294+ env.log (" Entered area." );
295+ }
225296
297+ ssf_press_button (context, BUTTON_B, 0 , 110 );
298+ pbf_press_dpad (context, DPAD_LEFT, 110 , 20 );
299+
300+ ssf_press_button (context, BUTTON_B, 0 , 180 );
301+ pbf_press_dpad (context, DPAD_DOWN, 180 , 20 );
302+
303+ ssf_press_button (context, BUTTON_B, 0 , 80 );
304+ pbf_press_dpad (context, DPAD_RIGHT, 80 , 20 );
305+
306+ ssf_press_button (context, BUTTON_B, 0 , 220 );
307+ pbf_press_dpad (context, DPAD_DOWN, 220 , 20 );
308+
309+ ssf_press_button (context, BUTTON_B, 0 , 160 );
310+ pbf_press_dpad (context, DPAD_LEFT, 160 , 20 );
311+
312+ ssf_press_button (context, BUTTON_B, 0 , 20 );
313+ pbf_press_dpad (context, DPAD_UP, 20 , 20 );
314+
315+ context.wait_for_all_requests ();
226316}
227317
228318void LegendaryHuntEmerald::reset_hooh (SingleSwitchProgramEnvironment& env, SwitchControllerContext& context) {
@@ -373,15 +463,17 @@ void LegendaryHuntEmerald::program(SingleSwitchProgramEnvironment& env, SwitchCo
373463 while (true ) {
374464 switch (TARGET) {
375465 case Target::hooh:
466+ case Target::kyogre:
467+ case Target::groudon:
376468 // Step forward to start the encounter.
377469 pbf_press_dpad (context, DPAD_UP, 20 , 50 );
378470 break ;
379- case Target::groudon:
380- pbf_press_dpad (context, DPAD_RIGHT, 20 , 50 );
381- break ;
382- case Target::kyogre:
383- pbf_press_dpad (context, DPAD_LEFT, 20 , 50 );
384- break ;
471+ // case Target::groudon: //Step up is easier.
472+ // pbf_press_dpad(context, DPAD_RIGHT, 20, 50);
473+ // break;
474+ // case Target::kyogre:
475+ // pbf_press_dpad(context, DPAD_LEFT, 20, 50);
476+ // break;
385477 }
386478 // handle_encounter presses A already for everything else
387479
@@ -409,6 +501,7 @@ void LegendaryHuntEmerald::program(SingleSwitchProgramEnvironment& env, SwitchCo
409501 break ;
410502 case Target::kyogre:
411503 reset_kyogre (env, context);
504+ break ;
412505 case Target::hooh:
413506 reset_hooh (env, context);
414507 break ;
0 commit comments