Skip to content

Commit

Permalink
Fix build. Add untested loss recovery.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticial committed Dec 29, 2023
1 parent 8212db2 commit 88c6fee
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<SinglesMoveEntry> SinglesMoveTable::snapshot(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ class SinglesMoveTable : public EditableTableOption_t<SinglesMoveTableRow>{
virtual std::vector<std::string> make_header() const;

static std::vector<std::unique_ptr<EditableTableRow>> make_defaults(bool trainer_battle);

private:
bool m_trainer_battle;
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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<TournamentFarmer2_Descriptor::Stats>();
Expand Down Expand Up @@ -265,6 +267,10 @@ void TournamentFarmer2::program(SingleSwitchProgramEnvironment& env, BotBaseCont
}


if (battle_lost){
return_to_academy_after_loss(env, context);
break;
}
}

// Tournament won
Expand Down

0 comments on commit 88c6fee

Please sign in to comment.