From b102d43f058edb612d601bfaa2aca7cd779a0ee5 Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Thu, 21 Sep 2023 20:28:35 -0400 Subject: [PATCH] stats: reset when out of balls, rename generic to gimmi remove red color from ursaluna caught log --- .../Programs/General/PokemonSV_StatsReset.cpp | 16 ++++++++++++---- .../General/PokemonSV_StatsResetBloodmoon.cpp | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp index c98c35e7d..5ae1a58ba 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp @@ -70,11 +70,12 @@ StatsReset::StatsReset() "Target:
The Pokemon you are resetting for.
" "Treasures of Ruin: Stand in front of the unsealed vaults of one of the Ruinous Quartet.
" "Loyal Three: Stand in front of Okidogi/Munkidori/Fezandipiti.
" - "Generic: You are standing in front of a Pokemon that requires an A press to initiate battle.
", + //"Generic: You are standing in front of a Pokemon that requires an A press to initiate battle.
", + "Gimmighoul: Stand in front of a Gimmighoul chest.
", { {Target::TreasuresOfRuin, "treasures-of-ruin", "Treasures of Ruin"}, {Target::LoyalThree, "loyal-three", "Loyal Three"}, - {Target::Generic, "generic", "Generic"}, + {Target::Generic, "generic", "Gimmighoul"}, }, LockWhileRunning::LOCKED, Target::TreasuresOfRuin @@ -165,6 +166,7 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, BotBaseContext& uint8_t switch_party_slot = 1; bool target_fainted = false; + bool out_of_balls = false; int ret = run_until( env.console, context, @@ -195,10 +197,11 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, BotBaseContext& BattleBallReader reader(env.console, LANGUAGE); int quantity = move_to_ball(reader, env.console, context, BALL_SELECT.slug()); if (quantity == 0) { - env.console.log("Unable to find appropriate ball, out of balls, or either Pokemon fainted."); + out_of_balls = true; + env.console.log("Unable to find appropriate ball/out of balls."); send_program_status_notification( env, NOTIFICATION_STATUS_UPDATE, - "Unable to find appropriate ball, out of balls, or either Pokemon fainted." + "Unable to find appropriate ball/out of balls." ); break; } @@ -282,6 +285,11 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, BotBaseContext& target_fainted = true; break; default: + if (out_of_balls) { + target_fainted = true; //Resets game. + env.log("Ran out of selected Pokeball. Resetting."); + break; + } env.console.log("Invalid state in run_battle()."); stats.errors++; env.update_stats(); diff --git a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetBloodmoon.cpp b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetBloodmoon.cpp index dcd1e9d79..988fd849a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetBloodmoon.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetBloodmoon.cpp @@ -270,7 +270,7 @@ bool StatsResetBloodmoon::run_battle(SingleSwitchProgramEnvironment& env, BotBas stats.catches++; env.update_stats(); - env.log("Ursaluna caught.", COLOR_RED); + env.log("Ursaluna caught."); } else { env.log("Battle against Ursaluna lost.", COLOR_RED);