diff --git a/SerialPrograms/Source/CommonFramework/Globals.cpp b/SerialPrograms/Source/CommonFramework/Globals.cpp
index 49c2f0475..f4d704a6f 100644
--- a/SerialPrograms/Source/CommonFramework/Globals.cpp
+++ b/SerialPrograms/Source/CommonFramework/Globals.cpp
@@ -23,7 +23,7 @@ namespace PokemonAutomation{
const bool IS_BETA_VERSION = false;
const int PROGRAM_VERSION_MAJOR = 0;
const int PROGRAM_VERSION_MINOR = 42;
-const int PROGRAM_VERSION_PATCH = 4;
+const int PROGRAM_VERSION_PATCH = 5;
const std::string PROGRAM_VERSION_BASE =
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +
diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.cpp b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.cpp
index c3f085209..9804e287d 100644
--- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.cpp
+++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.cpp
@@ -21,7 +21,7 @@ namespace NintendoSwitch{
namespace PokemonSV{
-TeraRollFilter::TeraRollFilter()
+TeraRollFilter::TeraRollFilter(uint8_t default_max_stars, bool enable_herb_filter)
: GroupOption("Opponent Filter", LockMode::UNLOCK_WHILE_RUNNING)
, EVENT_CHECK_MODE(
"Event Tera Raid Action:
Choose how the program interacts with event/non-event raids."
@@ -42,9 +42,9 @@ TeraRollFilter::TeraRollFilter()
, MAX_STARS(
"Max Stars:
Skip raids with more than this many stars.",
LockMode::UNLOCK_WHILE_RUNNING,
- 4, 1, 7
+ default_max_stars, 1, 7
)
- , SKIP_HERBA(
+ , SKIP_NON_HERBA(
"Skip Non-Herba Raids:
"
"Skip raids that don't have the possibility to reward all types of Herba Mystica. Enable this if you are searching for an herba raid.",
LockMode::UNLOCK_WHILE_RUNNING,
@@ -54,13 +54,24 @@ TeraRollFilter::TeraRollFilter()
PA_ADD_OPTION(EVENT_CHECK_MODE);
PA_ADD_OPTION(MIN_STARS);
PA_ADD_OPTION(MAX_STARS);
- PA_ADD_OPTION(SKIP_HERBA);
+ if (enable_herb_filter){
+ PA_ADD_OPTION(SKIP_NON_HERBA);
+ }
}
-void TeraRollFilter::start_program_check(Logger& logger) const{
+std::string TeraRollFilter::check_validity() const{
if (MIN_STARS > MAX_STARS){
- throw UserSetupError(logger, "Error in the settings, \"Min Stars\" is bigger than \"Max Stars\".");
+ return "\"Min Stars\" is bigger than \"Max Stars\".";
+ }
+ if (SKIP_NON_HERBA && MAX_STARS < 5){
+ return
+ "Setting \"Max Stars\" below 5 and \"Skip Herba\" to "
+ "true will never yield results because all herb raids are 5-star or higher.";
+ }
+ if (SKIP_NON_HERBA && EVENT_CHECK_MODE == EventCheckMode::CHECK_ONLY_EVENT){
+ return "\"Check only event raids\" and \"Skip Non-Herba Raids\" is incompatible because only non-event raids can have all herbs.";
}
+ return "";
}
TeraRollFilter::FilterResult TeraRollFilter::run_filter(
@@ -175,7 +186,7 @@ void TeraRollFilter::read_card(
console.log(log);
}
bool TeraRollFilter::check_herba(const std::string& pokemon_slug) const{
- if (!SKIP_HERBA){
+ if (!SKIP_NON_HERBA){
return true;
}
diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.h b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.h
index b129c8911..7c9dda3c7 100644
--- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.h
+++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_TeraRollFilter.h
@@ -44,9 +44,9 @@ struct TeraRaidData{
class TeraRollFilter : public GroupOption{
public:
- TeraRollFilter();
+ TeraRollFilter(uint8_t default_max_stars, bool enable_herb_filter);
- void start_program_check(Logger& logger) const;
+ virtual std::string check_validity() const override;
enum class FilterResult{
NO_RAID,
@@ -78,7 +78,7 @@ class TeraRollFilter : public GroupOption{
SimpleIntegerOption MIN_STARS;
SimpleIntegerOption MAX_STARS;
- BooleanCheckBoxOption SKIP_HERBA;
+ BooleanCheckBoxOption SKIP_NON_HERBA;
};
diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.cpp
index 54ffe6f62..b55c03053 100644
--- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.cpp
+++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.cpp
@@ -87,7 +87,8 @@ std::unique_ptr TeraRoller_Descriptor::make_stats() const{
TeraRoller::TeraRoller()
- : CHECK_ONLY_FIRST(
+ : FILTER0(7, false)
+ , CHECK_ONLY_FIRST(
"Check Only the First Pokédex Page:
Reduce time per reset at the expense of not checking repeated encounters.",
LockMode::UNLOCK_WHILE_RUNNING,
false
@@ -112,7 +113,7 @@ TeraRoller::TeraRoller()
&NOTIFICATION_ERROR_FATAL,
})
{
- PA_ADD_OPTION(FILTER);
+ PA_ADD_OPTION(FILTER0);
PA_ADD_OPTION(CHECK_ONLY_FIRST);
PA_ADD_OPTION(PERIODIC_RESET);
PA_ADD_OPTION(NOTIFICATIONS);
@@ -124,11 +125,6 @@ void TeraRoller::program(SingleSwitchProgramEnvironment& env, BotBaseContext& co
TeraRoller_Descriptor::Stats& stats = env.current_stats();
- FILTER.start_program_check(env.console);
- if (FILTER.MIN_STARS > FILTER.MAX_STARS){
- throw UserSetupError(env.console, "Error in the settings, \"Min Stars\" is bigger than \"Max Stars\".");
- }
-
// Connect the controller
pbf_press_button(context, BUTTON_L, 10, 10);
@@ -159,7 +155,7 @@ void TeraRoller::program(SingleSwitchProgramEnvironment& env, BotBaseContext& co
}
TeraRaidData raid_data;
- TeraRollFilter::FilterResult result = FILTER.run_filter(
+ TeraRollFilter::FilterResult result = FILTER0.run_filter(
env.program_info(), env.console, context,
raid_data
);
diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.h b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.h
index 2f6a9fa08..51ad002ef 100644
--- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.h
+++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoller.h
@@ -37,7 +37,7 @@ class TeraRoller : public SingleSwitchProgramInstance{
virtual void program(SingleSwitchProgramEnvironment& env, BotBaseContext& context) override;
private:
- TeraRollFilter FILTER;
+ TeraRollFilter FILTER0;
BooleanCheckBoxOption CHECK_ONLY_FIRST;
SimpleIntegerOption PERIODIC_RESET;
diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraSelfFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraSelfFarmer.cpp
index 33c600add..0bc30241f 100644
--- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraSelfFarmer.cpp
+++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraSelfFarmer.cpp
@@ -123,6 +123,7 @@ TeraSelfFarmer::TeraSelfFarmer()
PokemonNameReader::instance().languages(),
LockMode::UNLOCK_WHILE_RUNNING
)
+ , FILTER(4, true)
, PERIODIC_RESET(
"Periodic Game Reset:
Reset the game after this many skips. This clears up the framerate bug.",
LockMode::UNLOCK_WHILE_RUNNING,
@@ -225,7 +226,7 @@ void TeraSelfFarmer::program(SingleSwitchProgramEnvironment& env, BotBaseContext
throw UserSetupError(env.console, "Error in the settings, \"Min Stars\" is bigger than \"Max Stars\".");
}
- if (FILTER.SKIP_HERBA && FILTER.MAX_STARS < 5){
+ if (FILTER.SKIP_NON_HERBA && FILTER.MAX_STARS < 5){
throw UserSetupError(env.console, "Error in the settings, Skip Non-Herba Raids is checked but Max Stars is less than 5.");
}