From b50e3fd8947599cbfcf3b14a4d250a27ada85378 Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Sat, 14 Feb 2026 20:33:02 +0100 Subject: [PATCH 1/4] Movement according which of the 2 trainers is available --- .../PokemonBDSP_MoneyFarmerRoute210.cpp | 60 ++++++++++++++++++- .../Farming/PokemonBDSP_MoneyFarmerRoute210.h | 8 +++ .../PokemonSwSh_MaxLair_Run_CaughtScreen.cpp | 8 ++- 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp index bc740d1b4b..06460da9ba 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp @@ -19,6 +19,10 @@ #include "PokemonBDSP/Inference/Battles/PokemonBDSP_EndBattleDetector.h" #include "PokemonBDSP_MoneyFarmerRoute210.h" +#include "CommonFramework/ImageTools/ImageBoxes.h" +#include +#include + namespace PokemonAutomation{ namespace NintendoSwitch{ namespace PokemonBDSP{ @@ -245,6 +249,56 @@ bool MoneyFarmerRoute210::battle(SingleSwitchProgramEnvironment& env, ProControl ); } +void MoneyFarmerRoute210::move_to_trainer(SingleSwitchProgramEnvironment& env, ProControllerContext& context, const std::vector& bubbles +){ + + const ImagePixelBox* closest = nullptr; + double best_dist_sq = std::numeric_limits::max(); + + // Calculate the distance between the character and the closest box + for (const auto& box : bubbles) { + double dx = box.min_x - 540.0; + double dy = box.min_y - 163.0; + double dist_sq = dx*dx + dy*dy; + + if (dist_sq < best_dist_sq) { + best_dist_sq = dist_sq; + closest = &box; + } + } + + if (!closest) return; + + if (closest->min_x < 350) { + // The trainer who wants to battle is to the far-left, behind the other trainer + pbf_press_dpad(context, DPAD_UP, 300ms, 0ms); + pbf_press_dpad(context, DPAD_LEFT, 500ms, 0ms); + pbf_mash_button(context, BUTTON_A, 1000ms); + pbf_press_dpad(context, DPAD_DOWN, 300ms, 0ms); + pbf_mash_button(context, BUTTON_A, 1000ms); + } else if (closest->min_x < 450) { + // The trainer who wants to battle is on the character's left + if (closest->min_y < 110) { + // The trainer who wants to battle is one step above us + pbf_press_dpad(context, DPAD_UP, 300ms, 0ms); + pbf_press_dpad(context, DPAD_LEFT, 300ms, 0ms); + } else { + // The trainer who wants to battle is on our left, right next to us + pbf_press_dpad(context, DPAD_LEFT, 300ms, 0ms); + } + } else if (closest->min_x < 560) { + // The trainer who wants to battle is right above us + pbf_press_dpad(context, DPAD_UP, 300ms, 0ms); + } else { + // The trainer who wants to battle is above us, one step to our right + pbf_press_dpad(context, DPAD_RIGHT, 300ms, 0ms); + pbf_press_dpad(context, DPAD_UP, 300ms, 0ms); + } + + pbf_mash_button(context, BUTTON_A, 1000ms); + +} + void MoneyFarmerRoute210::heal_at_center_and_return( Logger& logger, ProControllerContext& context, uint8_t pp0[4], uint8_t pp1[4] @@ -410,10 +464,14 @@ void MoneyFarmerRoute210::program(SingleSwitchProgramEnvironment& env, ProContro stats.m_react++; } for (const ImagePixelBox& box : bubbles){ - env.log("Reaction at: " + std::to_string(box.min_x), COLOR_BLUE); + env.log("Reaction at X: " + std::to_string(box.min_x) + "Y: " + std::to_string(box.min_y), COLOR_BLUE); + } + if (!bubbles.empty()) { + move_to_trainer(env, context, bubbles); } if (this->battle(env, context, pp0, pp1)){ + env.update_stats(); return; } if (!has_pp(pp0, pp1)){ diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.h b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.h index 9c735d2014..02938aec6d 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.h @@ -14,6 +14,9 @@ #include "PokemonBDSP/Options/PokemonBDSP_ShortcutDirection.h" #include "PokemonBDSP/Options/PokemonBDSP_LearnMove.h" +#include "CommonFramework/ImageTools/ImageBoxes.h" +#include + namespace PokemonAutomation{ namespace NintendoSwitch{ namespace PokemonBDSP{ @@ -38,6 +41,11 @@ class MoneyFarmerRoute210 : public SingleSwitchProgramInstance{ bool battle(SingleSwitchProgramEnvironment& env, ProControllerContext& context, uint8_t pp0[4], uint8_t pp1[4]); // From the bottom row of the Ace Trainer pair, heal Pokemon and return. // Return true if VS Seeker needs charging. + void move_to_trainer( + SingleSwitchProgramEnvironment& env, + ProControllerContext& context, + const std::vector& bubbles + ); bool heal_after_battle_and_return( SingleSwitchProgramEnvironment& env, VideoStream& stream, ProControllerContext& context, diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp index 4e849c5833..73faa9aac9 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp @@ -217,7 +217,7 @@ StateMachineAction run_caught_screen( if (is_host){ runtime.path_stats.clear(); } - if (shinies.empty() || shinies[0] == 3){ + if (shinies.empty()){ console.log("Quitting back to entrance.", COLOR_PURPLE); tracker.leave_summary(); synchronize_caught_screen(console_index, console, context, state_tracker); @@ -226,8 +226,10 @@ StateMachineAction run_caught_screen( pbf_press_button(context, BUTTON_A, 80ms, 920ms); return mash_A_to_entrance(runtime, console, context, entrance); }else{ - console.log("Taking non-shiny boss and returning to entrance...", COLOR_BLUE); - tracker.scroll_to(shinies[0]); + + size_t take_index = shinies.back(); + console.log("Taking shiny at slot " + std::to_string(take_index) + " and returning to entrance...", COLOR_BLUE); + tracker.scroll_to(take_index); tracker.enter_summary(); // Enter summary to verify you're on the right mon. tracker.leave_summary(); synchronize_caught_screen(console_index, console, context, state_tracker); From 39a546b3f163185b04b6b8e26d1194fd8dd32665 Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Wed, 18 Feb 2026 17:46:00 +0100 Subject: [PATCH 2/4] Reverted unintentional changes --- ...PokemonSwSh_MaxLair_Options_BossAction.cpp | 58 ++++++++++++++++++- .../PokemonSwSh_MaxLair_Options_BossAction.h | 15 ++++- .../PokemonSwSh_MaxLair_Run_CaughtScreen.cpp | 50 ++++++++-------- 3 files changed, 92 insertions(+), 31 deletions(-) diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp index 61d467e4c6..1f4b388cc9 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp @@ -15,6 +15,10 @@ #include "PokemonSwSh/Resources/PokemonSwSh_PokemonSprites.h" #include "PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h" #include "PokemonSwSh_MaxLair_Options_BossAction.h" +#include "Common/Cpp/Options/BooleanCheckBoxOption.h" +#include "Common/Cpp/Options/ConfigOption.h" +#include +#include //#include //using std::cout; @@ -49,12 +53,41 @@ BossActionRow::BossActionRow(std::string slug, const std::string& name_slug, con BossAction::CATCH_AND_STOP_IF_SHINY ) , ball(LockMode::UNLOCK_WHILE_RUNNING, "poke-ball") + , save_on_the_go(LockMode::UNLOCK_WHILE_RUNNING, "Save when seen?", false) { PA_ADD_STATIC(pokemon); add_option(action, "Action"); add_option(ball, "Ball"); + add_option(save_on_the_go, "Save when seen?"); + + save_on_the_go.set_visibility( + action.enum_value() == BossAction::CATCH_AND_STOP_IF_SHINY ? ConfigOptionState::ENABLED : ConfigOptionState::DISABLED + ); + + action.add_listener(*this); } +void BossActionRow::value_changed(void* object, const EnumDropdownOption& option, BossAction value) { + if (&option == &action) { + save_on_the_go.set_visibility( + value == BossAction::CATCH_AND_STOP_IF_SHINY ? + ConfigOptionState::ENABLED : ConfigOptionState::DISABLED + ); + + if (value != BossAction::CATCH_AND_STOP_IF_SHINY) { + save_on_the_go = false; + } + } +} + +class BossActionTable : public StaticTableOption { + public: + BossActionTable(); + virtual std::vector make_header() const override; + private: + std::vector m_rows; +}; + BossActionTable::BossActionTable() : StaticTableOption("Boss Actions:", LockMode::UNLOCK_WHILE_RUNNING) @@ -64,15 +97,36 @@ BossActionTable::BossActionTable() const MaxLairSlugs& slugs = get_maxlair_slugs(item.second); const std::string& sprite_slug = *slugs.sprite_slugs.begin(); const std::string& name_slug = slugs.name_slug; - add_row(std::make_unique(item.second, name_slug, sprite_slug)); + + auto row = std::make_unique(item.second, name_slug, sprite_slug); + m_rows.push_back(row.get()); + add_row(std::move(row)); } finish_construction(); + + // Check function for only being able to select max 3 bosses to be saved on the go + for (auto* row : m_rows) { + auto& checkbox = row->save_on_the_go; + checkbox.add_listener([this, &checkbox](const BooleanCheckBoxOption&, bool value) { + if (value) { + size_t count = 0; + for (auto* r : m_rows) { + if (r->save_on_the_go) count++; + } + if (count > 3) { + // Make all other checkboxes equal to false + const_cast(checkbox).set_value(false); + } + } + }); + } } std::vector BossActionTable::make_header() const{ std::vector ret{ STRING_POKEMON, "Action", - STRING_POKEBALL + STRING_POKEBALL, + "Save Path?" }; return ret; } diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h index 3e228c5089..fa2fee42be 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h @@ -11,6 +11,8 @@ #include "Common/Cpp/Options/StaticTableOption.h" #include "CommonFramework/Options/LabelCellOption.h" #include "PokemonSwSh/Options/PokemonSwSh_BallSelectOption.h" +#include "Common/Cpp/Options/ConfigOption.h" +#include "Common/Cpp/Options/BooleanCheckBoxOption.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -24,19 +26,26 @@ enum class BossAction{ }; -class BossActionRow : public StaticTableRow{ +class BossActionRow : public StaticTableRow, + public OptionListener>{ public: BossActionRow(std::string slug, const std::string& name_slug, const std::string& sprite_slug); + + virtual void value_changed(void* object, const EnumDropdownOption& option, BossAction value) override; LabelCellOption pokemon; - EnumDropdownCell action; + EnumDropdownOption action; PokemonBallSelectCell ball; + BooleanCheckBoxOption save_on_the_go; }; class BossActionTable : public StaticTableOption{ public: BossActionTable(); - virtual std::vector make_header() const; + virtual std::vector make_header() const override; + +private: + std::vector m_rows; }; diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp index 73faa9aac9..190bd846f5 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp @@ -217,33 +217,31 @@ StateMachineAction run_caught_screen( if (is_host){ runtime.path_stats.clear(); } - if (shinies.empty()){ - console.log("Quitting back to entrance.", COLOR_PURPLE); - tracker.leave_summary(); - synchronize_caught_screen(console_index, console, context, state_tracker); - pbf_press_dpad(context, DPAD_DOWN, 80ms, 400ms); - pbf_press_button(context, BUTTON_B, 80ms, 1000ms); - pbf_press_button(context, BUTTON_A, 80ms, 920ms); - return mash_A_to_entrance(runtime, console, context, entrance); - }else{ - - size_t take_index = shinies.back(); - console.log("Taking shiny at slot " + std::to_string(take_index) + " and returning to entrance...", COLOR_BLUE); - tracker.scroll_to(take_index); - tracker.enter_summary(); // Enter summary to verify you're on the right mon. - tracker.leave_summary(); - synchronize_caught_screen(console_index, console, context, state_tracker); - StateMachineAction state = mash_A_to_entrance(runtime, console, context, entrance); - if (state == StateMachineAction::RESET_RECOVER){ - throw_and_log( - console.logger(), - ErrorReport::NO_ERROR_REPORT, - "Unable to take " + Pokemon::STRING_POKEMON + ". Did you forget to disable nicknames?", - console - ); + if (shinies.empty() || shinies[0] == 3){ + console.log("Quitting back to entrance.", COLOR_PURPLE); + tracker.leave_summary(); + synchronize_caught_screen(console_index, console, context, state_tracker); + pbf_press_dpad(context, DPAD_DOWN, 80ms, 400ms); + pbf_press_button(context, BUTTON_B, 80ms, 1000ms); + pbf_press_button(context, BUTTON_A, 80ms, 920ms); + return mash_A_to_entrance(runtime, console, context, entrance); + }else{ + console.log("Taking non-shiny boss and returning to entrance...", COLOR_BLUE); + tracker.scroll_to(shinies[0]); + tracker.enter_summary(); // Enter summary to verify you're on the right mon. + tracker.leave_summary(); + synchronize_caught_screen(console_index, console, context, state_tracker); + StateMachineAction state = mash_A_to_entrance(runtime, console, context, entrance); + if (state == StateMachineAction::RESET_RECOVER){ + throw_and_log( + console.logger(), + ErrorReport::NO_ERROR_REPORT, + "Unable to take " + Pokemon::STRING_POKEMON + ". Did you forget to disable nicknames?", + console + ); + } + return state; } - return state; - } case CaughtScreenAction::RESET: console.log("Resetting game...", COLOR_BLUE); From c6fcd1be52a8d77a718c134e81fcbe81f5821e6a Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Wed, 18 Feb 2026 18:00:46 +0100 Subject: [PATCH 3/4] Reverted unintentional changes 2 --- ...PokemonSwSh_MaxLair_Options_BossAction.cpp | 58 +------------------ .../PokemonSwSh_MaxLair_Options_BossAction.h | 15 +---- 2 files changed, 5 insertions(+), 68 deletions(-) diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp index 1f4b388cc9..61d467e4c6 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.cpp @@ -15,10 +15,6 @@ #include "PokemonSwSh/Resources/PokemonSwSh_PokemonSprites.h" #include "PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h" #include "PokemonSwSh_MaxLair_Options_BossAction.h" -#include "Common/Cpp/Options/BooleanCheckBoxOption.h" -#include "Common/Cpp/Options/ConfigOption.h" -#include -#include //#include //using std::cout; @@ -53,41 +49,12 @@ BossActionRow::BossActionRow(std::string slug, const std::string& name_slug, con BossAction::CATCH_AND_STOP_IF_SHINY ) , ball(LockMode::UNLOCK_WHILE_RUNNING, "poke-ball") - , save_on_the_go(LockMode::UNLOCK_WHILE_RUNNING, "Save when seen?", false) { PA_ADD_STATIC(pokemon); add_option(action, "Action"); add_option(ball, "Ball"); - add_option(save_on_the_go, "Save when seen?"); - - save_on_the_go.set_visibility( - action.enum_value() == BossAction::CATCH_AND_STOP_IF_SHINY ? ConfigOptionState::ENABLED : ConfigOptionState::DISABLED - ); - - action.add_listener(*this); } -void BossActionRow::value_changed(void* object, const EnumDropdownOption& option, BossAction value) { - if (&option == &action) { - save_on_the_go.set_visibility( - value == BossAction::CATCH_AND_STOP_IF_SHINY ? - ConfigOptionState::ENABLED : ConfigOptionState::DISABLED - ); - - if (value != BossAction::CATCH_AND_STOP_IF_SHINY) { - save_on_the_go = false; - } - } -} - -class BossActionTable : public StaticTableOption { - public: - BossActionTable(); - virtual std::vector make_header() const override; - private: - std::vector m_rows; -}; - BossActionTable::BossActionTable() : StaticTableOption("Boss Actions:", LockMode::UNLOCK_WHILE_RUNNING) @@ -97,36 +64,15 @@ BossActionTable::BossActionTable() const MaxLairSlugs& slugs = get_maxlair_slugs(item.second); const std::string& sprite_slug = *slugs.sprite_slugs.begin(); const std::string& name_slug = slugs.name_slug; - - auto row = std::make_unique(item.second, name_slug, sprite_slug); - m_rows.push_back(row.get()); - add_row(std::move(row)); + add_row(std::make_unique(item.second, name_slug, sprite_slug)); } finish_construction(); - - // Check function for only being able to select max 3 bosses to be saved on the go - for (auto* row : m_rows) { - auto& checkbox = row->save_on_the_go; - checkbox.add_listener([this, &checkbox](const BooleanCheckBoxOption&, bool value) { - if (value) { - size_t count = 0; - for (auto* r : m_rows) { - if (r->save_on_the_go) count++; - } - if (count > 3) { - // Make all other checkboxes equal to false - const_cast(checkbox).set_value(false); - } - } - }); - } } std::vector BossActionTable::make_header() const{ std::vector ret{ STRING_POKEMON, "Action", - STRING_POKEBALL, - "Save Path?" + STRING_POKEBALL }; return ret; } diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h index fa2fee42be..3e228c5089 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_BossAction.h @@ -11,8 +11,6 @@ #include "Common/Cpp/Options/StaticTableOption.h" #include "CommonFramework/Options/LabelCellOption.h" #include "PokemonSwSh/Options/PokemonSwSh_BallSelectOption.h" -#include "Common/Cpp/Options/ConfigOption.h" -#include "Common/Cpp/Options/BooleanCheckBoxOption.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -26,26 +24,19 @@ enum class BossAction{ }; -class BossActionRow : public StaticTableRow, - public OptionListener>{ +class BossActionRow : public StaticTableRow{ public: BossActionRow(std::string slug, const std::string& name_slug, const std::string& sprite_slug); - - virtual void value_changed(void* object, const EnumDropdownOption& option, BossAction value) override; LabelCellOption pokemon; - EnumDropdownOption action; + EnumDropdownCell action; PokemonBallSelectCell ball; - BooleanCheckBoxOption save_on_the_go; }; class BossActionTable : public StaticTableOption{ public: BossActionTable(); - virtual std::vector make_header() const override; - -private: - std::vector m_rows; + virtual std::vector make_header() const; }; From eca5aa055cfc0237e37c3f8778001e710470d70d Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Fri, 20 Feb 2026 16:11:03 +0100 Subject: [PATCH 4/4] Reverted unintentional changes 3 --- .../PokemonSwSh_MaxLair_Run_CaughtScreen.cpp | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp index 190bd846f5..4e849c5833 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_CaughtScreen.cpp @@ -217,31 +217,31 @@ StateMachineAction run_caught_screen( if (is_host){ runtime.path_stats.clear(); } - if (shinies.empty() || shinies[0] == 3){ - console.log("Quitting back to entrance.", COLOR_PURPLE); - tracker.leave_summary(); - synchronize_caught_screen(console_index, console, context, state_tracker); - pbf_press_dpad(context, DPAD_DOWN, 80ms, 400ms); - pbf_press_button(context, BUTTON_B, 80ms, 1000ms); - pbf_press_button(context, BUTTON_A, 80ms, 920ms); - return mash_A_to_entrance(runtime, console, context, entrance); - }else{ - console.log("Taking non-shiny boss and returning to entrance...", COLOR_BLUE); - tracker.scroll_to(shinies[0]); - tracker.enter_summary(); // Enter summary to verify you're on the right mon. - tracker.leave_summary(); - synchronize_caught_screen(console_index, console, context, state_tracker); - StateMachineAction state = mash_A_to_entrance(runtime, console, context, entrance); - if (state == StateMachineAction::RESET_RECOVER){ - throw_and_log( - console.logger(), - ErrorReport::NO_ERROR_REPORT, - "Unable to take " + Pokemon::STRING_POKEMON + ". Did you forget to disable nicknames?", - console - ); - } - return state; + if (shinies.empty() || shinies[0] == 3){ + console.log("Quitting back to entrance.", COLOR_PURPLE); + tracker.leave_summary(); + synchronize_caught_screen(console_index, console, context, state_tracker); + pbf_press_dpad(context, DPAD_DOWN, 80ms, 400ms); + pbf_press_button(context, BUTTON_B, 80ms, 1000ms); + pbf_press_button(context, BUTTON_A, 80ms, 920ms); + return mash_A_to_entrance(runtime, console, context, entrance); + }else{ + console.log("Taking non-shiny boss and returning to entrance...", COLOR_BLUE); + tracker.scroll_to(shinies[0]); + tracker.enter_summary(); // Enter summary to verify you're on the right mon. + tracker.leave_summary(); + synchronize_caught_screen(console_index, console, context, state_tracker); + StateMachineAction state = mash_A_to_entrance(runtime, console, context, entrance); + if (state == StateMachineAction::RESET_RECOVER){ + throw_and_log( + console.logger(), + ErrorReport::NO_ERROR_REPORT, + "Unable to take " + Pokemon::STRING_POKEMON + ". Did you forget to disable nicknames?", + console + ); } + return state; + } case CaughtScreenAction::RESET: console.log("Resetting game...", COLOR_BLUE);