Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,10 @@ void AutoStory::run_autostory(SingleSwitchProgramEnvironment& env, ProController
NOTIFICATION_STATUS_UPDATE
};

if (get_start_segment_index() > get_end_segment_index()){
throw UserSetupError(env.logger(), "The start segment cannot be later than the end segment.");
}

for (size_t segment_index = get_start_segment_index(); segment_index <= get_end_segment_index(); segment_index++){
ALL_AUTO_STORY_SEGMENT_LIST()[segment_index]->run_segment(env, context, options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void AutoStory_Segment_00::run_segment(
ProControllerContext& context,
AutoStoryOptions options
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();
// AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.log("Start Segment 00: Intro Cutscene", COLOR_ORANGE);
Expand All @@ -48,8 +48,6 @@ void AutoStory_Segment_00::run_segment(

context.wait_for_all_requests();
env.console.log("End Segment 00: Intro Cutscene", COLOR_GREEN);
stats.m_segment++;
env.update_stats();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ void AutoStory_Segment_01::run_segment(
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 01: Pick Starter", COLOR_ORANGE);

Expand All @@ -62,8 +64,6 @@ void AutoStory_Segment_01::run_segment(

context.wait_for_all_requests();
env.console.log("End Segment 01: Pick Starter", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

}

Expand Down Expand Up @@ -93,7 +93,7 @@ AutoStoryStats& stats = env.current_stats<AutoStoryStats>();
context.wait_for_all_requests();

break;
}catch(...){
}catch(OperationFailedException&){
// (void)e;
first_attempt = false;
context.wait_for_all_requests();
Expand Down Expand Up @@ -185,7 +185,7 @@ void checkpoint_02(
leave_phone_to_overworld(env.program_info(), env.console, context);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down Expand Up @@ -278,7 +278,7 @@ void checkpoint_03(
leave_box_system_to_overworld(env.program_info(), env.console, context);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "CommonFramework/VideoPipeline/VideoOverlay.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "PokemonSV/Programs/PokemonSV_GameEntry.h"
Expand Down Expand Up @@ -48,15 +49,15 @@ void AutoStory_Segment_02::run_segment(
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 02: First Nemona Battle", COLOR_ORANGE);

checkpoint_04(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 02: First Nemona Battle", COLOR_GREEN);
stats.m_segment++;
env.update_stats();
env.console.log("End Segment 02: First Nemona Battle", COLOR_GREEN);

}

Expand Down Expand Up @@ -93,7 +94,7 @@ void checkpoint_04(
env.console.log("Finished battle.");

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "CommonFramework/VideoPipeline/VideoOverlay.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.h"
Expand Down Expand Up @@ -43,6 +44,8 @@ std::string AutoStory_Segment_03::end_text() const{
void AutoStory_Segment_03::run_segment(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 03: Catch Tutorial", COLOR_ORANGE);

Expand All @@ -52,8 +55,6 @@ void AutoStory_Segment_03::run_segment(SingleSwitchProgramEnvironment& env, ProC

context.wait_for_all_requests();
env.console.log("End Segment 03: Catch Tutorial", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

}

Expand Down Expand Up @@ -84,7 +85,7 @@ void checkpoint_05(
env.console.overlay().add_log("Get mom's sandwich", COLOR_WHITE);
mash_button_till_overworld(env.console, context);
break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down Expand Up @@ -134,7 +135,7 @@ void checkpoint_06(
env.console.overlay().add_log("Finished catch tutorial", COLOR_WHITE);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down Expand Up @@ -188,7 +189,7 @@ void checkpoint_07(
env.console.overlay().add_log("Mystery cry", COLOR_WHITE);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ void AutoStory_Segment_04::run_segment(
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 04: Rescue Legendary", COLOR_ORANGE);

checkpoint_08(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 04: Rescue Legendary", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

}

Expand Down Expand Up @@ -193,7 +193,7 @@ void checkpoint_08(
mash_button_till_overworld(env.console, context, BUTTON_A);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "CommonFramework/VideoPipeline/VideoOverlay.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.h"
Expand Down Expand Up @@ -47,6 +48,8 @@ void AutoStory_Segment_05::run_segment(
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 05: First Arven Battle", COLOR_ORANGE);

Expand All @@ -55,8 +58,6 @@ void AutoStory_Segment_05::run_segment(

context.wait_for_all_requests();
env.console.log("End Segment 05: First Arven Battle", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

}

Expand Down Expand Up @@ -101,7 +102,7 @@ void checkpoint_09(
env.console.overlay().add_log("Receive legendary ball", COLOR_WHITE);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down Expand Up @@ -143,7 +144,7 @@ void checkpoint_10(
mash_button_till_overworld(env.console, context, BUTTON_A);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "CommonFramework/VideoPipeline/VideoOverlay.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "PokemonSV/Inference/PokemonSV_TutorialDetector.h"
Expand Down Expand Up @@ -46,15 +47,15 @@ void AutoStory_Segment_06::run_segment(
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 06: Go to Los Platos", COLOR_ORANGE);

checkpoint_11(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 06: Go to Los Platos", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

}

Expand Down Expand Up @@ -109,7 +110,7 @@ void checkpoint_11(
env.console.overlay().add_log("Reached Los Platos", COLOR_WHITE);

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "CommonFramework/VideoPipeline/VideoOverlay.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.h"
Expand Down Expand Up @@ -46,6 +47,8 @@ void AutoStory_Segment_07::run_segment(
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 07: Go to Mesagoza South", COLOR_ORANGE);

Expand All @@ -63,8 +66,6 @@ void AutoStory_Segment_07::run_segment(

context.wait_for_all_requests();
env.console.log("End Segment 07: Go to Mesagoza South", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

}

Expand Down Expand Up @@ -120,7 +121,7 @@ void checkpoint_12(
env.console.log("Reached Mesagoza (South) Pokecenter.");

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "PokemonSV/Inference/PokemonSV_TutorialDetector.h"
#include "PokemonSV/Programs/PokemonSV_GameEntry.h"
Expand Down Expand Up @@ -44,6 +45,8 @@ void AutoStory_Segment_08::run_segment(
) const{
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 08: Beat Team Star and arrive at School", COLOR_ORANGE);

Expand All @@ -54,8 +57,6 @@ void AutoStory_Segment_08::run_segment(

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();

}

Expand Down Expand Up @@ -100,7 +101,7 @@ void checkpoint_13(


break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down Expand Up @@ -158,7 +159,7 @@ void checkpoint_14(
clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, {CallbackEnum::OVERWORLD});

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down Expand Up @@ -201,7 +202,7 @@ void checkpoint_15(
{CallbackEnum::PROMPT_DIALOG, CallbackEnum::OVERWORLD});

break;
}catch(...){
}catch(OperationFailedException&){
context.wait_for_all_requests();
env.console.log("Resetting from checkpoint.");
reset_game(env.program_info(), env.console, context);
Expand Down
Loading