Skip to content

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1413,10 +1413,11 @@ void check_num_sunflora_found(SingleSwitchProgramEnvironment& env, ProController
}

void checkpoint_reattempt_loop(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
const std::string& checkpoint_text,
std::function<void(size_t attempt_number)>&& action,
bool day_skip
){
Expand All @@ -1432,13 +1433,24 @@ void checkpoint_reattempt_loop(
save_game_from_overworld(env.program_info(), env.console, context);
}

env.console.log(checkpoint_text + " Num attempts: " + std::to_string(i));

context.wait_for_all_requests();
action(i);

enter_menu_from_overworld(env.program_info(), env.console, context, -1);

break;
}catch (OperationFailedException& e){
if (i == 10){ // send an error report for debugging if 10 failed attempts for a given checkpoint.
OperationFailedException exception(
ErrorReport::SEND_ERROR_REPORT,
"10 failed attempts. " + checkpoint_text,
env.console
);
exception.send_recoverable_notification(env);
}

if (i > max_attempts){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
Expand All @@ -1459,10 +1471,11 @@ void checkpoint_reattempt_loop(
}

void checkpoint_reattempt_loop_tutorial(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
const std::string& checkpoint_text,
std::function<void(size_t attempt_number)>&& action
){
size_t max_attempts = 100;
Expand All @@ -1475,6 +1488,8 @@ void checkpoint_reattempt_loop_tutorial(
send_program_status_notification(env, notif_status_update, "Saved at checkpoint.");
}

env.console.log(checkpoint_text + " Num attempts: " + std::to_string(i));

context.wait_for_all_requests();
action(i);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ class AutoStory_Checkpoint {
ProControllerContext& context,
AutoStoryOptions options,
AutoStoryStats& stats) const = 0;

std::string checkpoint_text() const {
return "Checkpoint:: " + name() + ". Start point:" + start_text();
}
};


Expand Down Expand Up @@ -372,19 +376,21 @@ void check_num_sunflora_found(SingleSwitchProgramEnvironment& env, ProController
// save prior to first attempt
// throw exception if we try to exceed max_attempts.
void checkpoint_reattempt_loop(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
const std::string& checkpoint_text,
std::function<void(size_t attempt_number)>&& action,
bool day_skip = true
);

void checkpoint_reattempt_loop_tutorial(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
const std::string& checkpoint_text,
std::function<void(size_t attempt_number)>&& action
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,33 @@ std::string AutoStory_Checkpoint_01::name() const{ return "001 - " + AutoStory_S
std::string AutoStory_Checkpoint_01::start_text() const{ return "Done cutscene. Stood up from chair. Walked to left side of room.";}
std::string AutoStory_Checkpoint_01::end_text() const{ return "Standing in room. Updated settings";}
void AutoStory_Checkpoint_01::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_01(env, context, options.notif_status_update, stats, options.language);
checkpoint_01(env, context, options.notif_status_update, stats, checkpoint_text(), options.language);
}

std::string AutoStory_Checkpoint_02::name() const{ return "002 - " + AutoStory_Segment_01().name(); }
std::string AutoStory_Checkpoint_02::start_text() const{ return AutoStory_Checkpoint_01().end_text();}
std::string AutoStory_Checkpoint_02::end_text() const{ return "Standing in front of the 'power of science' NPC. Cleared map tutorial.";}
void AutoStory_Checkpoint_02::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_02(env, context, options.notif_status_update, stats);
checkpoint_02(env, context, options.notif_status_update, stats, checkpoint_text());
}

std::string AutoStory_Checkpoint_03::name() const{ return "003 - " + AutoStory_Segment_01().name(); }
std::string AutoStory_Checkpoint_03::start_text() const{ return AutoStory_Checkpoint_02().end_text();}
std::string AutoStory_Checkpoint_03::end_text() const{ return "Received starter Pokemon. Changed move order. Cleared autoheal tutorial.";}
void AutoStory_Checkpoint_03::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_03(env, context, options.notif_status_update, stats, options.language, options.starter_choice);
checkpoint_03(env, context, options.notif_status_update, stats, checkpoint_text(), options.language, options.starter_choice);
}


void checkpoint_01(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
AutoStoryStats& stats,
const std::string& checkpoint_text,
Language language
){
checkpoint_reattempt_loop_tutorial(env, context, notif_status_update, stats,
checkpoint_reattempt_loop_tutorial(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){

context.wait_for_all_requests();
Expand All @@ -110,12 +111,13 @@ void checkpoint_01(
}

void checkpoint_02(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
){
checkpoint_reattempt_loop_tutorial(env, context, notif_status_update, stats,
checkpoint_reattempt_loop_tutorial(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){

context.wait_for_all_requests();
Expand Down Expand Up @@ -184,14 +186,15 @@ void checkpoint_02(
}

void checkpoint_03(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
const std::string& checkpoint_text,
Language language,
StarterChoice starter_choice
){
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
checkpoint_reattempt_loop(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){

context.wait_for_all_requests();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void checkpoint_01(
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
const std::string& checkpoint_text,
Language language
);

Expand All @@ -67,7 +68,8 @@ void checkpoint_02(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
);

// start: standing in front of power of science NPC. Cleared map tutorial.
Expand All @@ -77,6 +79,7 @@ void checkpoint_03(
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats,
const std::string& checkpoint_text,
Language language,
StarterChoice starter_choice
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ std::string AutoStory_Checkpoint_04::name() const{ return "004 - " + AutoStory_S
std::string AutoStory_Checkpoint_04::start_text() const{ return "Received starter Pokemon. Changed move order. Cleared autoheal tutorial.";}
std::string AutoStory_Checkpoint_04::end_text() const{ return "Battled Nemona on the beach.";}
void AutoStory_Checkpoint_04::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_04(env, context, options.notif_status_update, stats);
checkpoint_04(env, context, options.notif_status_update, stats, checkpoint_text());
}


void checkpoint_04(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
){
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
checkpoint_reattempt_loop(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){
context.wait_for_all_requests();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ void checkpoint_04(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,31 @@ std::string AutoStory_Checkpoint_05::name() const{ return "005 - " + AutoStory_S
std::string AutoStory_Checkpoint_05::start_text() const{ return "Battled Nemona on the beach.";}
std::string AutoStory_Checkpoint_05::end_text() const{ return "Met mom at gate. Received mom's sandwich.";}
void AutoStory_Checkpoint_05::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_05(env, context, options.notif_status_update, stats);
checkpoint_05(env, context, options.notif_status_update, stats, checkpoint_text());
}

std::string AutoStory_Checkpoint_06::name() const{ return "006 - " + AutoStory_Segment_03().name(); }
std::string AutoStory_Checkpoint_06::start_text() const{ return AutoStory_Checkpoint_05().end_text();}
std::string AutoStory_Checkpoint_06::end_text() const{ return "Cleared catch tutorial.";}
void AutoStory_Checkpoint_06::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_06(env, context, options.notif_status_update, stats);
checkpoint_06(env, context, options.notif_status_update, stats, checkpoint_text());
}

std::string AutoStory_Checkpoint_07::name() const{ return "007 - " + AutoStory_Segment_03().name(); }
std::string AutoStory_Checkpoint_07::start_text() const{ return AutoStory_Checkpoint_06().end_text();}
std::string AutoStory_Checkpoint_07::end_text() const{ return "Moved to cliff. Heard mystery cry. Standing in front of Nemona near the cliff.";}
void AutoStory_Checkpoint_07::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_07(env, context, options.notif_status_update, stats);
checkpoint_07(env, context, options.notif_status_update, stats, checkpoint_text());
}

void checkpoint_05(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
){
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
checkpoint_reattempt_loop(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){
context.wait_for_all_requests();

Expand All @@ -103,12 +104,13 @@ void checkpoint_05(
}

void checkpoint_06(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
){
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
checkpoint_reattempt_loop(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){

context.wait_for_all_requests();
Expand Down Expand Up @@ -141,12 +143,13 @@ void checkpoint_06(
}

void checkpoint_07(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
){
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
checkpoint_reattempt_loop(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){

context.wait_for_all_requests();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ void checkpoint_05(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
);

// start: Met mom at gate. Received mom's sandwich.
Expand All @@ -65,7 +66,8 @@ void checkpoint_06(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
);

// start: Cleared catch tutorial.
Expand All @@ -74,7 +76,8 @@ void checkpoint_07(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,19 @@ std::string AutoStory_Checkpoint_08::name() const{ return "008 - " + AutoStory_S
std::string AutoStory_Checkpoint_08::start_text() const{ return "Moved to cliff. Heard mystery cry. Standing in front of Nemona near the cliff.";}
std::string AutoStory_Checkpoint_08::end_text() const{ return "Rescued Koraidon/Miraidon and escaped from the Houndoom Cave. Standing next to Koraidon/Miraidon just outside the cave exit.";}
void AutoStory_Checkpoint_08::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_08(env, context, options.notif_status_update, stats);
checkpoint_08(env, context, options.notif_status_update, stats, checkpoint_text());
}



void checkpoint_08(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
){
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
checkpoint_reattempt_loop(env, context, notif_status_update, stats, checkpoint_text,
[&](size_t attempt_number){

context.wait_for_all_requests();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ void checkpoint_08(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
EventNotificationOption& notif_status_update,
AutoStoryStats& stats
AutoStoryStats& stats,
const std::string& checkpoint_text
);


Expand Down
Loading
Loading