@@ -91,20 +91,28 @@ void route_alpha_pidgeot(SingleSwitchProgramEnvironment& env, ProControllerConte
9191}
9292
9393void route_wild_zone_3_tower (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
94+ bool been_at_downstairs = false ;
95+ bool been_at_upstairs_after_downstairs = false ;
96+
9497 for (int i = 0 ; i < 6 ; i++){
9598 // if there is no day/night change and no button drop, this loop should only have three iterations
9699 const double direction = get_facing_direction (env.console , context);
97100 const bool face_east = get_angle_between_facing_directions (direction, 90.0 ) < 10.0 ;
98101 const bool face_west = get_angle_between_facing_directions (direction, 270.0 ) < 10.0 ;
99- if (i > 0 && (face_east || face_west)){
100- // we've finished one run of the tower
101- return ;
102+ const bool face_south = get_angle_between_facing_directions (direction, 180.0 ) < 10.0 ;
103+ const bool face_north = get_angle_between_facing_directions (direction, 0.0 ) < 10.0 ;
104+ if (face_east || face_west){ // we are at downstars
105+ been_at_downstairs = true ;
102106 }
103-
104- if (face_east || get_angle_between_facing_directions (direction, 180.0 ) < 10.0 ){
107+ else if (been_at_downstairs){
108+ // we are not at downstairs right now, but we've been to the downstairs, so we
109+ // must be at upstairs
110+ been_at_upstairs_after_downstairs = true ;
111+ }
112+ if (face_east || face_south){
105113 // if facing east or south, run backward
106114 pbf_move_left_joystick (context, 128 , 255 , 500ms, 200ms);
107- } else if (face_west || get_angle_between_facing_directions (direction, 0.0 ) < 10.0 ){
115+ } else if (face_west || face_north ){
108116 // if facing west or north, run forward
109117 pbf_move_left_joystick (context, 128 , 0 , 500ms, 200ms);
110118 } else {
@@ -116,6 +124,11 @@ void route_wild_zone_3_tower(SingleSwitchProgramEnvironment& env, ProControllerC
116124 }
117125 context.wait_for_all_requests ();
118126 wait_until_overworld (env.console , context, 50s);
127+
128+ if (been_at_upstairs_after_downstairs){
129+ // we've finished one run of the tower
130+ return ;
131+ }
119132 }
120133}
121134
@@ -158,6 +171,9 @@ void ShinyHunt_ShuttleRun::program(SingleSwitchProgramEnvironment& env, ProContr
158171 env.console , context,
159172 [&](ProControllerContext& context){
160173 do {
174+ const std::string log_msg = " Round " + std::to_string (stats.resets + 1 );
175+ env.log (log_msg);
176+ env.console .overlay ().add_log (log_msg);
161177 shiny_sound_handler.process_pending (context);
162178 send_program_status_notification (env, NOTIFICATION_STATUS);
163179 route (env, context);
0 commit comments