Skip to content

Commit 29b93d9

Browse files
committed
confirm_lead_pokemon_moves()
1 parent 52b42fe commit 29b93d9

File tree

5 files changed

+54
-7
lines changed

5 files changed

+54
-7
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ AutoStory::AutoStory()
478478
"For Start Points that are at Pokecenters, ensure that you fly there so that your character is in the exactly correct start position."
479479
}
480480
, MAINSTORY_NOTE{
481-
"Ensure you have a level 100 Gardevoir with the moves in the following order: Moonblast, Dazzling Gleam, Mystical Fire, Misty Terrain.<br>"
481+
"Ensure you have a level 100 Gardevoir with the moves in the following order: Moonblast, Mystical Fire, Psychic, Misty Terrain.<br>"
482482
"Also, make sure you have two other strong pokemon (e.g. level 100 Talonflames)<br>"
483483
"Refer to the documentation on github for more details."
484484
}
@@ -525,7 +525,7 @@ AutoStory::AutoStory()
525525
true
526526
)
527527
, ENSURE_CORRECT_MOVES(
528-
"<b>Pre-check: Ensure lead Gardevoir has the correct moves:</b><br>"
528+
"<b>Pre-check: Ensure correct moves:</b><br>"
529529
"This is to ensure the lead Gardevoir has the correct moves in the correct order: Moonblast, Mystical Fire, Psychic, Misty Terrain. This is run prior to the main story.",
530530
LockMode::UNLOCK_WHILE_RUNNING,
531531
true
@@ -1361,7 +1361,7 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex
13611361
}
13621362

13631363
if (ENSURE_CORRECT_MOVES && STORY_SECTION == StorySection::MAIN_STORY){
1364-
1364+
confirm_lead_pokemon_moves(env, context, LANGUAGE);
13651365
}
13661366

13671367
run_autostory(env, context);

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,49 @@ void swap_starter_moves(SingleSwitchProgramEnvironment& env, ProControllerContex
488488

489489
}
490490

491+
492+
void confirm_lead_pokemon_moves(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language){
493+
const ProgramInfo& info = env.program_info();
494+
VideoStream& stream = env.console;
495+
496+
// start in the overworld
497+
press_Bs_to_back_to_overworld(info, stream, context);
498+
499+
// open menu, select your lead pokemon
500+
enter_menu_from_overworld(info, stream, context, 0, MenuSide::LEFT);
501+
502+
// enter Pokemon summary screen
503+
pbf_press_button(context, BUTTON_A, 20, 5 * TICKS_PER_SECOND);
504+
pbf_press_dpad(context, DPAD_RIGHT, 15, 1 * TICKS_PER_SECOND);
505+
506+
// confirm that moves are: Moonblast, Mystical Fire, Psychic, Misty Terrain
507+
context.wait_for_all_requests();
508+
VideoSnapshot screen = stream.video().snapshot();
509+
PokemonMovesReader reader(language);
510+
std::string move_0 = reader.read_move(stream.logger(), screen, 0);
511+
std::string move_1 = reader.read_move(stream.logger(), screen, 1);
512+
std::string move_2 = reader.read_move(stream.logger(), screen, 2);
513+
std::string move_3 = reader.read_move(stream.logger(), screen, 3);
514+
stream.log("Current first move: " + move_0);
515+
stream.log("Current second move: " + move_1);
516+
stream.log("Current third move: " + move_2);
517+
stream.log("Current fourth move: " + move_3);
518+
519+
if (move_0 != "moonblast" || move_1 != "mystical-fire" || move_2 != "psychic" || move_3 != "misty-terrain"){
520+
stream.log("Lead Pokemon's moves are wrong. They are supposed to be: Moonblast, Mystical Fire, Psychic, Misty Terrain.");
521+
OperationFailedException::fire(
522+
ErrorReport::SEND_ERROR_REPORT,
523+
"We expect your lead Pokemon to be a Gardevoir with moves in this order: Moonblast, Mystical Fire, Psychic, Misty Terrain. "
524+
"But we see something else instead. If you confirm that your lead Gardevoir does indeed have these moves in this order, "
525+
"and are still getting this error, you can uncheck 'Pre-check: Ensure correct moves', under Advanced settings.\n" + language_warning(language),
526+
stream
527+
);
528+
}
529+
530+
press_Bs_to_back_to_overworld(info, stream, context);
531+
532+
}
533+
491534
void change_settings_prior_to_autostory_segment_mode(SingleSwitchProgramEnvironment& env, ProControllerContext& context, size_t current_segment_num, Language language){
492535
// get index of `Options` in the Main Menu, which depends on where you are in Autostory
493536
int8_t options_index;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ void config_option(ProControllerContext& context, int change_option_value);
174174
// enter menu and swap the first and third moves for your starter
175175
void swap_starter_moves(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language);
176176

177+
// confirm the moves for the Lead pokemon: Moonblast, Mystical Fire, Psychic, Misty Terrain
178+
// start and end in the overworld
179+
void confirm_lead_pokemon_moves(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language);
180+
177181
// run the given `action`. if detect a battle, stop the action, and throw exception
178182
void do_action_and_monitor_for_battles(
179183
const ProgramInfo& info,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ void checkpoint_88(SingleSwitchProgramEnvironment& env, ProControllerContext& co
338338

339339
env.console.log("Battle Elite Four 1.");
340340
SinglesMoveEntry move1{SinglesMoveType::Move1, false}; // Moonblast
341-
SinglesMoveEntry move3{SinglesMoveType::Move3, false}; // Mystical Fire
341+
SinglesMoveEntry move2{SinglesMoveType::Move2, false}; // Mystical Fire
342342
SinglesMoveEntry move4{SinglesMoveType::Move4, false}; // Misty Terrain
343343
std::vector<SinglesMoveEntry> move_table1 = {move1, move4, move1};
344344
bool terastallized = false;
@@ -366,8 +366,8 @@ void checkpoint_88(SingleSwitchProgramEnvironment& env, ProControllerContext& co
366366
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60);
367367
clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW, CallbackEnum::PROMPT_DIALOG});
368368

369-
env.console.log("Battle Elite Four 2."); // select move 3, which should be a fire move. to battle the steel trainer
370-
std::vector<SinglesMoveEntry> move_table2 = {move3};
369+
env.console.log("Battle Elite Four 2."); // select move 2, which should be a fire move. to battle the steel trainer
370+
std::vector<SinglesMoveEntry> move_table2 = {move2};
371371
is_won = run_pokemon(env.console, context, move_table2, true, terastallized);
372372
if (!is_won){// throw exception if we lose
373373
OperationFailedException::fire(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void checkpoint_91(SingleSwitchProgramEnvironment& env, ProControllerContext& co
143143
if (!is_won){// throw exception if we lose
144144
OperationFailedException::fire(
145145
ErrorReport::SEND_ERROR_REPORT,
146-
"Failed to beat the Ground trainer. Reset.",
146+
"Failed to beat the Penny. Reset.",
147147
env.console
148148
);
149149
}

0 commit comments

Comments
 (0)