@@ -360,8 +360,14 @@ bool LuckyEggFarmer::attempt_catch(SingleSwitchProgramEnvironment& env, ProContr
360360 }
361361}
362362
363- bool LuckyEggFarmer::check_for_lucky_egg (ConsoleHandle& console, ProControllerContext& context) {
364- open_party_menu_from_overworld (console, context, StartMenuContext::SAFARI_ZONE);
363+ bool LuckyEggFarmer::check_for_lucky_egg (ConsoleHandle& console, ProControllerContext& context, bool returned_to_building) {
364+ if (returned_to_building) {
365+ open_party_menu_from_overworld (console, context, StartMenuContext::STANDARD);
366+ }
367+ else {
368+ open_party_menu_from_overworld (console, context, StartMenuContext::SAFARI_ZONE);
369+ }
370+
365371 PartyHeldItemDetector held_item_detector (COLOR_RED, &console.overlay (), ImageFloatBox (0.432 , 0.3 , 0.030 , 0.485 ));
366372 if (held_item_detector.detect (console.video ().snapshot ())) {
367373 return true ;
@@ -469,6 +475,10 @@ void LuckyEggFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerC
469475
470476 WhiteDialogDetector dialog (COLOR_RED);
471477 bool in_safari_zone_building = dialog.detect (env.console .video ().snapshot ());
478+
479+ if (balls_left <= 0 ) {
480+ in_safari_zone_building = true ;
481+ }
472482
473483 if (in_safari_zone_building && !caught) {
474484 break ;
@@ -480,7 +490,7 @@ void LuckyEggFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerC
480490 }
481491
482492 if (caught) {
483- if (check_for_lucky_egg (env.console , context)) {
493+ if (check_for_lucky_egg (env.console , context, in_safari_zone_building )) {
484494 env.log (" Lucky Egg found!" );
485495 stats.eggs ++;
486496 env.update_stats ();
0 commit comments