diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp index 4a620b181..4df1845d1 100644 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp +++ b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp @@ -196,7 +196,7 @@ TestProgram::TestProgram() PA_ADD_OPTION(STATIC_TEXT); PA_ADD_OPTION(SELECT); PA_ADD_OPTION(PLAYER_LIST); - PA_ADD_OPTION(battle_AI); +// PA_ADD_OPTION(battle_AI); PA_ADD_OPTION(NOTIFICATIONS); BUTTON0.add_listener(*this); BUTTON1.add_listener(*this); @@ -243,7 +243,7 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope& // SinglesAIOption battle_AI; - run_singles_battle(env, console, context, battle_AI, false); +// run_singles_battle(env, console, context, battle_AI, false); #if 0 diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.h b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.h index e276270a6..56179aa62 100644 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.h +++ b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.h @@ -71,7 +71,7 @@ class TestProgram : public MultiSwitchProgramInstance, public ButtonListener{ PokemonSV::PlayerListTable PLAYER_LIST; - PokemonSV::SinglesAIOption battle_AI; +// PokemonSV::SinglesAIOption battle_AI; EventNotificationOption NOTIFICATION_TEST; EventNotificationsOption NOTIFICATIONS; diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.cpp b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.cpp index b07ba5f67..efe2b36c9 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.cpp +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.cpp @@ -16,7 +16,7 @@ using namespace Pokemon; -SinglesAIOption::SinglesAIOption() +SinglesAIOption::SinglesAIOption(bool trainer_battle) : GroupOption( "Battle AI", LockMode::UNLOCK_WHILE_RUNNING, @@ -32,12 +32,12 @@ SinglesAIOption::SinglesAIOption() ) , MOVE_TABLES(6) { - MOVE_TABLES.emplace_back("1st " + STRING_POKEMON + " Move Table:"); - MOVE_TABLES.emplace_back("2nd " + STRING_POKEMON + " Move Table:"); - MOVE_TABLES.emplace_back("3rd " + STRING_POKEMON + " Move Table:"); - MOVE_TABLES.emplace_back("4th " + STRING_POKEMON + " Move Table:"); - MOVE_TABLES.emplace_back("5th " + STRING_POKEMON + " Move Table:"); - MOVE_TABLES.emplace_back("6th " + STRING_POKEMON + " Move Table:"); + MOVE_TABLES.emplace_back("1st " + STRING_POKEMON + " Move Table:", trainer_battle); + MOVE_TABLES.emplace_back("2nd " + STRING_POKEMON + " Move Table:", trainer_battle); + MOVE_TABLES.emplace_back("3rd " + STRING_POKEMON + " Move Table:", trainer_battle); + MOVE_TABLES.emplace_back("4th " + STRING_POKEMON + " Move Table:", trainer_battle); + MOVE_TABLES.emplace_back("5th " + STRING_POKEMON + " Move Table:", trainer_battle); + MOVE_TABLES.emplace_back("6th " + STRING_POKEMON + " Move Table:", trainer_battle); PA_ADD_STATIC(description); size_t c = 0; diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.h b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.h index b9e0b499c..3b59abdaa 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.h +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesAIOption.h @@ -21,7 +21,7 @@ namespace PokemonSV{ class SinglesAIOption : public GroupOption{ public: - SinglesAIOption(); + SinglesAIOption(bool trainer_battle); public: StaticTextOption description; diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp index 0981dce99..b9fd8f7c6 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp @@ -11,7 +11,7 @@ namespace NintendoSwitch{ namespace PokemonSV{ -const EnumDatabase& singles_move_enum_database(){ +const EnumDatabase& singles_move_enum_database_wild(){ static EnumDatabase database{ {SinglesMoveType::Move1, "move1", "Move 1"}, {SinglesMoveType::Move2, "move2", "Move 2"}, @@ -21,6 +21,15 @@ const EnumDatabase& singles_move_enum_database(){ }; return database; } +const EnumDatabase& singles_move_enum_database_trainer(){ + static EnumDatabase database{ + {SinglesMoveType::Move1, "move1", "Move 1"}, + {SinglesMoveType::Move2, "move2", "Move 2"}, + {SinglesMoveType::Move3, "move3", "Move 3"}, + {SinglesMoveType::Move4, "move4", "Move 4"}, + }; + return database; +} std::string SinglesMoveEntry::to_str() const{ switch (type){ @@ -47,8 +56,12 @@ std::string SinglesMoveEntry::to_str() const{ SinglesMoveTableRow::~SinglesMoveTableRow(){ type.remove_listener(*this); } -SinglesMoveTableRow::SinglesMoveTableRow() - : type(singles_move_enum_database(), LockMode::UNLOCK_WHILE_RUNNING, SinglesMoveType::Move1) +SinglesMoveTableRow::SinglesMoveTableRow(bool p_trainer_battle) + : type( + p_trainer_battle ? singles_move_enum_database_trainer() : singles_move_enum_database_wild(), + LockMode::UNLOCK_WHILE_RUNNING, + SinglesMoveType::Move1 + ) , terastallize(LockMode::UNLOCK_WHILE_RUNNING, false) , notes(false, LockMode::UNLOCK_WHILE_RUNNING, "", "(e.g. Screech, Belly Drum)") { @@ -60,7 +73,7 @@ SinglesMoveTableRow::SinglesMoveTableRow() type.add_listener(*this); } std::unique_ptr SinglesMoveTableRow::clone() const{ - std::unique_ptr ret(new SinglesMoveTableRow()); + std::unique_ptr ret(new SinglesMoveTableRow(trainer_battle)); ret->type.set(type); ret->terastallize = (bool)terastallize; ret->notes.set(notes); @@ -77,7 +90,7 @@ void SinglesMoveTableRow::value_changed(){ -SinglesMoveTable::SinglesMoveTable(std::string label) +SinglesMoveTable::SinglesMoveTable(std::string label, bool trainer_battle) : EditableTableOption_t( std::move(label), #if 0 @@ -87,8 +100,9 @@ SinglesMoveTable::SinglesMoveTable(std::string label) "Changes to this table take effect on the next battle.", #endif LockMode::UNLOCK_WHILE_RUNNING, - make_defaults() + make_defaults(trainer_battle) ) + , m_trainer_battle(trainer_battle) {} std::vector SinglesMoveTable::snapshot(){ @@ -101,9 +115,9 @@ std::vector SinglesMoveTable::make_header() const{ "Notes", }; } -std::vector> SinglesMoveTable::make_defaults(){ +std::vector> SinglesMoveTable::make_defaults(bool trainer_battle){ std::vector> ret; - ret.emplace_back(new SinglesMoveTableRow()); + ret.emplace_back(new SinglesMoveTableRow(trainer_battle)); return ret; } diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h index c4033b66d..67b87867d 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h @@ -24,7 +24,8 @@ enum class SinglesMoveType{ Move4, Run, }; -const EnumDatabase& singles_move_enum_database(); +const EnumDatabase& singles_move_enum_database_wild(); +const EnumDatabase& singles_move_enum_database_trainer(); struct SinglesMoveEntry{ @@ -38,7 +39,7 @@ struct SinglesMoveEntry{ class SinglesMoveTableRow : public EditableTableRow, public ConfigOption::Listener{ public: ~SinglesMoveTableRow(); - SinglesMoveTableRow(); + SinglesMoveTableRow(bool p_trainer_battle); virtual std::unique_ptr clone() const override; SinglesMoveEntry snapshot() const; @@ -47,6 +48,7 @@ class SinglesMoveTableRow : public EditableTableRow, public ConfigOption::Listen virtual void value_changed() override; private: + bool trainer_battle; EnumDropdownCell type; BooleanCheckBoxCell terastallize; StringCell notes; @@ -55,14 +57,16 @@ class SinglesMoveTableRow : public EditableTableRow, public ConfigOption::Listen class SinglesMoveTable : public EditableTableOption_t{ public: - SinglesMoveTable(std::string label); + SinglesMoveTable(std::string label, bool trainer_battle); std::vector snapshot(); virtual std::vector make_header() const; - static std::vector> make_defaults(); + static std::vector> make_defaults(bool trainer_battle); +private: + bool m_trainer_battle; }; diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp index fe734b062..52e5bd111 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp @@ -103,6 +103,7 @@ TournamentFarmer2::TournamentFarmer2() LockMode::UNLOCK_WHILE_RUNNING, 1, 0 ) + , BATTLE_AI(true) , GO_HOME_WHEN_DONE(false) , NOTIFICATION_STATUS_UPDATE("Status Update", true, false, std::chrono::seconds(3600)) , NOTIFICATIONS({