Skip to content

Commit 3b9e662

Browse files
authored
Frlg lucky egg party fix (#1179)
* Checking the party menu in the safari zone building needs standard menu * Also check for remaining safari balls * spc
1 parent 3f2eb58 commit 3b9e662

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_LuckyEggFarmer.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_LuckyEggFarmer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class LuckyEggFarmer : public SingleSwitchProgramInstance {
4343
bool is_chansey(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
4444
bool find_encounter(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
4545
bool attempt_catch(SingleSwitchProgramEnvironment& env, ProControllerContext& context, int& balls_left);
46-
bool check_for_lucky_egg(ConsoleHandle& console, ProControllerContext& context);
46+
bool check_for_lucky_egg(ConsoleHandle& console, ProControllerContext& context, bool returned_to_building);
4747

4848
OCR::LanguageOCROption LANGUAGE;
4949

0 commit comments

Comments
 (0)