From 88c6fee36b0584b0e0985340c919123673a6f28b Mon Sep 17 00:00:00 2001 From: Mysticial Date: Thu, 28 Dec 2023 17:37:44 -0800 Subject: [PATCH] Fix build. Add untested loss recovery. --- .../Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp | 1 - .../Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h | 3 --- .../Programs/Farming/PokemonSV_TournamentFarmer.cpp | 2 +- .../PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.h | 5 ++++- .../Programs/Farming/PokemonSV_TournamentFarmer2.cpp | 6 ++++++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp index b9fd8f7c6..d06c8a1ec 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp @@ -102,7 +102,6 @@ SinglesMoveTable::SinglesMoveTable(std::string label, bool trainer_battle) LockMode::UNLOCK_WHILE_RUNNING, make_defaults(trainer_battle) ) - , m_trainer_battle(trainer_battle) {} std::vector SinglesMoveTable::snapshot(){ diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h index 67b87867d..a9ae6707a 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h @@ -64,9 +64,6 @@ class SinglesMoveTable : public EditableTableOption_t{ virtual std::vector make_header() const; static std::vector> make_defaults(bool trainer_battle); - -private: - bool m_trainer_battle; }; diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp index e43967d88..63cc78766 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp @@ -557,7 +557,7 @@ void TournamentFarmer::handle_end_of_tournament(SingleSwitchProgramEnvironment& //Fly to academy from west pokemon center after losing. -void TournamentFarmer::return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, BotBaseContext& context) { +void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, BotBaseContext& context) { env.log("Tournament lost! Navigating back to academy."); open_map_from_overworld(env.program_info(), env.console, context); pbf_press_button(context, BUTTON_ZR, 50, 40); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.h b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.h index 70a9121c5..d2ccae97b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.h +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.h @@ -21,6 +21,10 @@ namespace NintendoSwitch{ namespace PokemonSV{ +void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, BotBaseContext& context); + + + class TournamentFarmer_Descriptor : public SingleSwitchProgramDescriptor{ public: TournamentFarmer_Descriptor(); @@ -64,7 +68,6 @@ class TournamentFarmer : public SingleSwitchProgramInstance, public ButtonListen void run_battle(SingleSwitchProgramEnvironment& env, BotBaseContext& context); void check_prize(SingleSwitchProgramEnvironment& env, BotBaseContext& context); void handle_end_of_tournament(SingleSwitchProgramEnvironment& env, BotBaseContext& context); - void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, BotBaseContext& context); }; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp index 52e5bd111..8e4f66d59 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp @@ -17,6 +17,7 @@ #include "PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.h" #include "PokemonSV/Programs/PokemonSV_SaveGame.h" #include "PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.h" +#include "PokemonSV_TournamentFarmer.h" #include "PokemonSV_TournamentFarmer2.h" namespace PokemonAutomation{ @@ -146,6 +147,7 @@ class TournamentFarmer2::ResetOnExit{ }; + void TournamentFarmer2::program(SingleSwitchProgramEnvironment& env, BotBaseContext& context) { assert_16_9_720p_min(env.logger(), env.console); TournamentFarmer2_Descriptor::Stats& stats = env.current_stats(); @@ -265,6 +267,10 @@ void TournamentFarmer2::program(SingleSwitchProgramEnvironment& env, BotBaseCont } + if (battle_lost){ + return_to_academy_after_loss(env, context); + break; + } } // Tournament won