|
4 | 4 | * |
5 | 5 | */ |
6 | 6 |
|
| 7 | + #include "PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.h" |
| 8 | + |
7 | 9 | #include "CommonFramework/Exceptions/OperationFailedException.h" |
8 | 10 | #include "CommonTools/Async/InferenceRoutines.h" |
9 | 11 | #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" |
@@ -74,11 +76,81 @@ void AutoStory_Checkpoint_104::run_checkpoint(SingleSwitchProgramEnvironment& en |
74 | 76 | // } |
75 | 77 |
|
76 | 78 | void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ |
77 | | - // checkpoint_reattempt_loop(env, context, notif_status_update, stats, |
78 | | - // [&](size_t attempt_number){ |
| 79 | + checkpoint_reattempt_loop(env, context, notif_status_update, stats, |
| 80 | + [&](size_t attempt_number){ |
| 81 | + |
| 82 | + pbf_press_button(context, BUTTON_L, 30, 10); |
| 83 | + pbf_move_left_joystick(context, 128, 0, 400, 50); |
| 84 | + pbf_move_left_joystick(context, 0, 128, 130, 50); |
| 85 | + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 10); |
| 86 | + |
| 87 | + // now in elevator |
| 88 | + mash_button_till_overworld(env.console, context, BUTTON_A); |
| 89 | + |
| 90 | + pbf_move_left_joystick(context, 255, 128, 70, 50); |
| 91 | + |
| 92 | + // talk to the AI professor |
| 93 | + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 10); |
| 94 | + mash_button_till_overworld(env.console, context, BUTTON_A); |
| 95 | + |
| 96 | + // put the book in the machine |
| 97 | + pbf_press_button(context, BUTTON_L, 30, 10); |
| 98 | + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 10); |
| 99 | + |
| 100 | + |
| 101 | + clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 120, {CallbackEnum::BATTLE, CallbackEnum::PROMPT_DIALOG, CallbackEnum::DIALOG_ARROW}); |
| 102 | + |
| 103 | + |
| 104 | + env.console.log("Battle AI Professor."); |
| 105 | + SinglesMoveEntry move1{SinglesMoveType::Move1, false}; // Moonblast |
| 106 | + SinglesMoveEntry move3{SinglesMoveType::Move3, false}; // Psychic |
| 107 | + |
| 108 | + |
| 109 | + std::vector<SinglesMoveEntry> move_table1 = {move3, move1}; |
| 110 | + bool terastallized = false; |
| 111 | + // start with Psychic to defeat Iron Moth for Violet, which quad resists Moonblast. |
| 112 | + bool is_won = run_pokemon(env.console, context, move_table1, true, terastallized); |
| 113 | + if (!is_won){// throw exception if we lose |
| 114 | + OperationFailedException::fire( |
| 115 | + ErrorReport::SEND_ERROR_REPORT, |
| 116 | + "Failed to beat the AI Professor. Reset.", |
| 117 | + env.console |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 121 | + |
| 122 | + clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE_DIALOG_ARROW, 120, {CallbackEnum::DIALOG_ARROW}, false); |
| 123 | + |
| 124 | + pbf_mash_button(context, BUTTON_A, 50); |
| 125 | + |
| 126 | + |
| 127 | + wait_for_gradient_arrow(env.program_info(), env.console, context, {0.75, 0.62, 0.05, 0.35}, 30); |
| 128 | + |
| 129 | + pbf_press_dpad(context, DPAD_DOWN, 13, 20); |
| 130 | + pbf_mash_button(context, BUTTON_A, 20); |
| 131 | + |
| 132 | + pbf_wait(context, 1000ms); |
| 133 | + pbf_press_dpad(context, DPAD_UP, 13, 20); |
| 134 | + pbf_mash_button(context, BUTTON_A, 500); |
| 135 | + |
| 136 | + env.console.log("Battle AI Professor's Koraidon/Miraidon."); |
| 137 | + SinglesMoveEntry move4{SinglesMoveType::Move4, false}; // Koraidon/Miraidon: Tera Blast |
| 138 | + SinglesMoveEntry move4_tera{SinglesMoveType::Move4, true}; // Koraidon/Miraidon: Tera Blast |
| 139 | + std::vector<SinglesMoveEntry> move_table2 = {move4, move4, move4, move4, move4, move4_tera}; |
| 140 | + is_won = run_pokemon(env.console, context, move_table2, true, terastallized); |
| 141 | + if (!is_won){// throw exception if we lose |
| 142 | + OperationFailedException::fire( |
| 143 | + ErrorReport::SEND_ERROR_REPORT, |
| 144 | + "Failed to beat the AI Professor, round 2. This shouldn't be possible. Reset.", |
| 145 | + env.console |
| 146 | + ); |
| 147 | + } |
| 148 | + |
| 149 | + mash_button_till_overworld(env.console, context, BUTTON_A, 800); |
| 150 | + |
79 | 151 |
|
80 | 152 |
|
81 | | - // }); |
| 153 | + }); |
82 | 154 | } |
83 | 155 |
|
84 | 156 | void checkpoint_105(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ |
|
0 commit comments