Skip to content

Commit 2246b4a

Browse files
authored
Autostory: Clavell battle, Elite Four (#735)
* checkpoint 85 * segment 34 setup * checkpoint 86 * merge Elite Four and Clavell battle checkpoints into the same segment. * checkpoint 87: Elite Four test * add more blank checkpoints * update checkpoint 87: elite four test * update do_action_and_monitor_for_overworld() * checkpoint_88: beat Elite four. * checkpoint 89: beat Geeta
1 parent 82c10fb commit 2246b4a

File tree

7 files changed

+494
-30
lines changed

7 files changed

+494
-30
lines changed

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ std::vector<std::unique_ptr<AutoStory_Segment>> make_autoStory_segment_list(){
109109
segment_list.emplace_back(std::make_unique<AutoStory_Segment_30>());
110110
segment_list.emplace_back(std::make_unique<AutoStory_Segment_31>());
111111
segment_list.emplace_back(std::make_unique<AutoStory_Segment_32>());
112-
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_33>());
112+
segment_list.emplace_back(std::make_unique<AutoStory_Segment_33>());
113113
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_34>());
114114
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_35>());
115115

@@ -253,7 +253,7 @@ AutoStory::AutoStory()
253253
"For Start Points that are at Pokecenters, ensure that you fly there so that your character is in the exactly correct start position."
254254
}
255255
, MAINSTORY_NOTE{
256-
"Ensure you have a level 100 Gardevoir with the moves in the following order: Moonblast, Dazzling Gleam, Psychic, Mystical Fire.<br>"
256+
"Ensure you have a level 100 Gardevoir with the moves in the following order: Moonblast, Dazzling Gleam, Mystical Fire, Misty Terrain.<br>"
257257
"Also, make sure you have two other strong pokemon (e.g. level 100 Talonflames)<br>"
258258
"Refer to the documentation on github for more details."
259259
}
@@ -537,10 +537,10 @@ AutoStory::AutoStory()
537537
}
538538

539539
void AutoStory::on_config_value_changed(void* object){
540-
ConfigOptionState state = (STARTPOINT_TUTORIAL.index() <= 1 && STORY_SECTION == StorySection::TUTORIAL)
541-
? ConfigOptionState::ENABLED
542-
: ConfigOptionState::HIDDEN;
543-
STARTERCHOICE.set_visibility(state);
540+
// ConfigOptionState state = (STARTPOINT_TUTORIAL.index() <= 1 && STORY_SECTION == StorySection::TUTORIAL)
541+
// ? ConfigOptionState::ENABLED
542+
// : ConfigOptionState::HIDDEN;
543+
// STARTERCHOICE.set_visibility(state);
544544

545545
if (STORY_SECTION == StorySection::TUTORIAL){
546546
STARTPOINT_TUTORIAL.set_visibility(ConfigOptionState::ENABLED);
@@ -730,10 +730,15 @@ void AutoStory::test_checkpoints(
730730
checkpoint_list.push_back([&](){checkpoint_84(env, context, notif_status_update, stats);});
731731
checkpoint_list.push_back([&](){checkpoint_85(env, context, notif_status_update, stats);});
732732
checkpoint_list.push_back([&](){checkpoint_86(env, context, notif_status_update, stats);});
733-
checkpoint_list.push_back([&](){checkpoint_87(env, context, notif_status_update, stats);});
733+
checkpoint_list.push_back([&](){checkpoint_87(env, context, notif_status_update, stats, language, starter_choice);});
734734
checkpoint_list.push_back([&](){checkpoint_88(env, context, notif_status_update, stats);});
735735
checkpoint_list.push_back([&](){checkpoint_89(env, context, notif_status_update, stats);});
736736
checkpoint_list.push_back([&](){checkpoint_90(env, context, notif_status_update, stats);});
737+
checkpoint_list.push_back([&](){checkpoint_91(env, context, notif_status_update, stats);});
738+
checkpoint_list.push_back([&](){checkpoint_92(env, context, notif_status_update, stats);});
739+
checkpoint_list.push_back([&](){checkpoint_93(env, context, notif_status_update, stats);});
740+
checkpoint_list.push_back([&](){checkpoint_94(env, context, notif_status_update, stats);});
741+
checkpoint_list.push_back([&](){checkpoint_95(env, context, notif_status_update, stats);});
737742

738743

739744
if (end == 0){

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void clear_dialog(VideoStream& stream, ProControllerContext& context,
9292

9393
AdvanceDialogWatcher advance_dialog(COLOR_RED);
9494
OverworldWatcher overworld(stream.logger(), COLOR_CYAN);
95-
PromptDialogWatcher prompt(COLOR_YELLOW, {0.50, 0.30, 0.40, 0.60});
95+
PromptDialogWatcher prompt(COLOR_YELLOW, {0.50, 0.25, 0.40, 0.65});
9696
WhiteButtonWatcher whitebutton(COLOR_GREEN, WhiteButton::ButtonA_DarkBackground, {0.725, 0.833, 0.024, 0.045}); // {0.650, 0.650, 0.140, 0.240}
9797
DialogArrowWatcher dialog_arrow(COLOR_RED, stream.overlay(), {0.850, 0.820, 0.020, 0.050}, 0.8365, 0.846);
9898
NormalBattleMenuWatcher battle(COLOR_ORANGE);
@@ -653,6 +653,40 @@ void handle_unexpected_battles(
653653
}
654654
}
655655

656+
void do_action_and_monitor_for_overworld(
657+
const ProgramInfo& info,
658+
VideoStream& stream,
659+
ProControllerContext& context,
660+
std::function<
661+
void(const ProgramInfo& info,
662+
VideoStream& stream,
663+
ProControllerContext& context)
664+
>&& action
665+
){
666+
667+
OverworldWatcher overworld(stream.logger(), COLOR_CYAN);
668+
669+
int ret = run_until<ProControllerContext>(
670+
stream, context,
671+
[&](ProControllerContext& context){
672+
context.wait_for_all_requests();
673+
action(info, stream, context);
674+
},
675+
{overworld}
676+
);
677+
if (ret < 0){
678+
// successfully completed action detecting the overworld
679+
return;
680+
}else if (ret == 0){
681+
OperationFailedException::fire(
682+
ErrorReport::SEND_ERROR_REPORT,
683+
"do_action_and_monitor_for_overworld(): Failed to complete action. Detected overworld.",
684+
stream
685+
);
686+
}
687+
688+
}
689+
656690
void handle_when_stationary_in_overworld(
657691
const ProgramInfo& info,
658692
VideoStream& stream,

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ void handle_unexpected_battles(
180180
>&& action
181181
);
182182

183+
// run the given `action`. if detect the overworld, stop the action, and throw exception
184+
void do_action_and_monitor_for_overworld(
185+
const ProgramInfo& info,
186+
VideoStream& stream,
187+
ProControllerContext& context,
188+
std::function<void(const ProgramInfo& info,
189+
VideoStream& stream,
190+
ProControllerContext& context)>&& action
191+
);
192+
183193
// if stationary in overworld for an amount of time (seconds_stationary), run `recovery_action` then try `action` again
184194
// return once successfully completed `action`
185195
// throw exception if fails to complete `action` within a certain amount of time (minutes_timeout).

0 commit comments

Comments
 (0)