Skip to content
Merged
Show file tree
Hide file tree
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 @@ -360,8 +360,14 @@ bool LuckyEggFarmer::attempt_catch(SingleSwitchProgramEnvironment& env, ProContr
}
}

bool LuckyEggFarmer::check_for_lucky_egg(ConsoleHandle& console, ProControllerContext& context) {
open_party_menu_from_overworld(console, context, StartMenuContext::SAFARI_ZONE);
bool LuckyEggFarmer::check_for_lucky_egg(ConsoleHandle& console, ProControllerContext& context, bool returned_to_building) {
if (returned_to_building) {
open_party_menu_from_overworld(console, context, StartMenuContext::STANDARD);
}
else {
open_party_menu_from_overworld(console, context, StartMenuContext::SAFARI_ZONE);
}

PartyHeldItemDetector held_item_detector(COLOR_RED, &console.overlay(), ImageFloatBox(0.432, 0.3, 0.030, 0.485));
if (held_item_detector.detect(console.video().snapshot())) {
return true;
Expand Down Expand Up @@ -469,6 +475,10 @@ void LuckyEggFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerC

WhiteDialogDetector dialog(COLOR_RED);
bool in_safari_zone_building = dialog.detect(env.console.video().snapshot());

if (balls_left <= 0) {
in_safari_zone_building = true;
}

if (in_safari_zone_building && !caught) {
break;
Expand All @@ -480,7 +490,7 @@ void LuckyEggFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerC
}

if (caught) {
if (check_for_lucky_egg(env.console, context)) {
if (check_for_lucky_egg(env.console, context, in_safari_zone_building)) {
env.log("Lucky Egg found!");
stats.eggs++;
env.update_stats();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LuckyEggFarmer : public SingleSwitchProgramInstance {
bool is_chansey(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
bool find_encounter(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
bool attempt_catch(SingleSwitchProgramEnvironment& env, ProControllerContext& context, int& balls_left);
bool check_for_lucky_egg(ConsoleHandle& console, ProControllerContext& context);
bool check_for_lucky_egg(ConsoleHandle& console, ProControllerContext& context, bool returned_to_building);

OCR::LanguageOCROption LANGUAGE;

Expand Down