Skip to content

Commit

Permalink
Attempt to fix bad state when tera is incorrectly detected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticial committed Sep 19, 2023
1 parent 409cc42 commit 464474c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion SerialPrograms/Source/CommonFramework/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace PokemonAutomation{
const bool IS_BETA_VERSION = true;
const int PROGRAM_VERSION_MAJOR = 0;
const int PROGRAM_VERSION_MINOR = 40;
const int PROGRAM_VERSION_PATCH = 1;
const int PROGRAM_VERSION_PATCH = 2;

const std::string PROGRAM_VERSION_BASE =
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,31 @@ bool run_move_select(
// probably disabled. Select a different move.
if (consecutive_move_select > 3){
console.log("Failed to select a move 3 times. Choosing a different move.", COLOR_RED);
// pbf_press_dpad(context, DPAD_DOWN, 20, 40);
// pbf_press_dpad(context, DPAD_DOWN, 20, 40);
index++;
if (index >= 4){
index = 0;
}
move.type = (TeraMoveType)((uint8_t)TeraMoveType::Move1 + index);
}

if (terastallizing.detect(console.video().snapshot())){
console.log("Terastallization: Available");
if (battle_AI.TRY_TO_TERASTILLIZE){
pbf_press_button(context, BUTTON_R, 20, 4 * TICKS_PER_SECOND);
do{
if (!battle_AI.TRY_TO_TERASTILLIZE){
console.log("Skipping Terastallization. Reason: Disabled by settings.");
break;
}
}else{
console.log("Terastallization: Not Available");
}
if (consecutive_move_select > 1){
console.log("Skipping Terastallization. Reason: Previously failed move select.");
break;
}
if (!terastallizing.detect(console.video().snapshot())){
console.log("Skipping Terastallization. Reason: Not ready.");
break;
}

console.log("Attempting to Terastallize...");
pbf_press_button(context, BUTTON_R, 20, 4 * TICKS_PER_SECOND);
}while (false);

if (move_select_menu.move_to_slot(console, context, index)){
pbf_press_button(context, BUTTON_A, 20, 10);
Expand Down

0 comments on commit 464474c

Please sign in to comment.