From 5c075a23f004d63b84173a2186ad539772f9d1c7 Mon Sep 17 00:00:00 2001 From: jw098 Date: Sun, 3 Nov 2024 11:55:45 -0800 Subject: [PATCH] segments 8 to 9 (#498) --- SerialPrograms/CMakeLists.txt | 6 +- SerialPrograms/SerialPrograms.pro | 8 +- .../AutoStory/PokemonSV_AutoStory.cpp | 24 +- .../PokemonSV_AutoStory_Segment_08.cpp | 225 ++++++++++++ .../PokemonSV_AutoStory_Segment_08.h | 51 +++ .../PokemonSV_AutoStory_Segment_09.cpp | 328 ++++++++++++++++++ .../PokemonSV_AutoStory_Segment_09.h | 59 ++++ 7 files changed, 686 insertions(+), 15 deletions(-) create mode 100644 SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp create mode 100644 SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.h create mode 100644 SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.cpp create mode 100644 SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.h diff --git a/SerialPrograms/CMakeLists.txt b/SerialPrograms/CMakeLists.txt index 094cd0d07..7735619f3 100644 --- a/SerialPrograms/CMakeLists.txt +++ b/SerialPrograms/CMakeLists.txt @@ -1449,7 +1449,11 @@ file(GLOB MAIN_SOURCES Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_06.cpp Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_06.h Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_07.cpp - Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_07.h + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_07.h + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.h + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.cpp + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.h Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp diff --git a/SerialPrograms/SerialPrograms.pro b/SerialPrograms/SerialPrograms.pro index dce223b47..15d0d0d76 100644 --- a/SerialPrograms/SerialPrograms.pro +++ b/SerialPrograms/SerialPrograms.pro @@ -723,7 +723,9 @@ SOURCES += \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_04.cpp \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_05.cpp \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_06.cpp \ - Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_07.cpp \ + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_07.cpp \ + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp \ + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.cpp \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp \ Source/PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.cpp \ @@ -1821,7 +1823,9 @@ HEADERS += \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_04.h \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_05.h \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_06.h \ - Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_07.h \ + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_07.h \ + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.h \ + Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.h \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h \ Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h \ Source/PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.h \ diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp index 05adf0c91..6929ff7df 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp @@ -23,8 +23,8 @@ #include "PokemonSV_AutoStory_Segment_05.h" #include "PokemonSV_AutoStory_Segment_06.h" #include "PokemonSV_AutoStory_Segment_07.h" -// #include "PokemonSV_AutoStory_Segment_08.h" -// #include "PokemonSV_AutoStory_Segment_09.h" +#include "PokemonSV_AutoStory_Segment_08.h" +#include "PokemonSV_AutoStory_Segment_09.h" // #include "PokemonSV_AutoStory_Segment_10.h" // #include "PokemonSV_AutoStory_Segment_11.h" // #include "PokemonSV_AutoStory_Segment_12.h" @@ -56,8 +56,8 @@ std::vector> make_autoStory_segment_list(){ segment_list.emplace_back(std::make_unique()); segment_list.emplace_back(std::make_unique()); segment_list.emplace_back(std::make_unique()); - // segment_list.emplace_back(std::make_unique()); - // segment_list.emplace_back(std::make_unique()); + segment_list.emplace_back(std::make_unique()); + segment_list.emplace_back(std::make_unique()); // segment_list.emplace_back(std::make_unique()); // segment_list.emplace_back(std::make_unique()); // segment_list.emplace_back(std::make_unique()); @@ -470,14 +470,14 @@ void AutoStory::test_checkpoints( checkpoint_list.push_back([&](){checkpoint_10(env, context, notif_status_update);}); checkpoint_list.push_back([&](){checkpoint_11(env, context, notif_status_update);}); checkpoint_list.push_back([&](){checkpoint_12(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_13(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_14(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_15(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_16(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_17(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_18(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_19(env, context, notif_status_update);}); - // checkpoint_list.push_back([&](){checkpoint_20(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_13(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_14(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_15(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_16(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_17(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_18(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_19(env, context, notif_status_update);}); + checkpoint_list.push_back([&](){checkpoint_20(env, context, notif_status_update);}); // checkpoint_list.push_back([&](){checkpoint_21(env, context, notif_status_update);}); // checkpoint_list.push_back([&](){checkpoint_22(env, context, notif_status_update);}); // checkpoint_list.push_back([&](){checkpoint_23(env, context, notif_status_update);}); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp new file mode 100644 index 000000000..833ba08c7 --- /dev/null +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.cpp @@ -0,0 +1,225 @@ +/* AutoStory + * + * From: https://github.com/PokemonAutomation/Arduino-Source + * + */ + +#include "CommonFramework/GlobalSettingsPanel.h" +#include "CommonFramework/Exceptions/FatalProgramException.h" +#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/InferenceInfra/InferenceRoutines.h" +#include "CommonFramework/Notifications/ProgramNotifications.h" +#include "CommonFramework/Tools/StatsTracking.h" +#include "CommonFramework/Tools/VideoResolutionCheck.h" +#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" +#include "Pokemon/Pokemon_Strings.h" +#include "PokemonSwSh/Inference/PokemonSwSh_IvJudgeReader.h" +#include "PokemonSV/Programs/PokemonSV_GameEntry.h" +#include "PokemonSV/Programs/PokemonSV_SaveGame.h" +#include "PokemonSV/Inference/PokemonSV_TutorialDetector.h" +#include "PokemonSV_AutoStoryTools.h" +#include "PokemonSV_AutoStory_Segment_08.h" + +//#include +//using std::cout; +//using std::endl; +//#include +//#include + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonSV{ + +using namespace Pokemon; + + + + +std::string AutoStory_Segment_08::name() const{ + return "08: Beat Team Star and arrive at School"; +} + +std::string AutoStory_Segment_08::start_text() const{ + return "Start: At Mesagoza South Pokecenter."; +} + +std::string AutoStory_Segment_08::end_text() const{ + return "End: Battled Team Star, talked to Jacq, standing in classroom."; +} + +void AutoStory_Segment_08::run_segment(SingleSwitchProgramEnvironment& env, BotBaseContext& context, AutoStoryOptions options) const{ + AutoStoryStats& stats = env.current_stats(); + + context.wait_for_all_requests(); + env.console.log("Start Segment 08: Beat Team Star and arrive at School", COLOR_ORANGE); + + checkpoint_13(env, context, options.notif_status_update); + checkpoint_14(env, context, options.notif_status_update); + checkpoint_15(env, context, options.notif_status_update); + + + context.wait_for_all_requests(); + env.console.log("End Segment 08: Beat Team Star and arrive at School", COLOR_GREEN); + stats.m_segment++; + env.update_stats(); + +} + + +void checkpoint_13( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + // reset rate: 0%. 0 resets out of 70. + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + do_action_and_monitor_for_battles(env.program_info(), env.console, context, + [&](const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context){ + + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + + fly_to_overlapping_flypoint(info, env.console, context); + + context.wait_for_all_requests(); + realign_player(info, env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 0, 80, 50); + walk_forward_while_clear_front_path(info, env.console, context, 500); + walk_forward_until_dialog(info, env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 30); + }); + + env.console.log("clear_dialog: Talk with Nemona at Mesagoza gate. Stop when detect battle."); + 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("clear_dialog: Talk with Nemona within Mesagoza. Stop when detect overworld."); + clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, + {CallbackEnum::OVERWORLD, CallbackEnum::PROMPT_DIALOG, CallbackEnum::WHITE_A_BUTTON}); + + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + +void checkpoint_14( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + context.wait_for_all_requests(); + // realign diagonally to the left + realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 80, 0, 100); + // walk forward so you're off center + pbf_move_left_joystick(context, 128, 0, 100, 100); + // realign going straight + realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 128, 0, 100); + // walk forward, while still off center + pbf_move_left_joystick(context, 128, 0, 2000, 100); + // realign diagonally to the right + realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 178, 0, 100); + // walk forward so you're closer to the center + pbf_move_left_joystick(context, 128, 0, 150, 100); + // realign going straight + realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 128, 0, 100); + // walk forward until hit dialog at top of stairs + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60); + // clear dialog until battle. with prompt, battle + 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); + // 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); + // clear dialog until overworld + clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, {CallbackEnum::OVERWORLD}); + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + +void checkpoint_15( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + context.wait_for_all_requests(); + // realign diagonally to the right + realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 178, 0, 100); + // walk forward so you're closer to the center + pbf_move_left_joystick(context, 128, 0, 100, 100); + // realign going straight + realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 128, 0, 100); + // walk forward up stairs + pbf_move_left_joystick(context, 128, 0, 1000, 100); + // realign going straight + realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER); + // walk forward until hit dialog inside the school + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60); + + env.console.log("clear_dialog: Talk with Nemona, Clavell, and Jacq inside the school. Stop when detect overworld."); + clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, + {CallbackEnum::PROMPT_DIALOG, CallbackEnum::OVERWORLD}); + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + + + +} +} +} diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.h new file mode 100644 index 000000000..57d3d200b --- /dev/null +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_08.h @@ -0,0 +1,51 @@ +/* Autostory + * + * From: https://github.com/PokemonAutomation/Arduino-Source + * + */ + +#ifndef PokemonAutomation_PokemonSV_AutoStory_Segment_08_H +#define PokemonAutomation_PokemonSV_AutoStory_Segment_08_H + +#include +#include "Common/Cpp/Options/EnumDropdownOption.h" +#include "CommonFramework/Notifications/EventNotificationsTable.h" +#include "CommonFramework/Options/LanguageOCROption.h" +#include "NintendoSwitch/Options/NintendoSwitch_GoHomeWhenDoneOption.h" +#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h" +#include "PokemonSV/Programs/PokemonSV_Navigation.h" +#include "PokemonSV_AutoStoryTools.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonSV{ + +class AutoStory_Segment_08 : public AutoStory_Segment{ +public: + virtual std::string name() const override; + virtual std::string start_text() const override; + virtual std::string end_text() const override; + virtual void run_segment( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + AutoStoryOptions options) const override; +}; + +// start: Arrived at Mesagoza (South) Pokecenter +// end: Battled Nemona at Mesagoza gate. Entered Mesagoza. +void checkpoint_13(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + +// start: Battled Nemona at Mesagoza gate. Entered Mesagoza. +// end: Battled Team Star at school entrance. +void checkpoint_14(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + +// start: Battled Team Star at school entrance. +// end: Talked to Jacq in classroom. Standing in classroom. +void checkpoint_15(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + + + +} +} +} +#endif diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.cpp new file mode 100644 index 000000000..bb1e302da --- /dev/null +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.cpp @@ -0,0 +1,328 @@ +/* AutoStory + * + * From: https://github.com/PokemonAutomation/Arduino-Source + * + */ + +#include "CommonFramework/GlobalSettingsPanel.h" +#include "CommonFramework/Exceptions/FatalProgramException.h" +#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/InferenceInfra/InferenceRoutines.h" +#include "CommonFramework/Notifications/ProgramNotifications.h" +#include "CommonFramework/Tools/StatsTracking.h" +#include "CommonFramework/Tools/VideoResolutionCheck.h" +#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" +#include "Pokemon/Pokemon_Strings.h" +#include "PokemonSwSh/Inference/PokemonSwSh_IvJudgeReader.h" +#include "PokemonSV/Programs/PokemonSV_GameEntry.h" +#include "PokemonSV/Programs/PokemonSV_SaveGame.h" +#include "PokemonSV/Inference/PokemonSV_TutorialDetector.h" +#include "PokemonSV_AutoStoryTools.h" +#include "PokemonSV_AutoStory_Segment_09.h" + +//#include +//using std::cout; +//using std::endl; +//#include +//#include + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonSV{ + +using namespace Pokemon; + + + + +std::string AutoStory_Segment_09::name() const{ + return "09: Complete tutorial"; +} + +std::string AutoStory_Segment_09::start_text() const{ + return "Start: Battled Team Star, talked to Jacq, standing in classroom."; +} + +std::string AutoStory_Segment_09::end_text() const{ + return "End: Finished tutorial. Acquired all 3 questlines. Got on ride for first time."; +} + +void AutoStory_Segment_09::run_segment(SingleSwitchProgramEnvironment& env, BotBaseContext& context, AutoStoryOptions options) const{ + AutoStoryStats& stats = env.current_stats(); + + context.wait_for_all_requests(); + env.console.overlay().add_log("Start Segment 09: Complete tutorial", COLOR_ORANGE); + + checkpoint_16(env, context, options.notif_status_update); + checkpoint_17(env, context, options.notif_status_update); + checkpoint_18(env, context, options.notif_status_update); + checkpoint_19(env, context, options.notif_status_update); + checkpoint_20(env, context, options.notif_status_update); + + context.wait_for_all_requests(); + env.console.log("End Segment 09: Complete tutorial", COLOR_GREEN); + stats.m_segment++; + env.update_stats(); + +} + + + + +void checkpoint_16( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + context.wait_for_all_requests(); + + // walk left + pbf_move_left_joystick(context, 0, 128, 400, 100); + // walk down to classroom exit. + pbf_move_left_joystick(context, 128, 255, 300, 100); + env.console.log("clear_dialog: Leave classroom."); + clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 5); + + // Wait for detection of school navigation menu + wait_for_gradient_arrow(env.program_info(), env.console, context, {0.031, 0.193, 0.047, 0.078}, 5); + + // enter Cafeteria + pbf_mash_button(context, BUTTON_A, 3 * TICKS_PER_SECOND); + pbf_wait(context, 3 * TICKS_PER_SECOND); + context.wait_for_all_requests(); + + // walk forward + pbf_move_left_joystick(context, 128, 0, 300, 100); + // turn left + pbf_move_left_joystick(context, 0, 128, 50, 100); + + // talk to Arven. stop at overworld. need prompt, overworld, white button A. and book? + env.console.log("Talk with Arven. Receive Titan questline (Path of Legends)."); + press_A_until_dialog(env.program_info(), env.console, context, 1); + mash_button_till_overworld(env.console, context, BUTTON_A, 360); + + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + +void checkpoint_17( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + context.wait_for_all_requests(); + + // walk backwards until dialog + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 20, 255); + env.console.log("Talk with Cassiopeia."); + mash_button_till_overworld(env.console, context, BUTTON_A, 360); + + // re-orient camera + pbf_press_button(context, BUTTON_L, 20, 100); + // move backwards towards front desk + pbf_move_left_joystick(context, 128, 255, 200, 100); + // re-orient camera + pbf_press_button(context, BUTTON_L, 20, 100); + // move right towards navigation kiosk + pbf_move_left_joystick(context, 255, 128, 100, 100); + // open school navigation screen + press_button_until_gradient_arrow(env.program_info(), env.console, context, {0.031, 0.193, 0.047, 0.078}); + // go to staff room + basic_menu_navigation(env.program_info(), env.console, context, {0.031, 0.193, 0.047, 0.078}, {0.031, 0.193 + 0.074219, 0.047, 0.078}, DPAD_DOWN, 1); + // enter staff room + pbf_mash_button(context, BUTTON_A, 3 * TICKS_PER_SECOND); + pbf_wait(context, 3 * TICKS_PER_SECOND); + + env.console.log("clear_dialog: See Geeta. Talk to Nemona. Receive Gym/Elite Four questline (Victory Road)."); + clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, + {CallbackEnum::OVERWORLD, CallbackEnum::PROMPT_DIALOG}); + + + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + +void checkpoint_18( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + context.wait_for_all_requests(); + + // walk down + pbf_move_left_joystick(context, 128, 255, 200, 100); + // walk left towards door + pbf_move_left_joystick(context, 0, 128, 100, 100); + + // wait for school navigation menu + context.wait_for_all_requests(); + wait_for_gradient_arrow(env.program_info(), env.console, context, {0.031, 0.193, 0.047, 0.078}, 10); + // enter Directors office + pbf_mash_button(context, BUTTON_A, 6 * TICKS_PER_SECOND); + + env.console.log("Talk to Clavell in his office, and the professor."); + clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 25, + {CallbackEnum::PROMPT_DIALOG}); // max time between dialog: 17s. set timeout to 25 seconds for buffer. + // mash A to get through the Random A press that you need. when the professor shows you area zero. + pbf_mash_button(context, BUTTON_A, 3 * TICKS_PER_SECOND); + clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, + {CallbackEnum::OVERWORLD, CallbackEnum::PROMPT_DIALOG}); + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + +void checkpoint_19( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + context.wait_for_all_requests(); + + // walk right + pbf_move_left_joystick(context, 255, 128, 50, 100); + // walk down towards door + pbf_move_left_joystick(context, 128, 255, 200, 100); + + env.console.log("Talk to Nemona and go to dorm."); + mash_button_till_overworld(env.console, context, BUTTON_A, 360); + + // walk forward + pbf_move_left_joystick(context, 128, 0, 100, 100); + // walk left towards bed + pbf_move_left_joystick(context, 0, 128, 100, 100); + + env.console.log("Go to bed. Time passes until treasure hunt."); + mash_button_till_overworld(env.console, context, BUTTON_A, 360); + + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + + +void checkpoint_20( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + EventNotificationOption& notif_status_update +){ + AutoStoryStats& stats = env.current_stats(); + bool first_attempt = true; + while (true){ + try{ + if (first_attempt){ + checkpoint_save(env, context, notif_status_update); + first_attempt = false; + } + context.wait_for_all_requests(); + + //walk right towards door + pbf_move_left_joystick(context, 255, 128, 200, 100); + + wait_for_gradient_arrow(env.program_info(), env.console, context, {0.031, 0.193, 0.047, 0.078}, 10); + + env.console.log("Leave dorm for schoolyard."); + mash_button_till_overworld(env.console, context, BUTTON_A, 360); + + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 0); + + env.console.log("Talk to Nemona, Arven, Cassiopeia."); + clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 16, + {CallbackEnum::PROMPT_DIALOG, CallbackEnum::BLACK_DIALOG_BOX}); // max time between dialog: 11 + + // mash A to get through the Random A press that you need. when the Nemona shows you a Poke Gym. + pbf_mash_button(context, BUTTON_A, 250); + + clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 10, + {CallbackEnum::TUTORIAL}); // max time between dialog: 3 + + env.console.log("Get on ride."); + pbf_mash_button(context, BUTTON_PLUS, 1 * TICKS_PER_SECOND); + + mash_button_till_overworld(env.console, context, BUTTON_A, 360); + + break; + }catch(...){ + context.wait_for_all_requests(); + env.console.log("Resetting from checkpoint."); + reset_game(env.program_info(), env.console, context); + stats.m_reset++; + env.update_stats(); + } + } + +} + + + + + +} +} +} diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.h new file mode 100644 index 000000000..c18b3051f --- /dev/null +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_09.h @@ -0,0 +1,59 @@ +/* Autostory + * + * From: https://github.com/PokemonAutomation/Arduino-Source + * + */ + +#ifndef PokemonAutomation_PokemonSV_AutoStory_Segment_09_H +#define PokemonAutomation_PokemonSV_AutoStory_Segment_09_H + +#include +#include "Common/Cpp/Options/EnumDropdownOption.h" +#include "CommonFramework/Notifications/EventNotificationsTable.h" +#include "CommonFramework/Options/LanguageOCROption.h" +#include "NintendoSwitch/Options/NintendoSwitch_GoHomeWhenDoneOption.h" +#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h" +#include "PokemonSV/Programs/PokemonSV_Navigation.h" +#include "PokemonSV_AutoStoryTools.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonSV{ + +class AutoStory_Segment_09 : public AutoStory_Segment{ +public: + virtual std::string name() const override; + virtual std::string start_text() const override; + virtual std::string end_text() const override; + virtual void run_segment( + SingleSwitchProgramEnvironment& env, + BotBaseContext& context, + AutoStoryOptions options) const override; +}; + + +// start: Talked to Jacq in classroom. Standing in classroom. +// end: Talked to Arven. Received Titan questline (Path of Legends). Talked to Cassiopeia. Standing in main hall. +void checkpoint_16(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + +// start: Talked to Arven. Received Titan questline (Path of Legends). +// end: Talked to Cassiopeia. Saw Geeta. Talked to Nemona. Received Gym/Elite Four questline (Victory Road). Standing in staff room. +void checkpoint_17(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + +// start: Talked to Cassiopeia. Saw Geeta. Talked to Nemona. Received Gym/Elite Four questline (Victory Road). Standing in staff room. +// end: Talked to Clavell and the professor. +void checkpoint_18(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + +// start: Talked to Clavell and the professor. +// end: Talked to Nemona, visited dorm, time passed. +void checkpoint_19(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + +// start: Talked to Nemona, visited dorm, time passed. +// end: Get on ride for first time. +void checkpoint_20(SingleSwitchProgramEnvironment& env, BotBaseContext& context, EventNotificationOption& notif_status_update); + + +} +} +} +#endif