diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 8eca9d666e..994de9bcad 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -41,12 +41,13 @@ namespace PokemonSV{ - +// spam A button to choose the first move +// throw exception if wipeout or if your lead faints. void run_battle_press_A( VideoStream& stream, ProControllerContext& context, BattleStopCondition stop_condition, - std::vector enum_optional_callbacks, + std::unordered_set enum_optional_callbacks, bool detect_wipeout ){ int16_t num_times_seen_overworld = 0; @@ -61,9 +62,15 @@ void run_battle_press_A( MoveSelectWatcher move_select_menu(COLOR_YELLOW); std::vector callbacks; + std::vector enum_all_callbacks; // mandatory callbacks: Battle, Overworld, Advance Dialog, Swap menu, Move select - std::vector enum_all_callbacks{CallbackEnum::BATTLE, CallbackEnum::OVERWORLD, CallbackEnum::ADVANCE_DIALOG, CallbackEnum::SWAP_MENU, CallbackEnum::MOVE_SELECT}; // mandatory callbacks - enum_all_callbacks.insert(enum_all_callbacks.end(), enum_optional_callbacks.begin(), enum_optional_callbacks.end()); // append the mandatory and optional callback vectors together + // optional callbacks: DIALOG_ARROW, NEXT_POKEMON + + // merge the mandatory and optional callbacks as a set, to avoid duplicates. then convert to vector + std::unordered_set enum_all_callbacks_set{CallbackEnum::BATTLE, CallbackEnum::OVERWORLD, CallbackEnum::ADVANCE_DIALOG, CallbackEnum::SWAP_MENU, CallbackEnum::MOVE_SELECT}; // mandatory callbacks + enum_all_callbacks_set.insert(enum_optional_callbacks.begin(), enum_optional_callbacks.end()); // append the mandatory and optional callback sets together + enum_all_callbacks.assign(enum_all_callbacks_set.begin(), enum_all_callbacks_set.end()); + for (const CallbackEnum& enum_callback : enum_all_callbacks){ switch(enum_callback){ case CallbackEnum::ADVANCE_DIALOG: @@ -78,10 +85,10 @@ void run_battle_press_A( case CallbackEnum::BATTLE: callbacks.emplace_back(battle); break; - case CallbackEnum::GRADIENT_ARROW: + case CallbackEnum::NEXT_POKEMON: // to detect the "next pokemon" prompt. callbacks.emplace_back(next_pokemon); break; - case CallbackEnum::SWAP_MENU: + case CallbackEnum::SWAP_MENU: // detecting Swap Menu implies your lead fainted. callbacks.emplace_back(fainted); break; case CallbackEnum::MOVE_SELECT: @@ -159,7 +166,7 @@ void run_battle_press_A( stream.log("run_battle_press_A: Detected dialog arrow."); pbf_press_button(context, BUTTON_A, 20, 105); break; - case CallbackEnum::GRADIENT_ARROW: + case CallbackEnum::NEXT_POKEMON: stream.log("run_battle_press_A: Detected prompt for bringing in next pokemon. Keep current pokemon."); pbf_mash_button(context, BUTTON_B, 100); break; @@ -176,6 +183,27 @@ void run_battle_press_A( } } +void run_trainer_battle_press_A( + VideoStream& stream, + ProControllerContext& context, + BattleStopCondition stop_condition, + std::unordered_set enum_optional_callbacks, + bool detect_wipeout +){ + enum_optional_callbacks.insert(CallbackEnum::NEXT_POKEMON); // always check for the "Next pokemon" prompt when in trainer battles + run_battle_press_A(stream, context, stop_condition, enum_optional_callbacks, detect_wipeout); +} + +void run_wild_battle_press_A( + VideoStream& stream, + ProControllerContext& context, + BattleStopCondition stop_condition, + std::unordered_set enum_optional_callbacks, + bool detect_wipeout +){ + run_battle_press_A(stream, context, stop_condition, enum_optional_callbacks, detect_wipeout); +} + void select_top_move(VideoStream& stream, ProControllerContext& context, size_t consecutive_move_select){ if (consecutive_move_select > 3){ // to handle case where move is disabled/out of PP/taunted @@ -471,7 +499,7 @@ void overworld_navigation( return; } - run_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD, {}, detect_wipeout); + run_wild_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD, {}, detect_wipeout); if (auto_heal){ auto_heal_from_menu_or_overworld(info, stream, context, 0, true); } @@ -743,7 +771,7 @@ void handle_unexpected_battles( action(info, stream, context); return; }catch (UnexpectedBattleException&){ - run_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); + run_wild_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); } } } @@ -943,7 +971,7 @@ bool is_ride_active(const ProgramInfo& info, VideoStream& stream, ProControllerC return is_ride_active; }catch(UnexpectedBattleException&){ - run_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); + run_wild_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); } } @@ -1072,7 +1100,7 @@ void realign_player_from_landmark( return; }catch (UnexpectedBattleException&){ - run_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); + run_wild_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); }catch (OperationFailedException&){ // reset to overworld if failed to center on the pokecenter, and re-try leave_phone_to_overworld(info, stream, context); @@ -1154,7 +1182,7 @@ void move_cursor_towards_flypoint_and_go_there( return; }catch (UnexpectedBattleException&){ - run_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); + run_wild_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); }catch (OperationFailedException&){ // reset to overworld if failed to center on the pokecenter, and re-try leave_phone_to_overworld(info, stream, context); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h index 6bdb72dfc3..d503efb7e1 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h @@ -8,6 +8,7 @@ #define PokemonAutomation_PokemonSV_AutoStoryTools_H #include +#include #include "CommonFramework/Language.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -58,7 +59,7 @@ enum class CallbackEnum{ BATTLE, TUTORIAL, BLACK_DIALOG_BOX, - GRADIENT_ARROW, + NEXT_POKEMON, SWAP_MENU, MOVE_SELECT, }; @@ -117,13 +118,25 @@ class AutoStory_Segment { AutoStoryOptions options) const = 0; }; -// spam A button to choose the first move -// throw exception if wipeout. -void run_battle_press_A( +// spam A button to choose the first move for trainer battles +// detect_wipeout: can be false if you have multiple pokemon in your party, since an exception will be thrown if your lead faints. +// throw exception if wipeout or if your lead faints. +void run_trainer_battle_press_A( VideoStream& stream, ProControllerContext& context, BattleStopCondition stop_condition, - std::vector optional_callbacks = {}, + std::unordered_set enum_optional_callbacks = {}, + bool detect_wipeout = false +); + +// spam A button to choose the first move for wild battles +// detect_wipeout: can be false if you have multiple pokemon in your party, since an exception will be thrown if your lead faints. +// throw exception if wipeout or if your lead faints. +void run_wild_battle_press_A( + VideoStream& stream, + ProControllerContext& context, + BattleStopCondition stop_condition, + std::unordered_set enum_optional_callbacks = {}, bool detect_wipeout = false ); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_03.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_03.cpp index 5dd13458f8..ae1d73c099 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_03.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_03.cpp @@ -122,9 +122,9 @@ void checkpoint_06( clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::WHITE_A_BUTTON, CallbackEnum::TUTORIAL, CallbackEnum::BATTLE}); - // can die in catch tutorial, and the story will continue - env.console.log("run_battle_press_A: Battle Lechonk in catch tutorial. Stop when detect dialog."); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); + // can die in catch tutorial, and the story will continue. so need to detect wipeout + env.console.log("Battle Lechonk in catch tutorial. Stop when detect dialog."); + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); env.console.log("clear_dialog: Talk with Nemona to finish catch tutorial. Stop when detect overworld."); clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp index 367f3be5c7..c8a7097800 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp @@ -91,9 +91,9 @@ void checkpoint_13( clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::PROMPT_DIALOG, CallbackEnum::DIALOG_ARROW, CallbackEnum::BATTLE}); - env.console.log("run_battle_press_A: Battle with Nemona at Mesagoza gate. Stop when detect dialog."); - // story continues even if you lose - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); + env.console.log("Battle with Nemona at Mesagoza gate. Stop when detect dialog."); + // story continues even if you lose, no need to detect wipeout + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); env.console.log("clear_dialog: Talk with Nemona within Mesagoza. Stop when detect overworld."); clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, @@ -146,15 +146,15 @@ void checkpoint_14( env.console.log("clear_dialog: Talk with Team Star at the top of the stairs. Stop when detect battle."); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::PROMPT_DIALOG, CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW}); // run battle until dialog - env.console.log("run_battle_press_A: Battle with Team Star grunt 1. Stop when detect dialog."); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {}, true); + env.console.log("Battle with Team Star grunt 1. Stop when detect dialog."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {}, true); // need to detect wipeouts, since you need to win, and you likely only have 1 pokemon // clear dialog until battle, with prompt, white button, tutorial, battle env.console.log("clear_dialog: Talk with Team Star and Nemona. Receive Tera orb. Stop when detect battle."); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::PROMPT_DIALOG, CallbackEnum::WHITE_A_BUTTON, CallbackEnum::TUTORIAL, CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW}); // run battle until dialog - env.console.log("run_battle_press_A: Battle with Team Star grunt 2. Stop when detect dialog."); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {}, true); + env.console.log("Battle with Team Star grunt 2. Stop when detect dialog."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {}, true); // need to detect wipeouts, since you need to win, and you likely only have 1 pokemon // clear dialog until overworld clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, {CallbackEnum::OVERWORLD}); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp index f2b90716d1..badc0ae070 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp @@ -181,7 +181,8 @@ void checkpoint_25( direction.change_direction(env.program_info(), env.console, context, 1.485); walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 10, 128, 20); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); + env.console.log("Battle Olive Roll NPC 1."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A); // section 6 @@ -200,7 +201,8 @@ void checkpoint_25( direction.change_direction(env.program_info(), env.console, context, 4.275); walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 10, 128, 20); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); + env.console.log("Battle Olive Roll NPC 2."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A); // section 10. leave Olive roll diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp index 73de52c5a9..dea88783dc 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp @@ -120,7 +120,8 @@ void checkpoint_28( clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::PROMPT_DIALOG, CallbackEnum::DIALOG_ARROW}); // battle Katy - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::GRADIENT_ARROW}, true); + env.console.log("Battle Grass Gym."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A, 360); // leave gym building diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp index 3d589395f6..8d3042c18c 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp @@ -225,10 +225,12 @@ void checkpoint_30( } - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); + env.console.log("Battle Bombirdier Titan phase 1."); + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 30, {CallbackEnum::BATTLE}); // round 2 of battle - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::DIALOG_ARROW}); + env.console.log("Battle Bombirdier Titan phase 2."); + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::DIALOG_ARROW}); // get ride upgrade mash_button_till_overworld(env.console, context, BUTTON_A); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp index e500ddb242..7758d86909 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp @@ -127,7 +127,8 @@ void checkpoint_32( // battle team star grunts clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::PROMPT_DIALOG, CallbackEnum::DIALOG_ARROW}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); + env.console.log("Battle Team star grunt."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, {CallbackEnum::OVERWORLD, CallbackEnum::BLACK_DIALOG_BOX}); @@ -253,7 +254,8 @@ void checkpoint_33( ); } clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {}, true); + env.console.log("Battle the Team Star (Dark) boss."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A, 360); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_17.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_17.cpp index 7b0ff3c6d7..46c4e80474 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_17.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_17.cpp @@ -98,7 +98,8 @@ void checkpoint_37( walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 20); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::PROMPT_DIALOG, CallbackEnum::DIALOG_ARROW}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::GRADIENT_ARROW}); + env.console.log("Battle Kofu's assistant."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A, 360); @@ -170,7 +171,8 @@ void checkpoint_38( // talk to reception. Battle Kofu walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 10); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::PROMPT_DIALOG, CallbackEnum::DIALOG_ARROW}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::GRADIENT_ARROW}, true); + env.console.log("Battle Water Gym."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A, 360); break; diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp index fc09a3f283..dedf074c67 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp @@ -200,7 +200,8 @@ void checkpoint_39( // battle the titan phase 1 clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::BLACK_DIALOG_BOX}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + env.console.log("Battle Great Tusk/Iron Treads Titan phase 1."); + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); // section 5 realign_player_from_landmark( @@ -225,7 +226,8 @@ void checkpoint_39( // battle the titan phase 2 clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::DIALOG_ARROW}); + env.console.log("Battle Great Tusk/Iron Treads Titan phase 2."); + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::DIALOG_ARROW}); mash_button_till_overworld(env.console, context, BUTTON_A, 360); break; diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_19.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_19.cpp index 567526ca5e..d530416ef5 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_19.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_19.cpp @@ -228,7 +228,8 @@ void checkpoint_41( // battle Klawf phase 1 - run_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + env.console.log("Battle Klawf Titan phase 1."); + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); do_action_and_monitor_for_battles(env.program_info(), env.console, context, [&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ direction.change_direction(env.program_info(), env.console, context, 2.83); @@ -240,7 +241,8 @@ void checkpoint_41( clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 30, {CallbackEnum::BATTLE}); // Klawf battle phase 2 - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::DIALOG_ARROW}); + env.console.log("Battle Klawf Titan phase 1."); + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::DIALOG_ARROW}); // get ride upgrade mash_button_till_overworld(env.console, context, BUTTON_A); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp index 24654bb9da..cccb4a51ec 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp @@ -126,7 +126,8 @@ void checkpoint_43( // enter gym building. talk go Nemona and battle her. clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BLACK_DIALOG_BOX, CallbackEnum::PROMPT_DIALOG, CallbackEnum::DIALOG_ARROW, CallbackEnum::BATTLE}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::GRADIENT_ARROW}); + env.console.log("Battle Nemona."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A); @@ -536,7 +537,8 @@ void checkpoint_45( ); clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::PROMPT_DIALOG, CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW}); - run_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::GRADIENT_ARROW}); + env.console.log("Battle Grass Gym leader."); + run_trainer_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG); mash_button_till_overworld(env.console, context, BUTTON_A); break; diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp index f218ddc05d..7156c3aaa1 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp @@ -426,7 +426,7 @@ void jump_off_wall_until_map_open(const ProgramInfo& info, VideoStream& stream, } } -// Open map and teleport back to town pokecenter to reset the hunting path. +// Open map and teleport back to town pokecenter void reset_to_pokecenter(const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ while (true){ try { @@ -434,7 +434,7 @@ void reset_to_pokecenter(const ProgramInfo& info, VideoStream& stream, ProContro fly_to_closest_pokecenter_on_map(info, stream, context); break; }catch (UnexpectedBattleException&){ - run_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); + run_wild_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); } } @@ -560,7 +560,7 @@ bool attempt_fly_to_overlapping_flypoint( return fly_to_overworld_from_map(info, stream, context, true); }catch (UnexpectedBattleException&){ - run_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); + run_wild_battle_press_A(stream, context, BattleStopCondition::STOP_OVERWORLD); } }