Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ bool LuckyEggFarmer::find_encounter(SingleSwitchProgramEnvironment& env, ProCont
context.wait_for_all_requests();

BlackScreenWatcher battle_entered(COLOR_RED);
AdvanceBattleDialogWatcher battle_dialog(COLOR_RED);

// This could be removed if spin in place stops drifting.
AdvanceWhiteDialogWatcher out_of_steps(COLOR_RED);
Expand All @@ -239,13 +240,13 @@ bool LuckyEggFarmer::find_encounter(SingleSwitchProgramEnvironment& env, ProCont
pbf_move_left_joystick(context, { -1, 0 }, 33ms, 150ms);
context.wait_for_all_requests();
},
{ battle_entered, out_of_steps }
{ battle_entered, out_of_steps, battle_dialog }
);

pbf_wait(context, 100ms);
context.wait_for_all_requests();

if (ret == 0) {
if (ret == 0 || ret == 2) {
env.log("Battle entered.");
return true;
}
Expand Down Expand Up @@ -456,6 +457,15 @@ bool LuckyEggFarmer::run_safari_zone(SingleSwitchProgramEnvironment& env, ProCon
env.log("Lucky Egg found!");
stats.eggs++;
env.update_stats();
send_program_notification(
env,
NOTIFICATION_PROGRAM_FINISH,
COLOR_YELLOW,
"Lucky Egg found!",
{}, "",
env.console.video().snapshot(),
true
);
return true;
}
env.log("Lucky Egg not found. Continuing to farm...");
Expand Down Expand Up @@ -527,7 +537,8 @@ void LuckyEggFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerC
swap_lead_pokemon(env.console, context);

if (run_safari_zone(env, context)) {
break;
GO_HOME_WHEN_DONE.run_end_of_program(context);
return; // Already sent notification in run_safari_zone if shiny or lucky egg found.
}

soft_reset(env.console, context);
Expand Down