Skip to content

Commit c44e398

Browse files
committed
Don't dump error report just because AutoDA fails to read opponent from the battle.
1 parent 8a3b8a6 commit c44e398

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

SerialPrograms/Source/PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ std::set<std::string> BattleMenuReader::read_opponent(
238238
VideoFeed& feed
239239
) const{
240240
std::set<std::string> result;
241+
241242
VideoSnapshot screen;
242243
for (size_t c = 0; c < 3; c++){
243244
screen = feed.snapshot();
@@ -249,7 +250,7 @@ std::set<std::string> BattleMenuReader::read_opponent(
249250
logger.log("Failed to read opponent name. Retrying in 1 second...", COLOR_ORANGE);
250251
scope.wait_for(std::chrono::seconds(1));
251252
}
252-
dump_image(logger, MODULE_NAME, "MaxLair-read_opponent", screen);
253+
// dump_image(logger, MODULE_NAME, "MaxLair-read_opponent", screen);
253254
return result;
254255
}
255256
std::set<std::string> BattleMenuReader::read_opponent_in_summary(Logger& logger, const ImageViewRGB32& screen) const{

SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ bool read_battle_menu(
5656
break;
5757
}
5858
}
59-
console.log("Attempting to read from summary.", COLOR_PURPLE);
59+
if (state.opponent.size() == 1){
60+
console.log("Failed to read opponent from battle. Using previously known value: " + set_to_str(state.opponent), COLOR_ORANGE);
61+
break;
62+
}
63+
64+
console.log("Unable to read opponent from battle. Attempting to read from summary.", COLOR_ORANGE);
6065
pbf_press_button(context, BUTTON_Y, 10, TICKS_PER_SECOND);
6166
pbf_press_dpad(context, DPAD_UP, 10, 50);
6267
pbf_press_button(context, BUTTON_A, 10, 2 * TICKS_PER_SECOND);

0 commit comments

Comments
 (0)