@@ -50,10 +50,21 @@ std::unique_ptr<StatsTracker> ShinyHuntDeoxys_Descriptor::make_stats() const{
5050}
5151
5252ShinyHuntDeoxys::ShinyHuntDeoxys ()
53- : WALK_UP_DOWN_TIME0(
53+ : STARTPOS(
54+ " <b>Starting Position:</b><br>" ,
55+ {
56+ {StartPos::boat, " boat" , " Boat/Walk up" },
57+ {StartPos::rock_unsolved, " rock_unsolved" , " Triangle rock, puzzle is unsolved" },
58+ {StartPos::rock_solved, " rock_solved" , " Triangle rock, puzzle is already solved" },
59+ },
60+ LockMode::LOCK_WHILE_RUNNING,
61+ StartPos::rock_unsolved
62+ )
63+ , WALK_UP_DOWN_TIME(
5464 " <b>Walk up/down time</b><br>Spend this long to run up to the triangle rock." ,
5565 LockMode::LOCK_WHILE_RUNNING,
56- " 3520 ms"
66+ TICKS_PER_SECOND,
67+ " 440"
5768 )
5869 , NOTIFICATION_SHINY(
5970 " Shiny Found" ,
@@ -67,11 +78,12 @@ ShinyHuntDeoxys::ShinyHuntDeoxys()
6778 &NOTIFICATION_PROGRAM_FINISH,
6879 })
6980{
70- PA_ADD_OPTION (WALK_UP_DOWN_TIME0);
81+ PA_ADD_OPTION (STARTPOS);
82+ PA_ADD_OPTION (WALK_UP_DOWN_TIME);
7183 PA_ADD_OPTION (NOTIFICATIONS);
7284}
7385
74- void ShinyHuntDeoxys::solve_puzzle (SingleSwitchProgramEnvironment& env, ProControllerContext & context) {
86+ void ShinyHuntDeoxys::solve_puzzle (SingleSwitchProgramEnvironment& env, SwitchControllerContext & context) {
7587 env.log (" Step 1: Press A from below." );
7688 pbf_press_button (context, BUTTON_A, 20 , 40 );
7789
@@ -175,7 +187,7 @@ void ShinyHuntDeoxys::solve_puzzle(SingleSwitchProgramEnvironment& env, ProContr
175187 context.wait_for_all_requests ();
176188}
177189
178- void ShinyHuntDeoxys::program (SingleSwitchProgramEnvironment& env, ProControllerContext & context){
190+ void ShinyHuntDeoxys::program (SingleSwitchProgramEnvironment& env, SwitchControllerContext & context){
179191 ShinyHuntDeoxys_Descriptor::Stats& stats = env.current_stats <ShinyHuntDeoxys_Descriptor::Stats>();
180192
181193 /*
@@ -195,18 +207,36 @@ void ShinyHuntDeoxys::program(SingleSwitchProgramEnvironment& env, ProController
195207 * Would have to handle both PokeNav and random encounters for ray/others? Why is PokeNav a thing???
196208 */
197209
198- while (true ) {
199- env.log (" Walking up to Deoxys." );
200- // Walk up to the triangle rock from the ship. No bike allowed.
201- ssf_press_button (context, BUTTON_B, 0ms, WALK_UP_DOWN_TIME0);
202- pbf_press_dpad (context, DPAD_UP, WALK_UP_DOWN_TIME0, 160ms);
203- context.wait_for_all_requests ();
204-
205- solve_puzzle (env, context);
210+ bool first_run = true ;
206211
207- // Start battle.
208- pbf_press_button (context, BUTTON_A, 20 , 40 );
212+ while (true ) {
213+ if (first_run) {
214+ switch (STARTPOS) {
215+ case StartPos::rock_solved:
216+ env.log (" StartPos: Already in position." );
217+ break ;
218+ case StartPos::boat:
219+ env.log (" StartPos: Walking up to Deoxys." );
220+ // Walk up to the triangle rock from the ship. No bike allowed.
221+ ssf_press_button (context, BUTTON_B, 0 , WALK_UP_DOWN_TIME);
222+ pbf_press_dpad (context, DPAD_UP, WALK_UP_DOWN_TIME, 20 );
223+ context.wait_for_all_requests ();
224+ case StartPos::rock_unsolved:
225+ env.log (" StartPos: Solving puzzle." );
226+ solve_puzzle (env, context);
227+ break ;
228+ default :
229+ OperationFailedException::fire (
230+ ErrorReport::SEND_ERROR_REPORT,
231+ " Invalid starting position selected." ,
232+ env.console
233+ );
234+ break ;
235+ }
236+ first_run = false ;
237+ }
209238
239+ // Start battle
210240 bool legendary_shiny = handle_encounter (env.console , context, true );
211241 if (legendary_shiny) {
212242 stats.shinies ++;
@@ -222,10 +252,20 @@ void ShinyHuntDeoxys::program(SingleSwitchProgramEnvironment& env, ProController
222252 context.wait_for_all_requests ();
223253
224254 // Walk down from the triangle rock to the ship.
225- ssf_press_button (context, BUTTON_B, 0ms, WALK_UP_DOWN_TIME0);
226- pbf_press_dpad (context, DPAD_DOWN, WALK_UP_DOWN_TIME0, 160ms);
255+ env.log (" Walking down to ship." );
256+ ssf_press_button (context, BUTTON_B, 0 , WALK_UP_DOWN_TIME);
257+ pbf_press_dpad (context, DPAD_DOWN, WALK_UP_DOWN_TIME, 20 );
258+ context.wait_for_all_requests ();
259+
260+ env.log (" Walking up to Deoxys rock." );
261+ // Walk up to the triangle rock from the ship. Bike is not allowed on Birth Island.
262+ ssf_press_button (context, BUTTON_B, 0 , WALK_UP_DOWN_TIME);
263+ pbf_press_dpad (context, DPAD_UP, WALK_UP_DOWN_TIME, 20 );
227264 context.wait_for_all_requests ();
228265
266+ env.log (" Solving puzzle." );
267+ solve_puzzle (env, context);
268+
229269 stats.resets ++;
230270 env.update_stats ();
231271 }
0 commit comments