77#include " CommonFramework/Exceptions/OperationFailedException.h"
88#include " CommonFramework/ProgramStats/StatsTracking.h"
99#include " CommonFramework/Notifications/ProgramNotifications.h"
10+ #include " Common/Cpp/PrettyPrint.h"
1011#include " CommonFramework/VideoPipeline/VideoOverlay.h"
1112#include " CommonTools/Async/InferenceRoutines.h"
1213#include " CommonTools/VisualDetectors/BlackScreenDetector.h"
@@ -62,6 +63,7 @@ ShinyHunt_ShuttleRun::ShinyHunt_ShuttleRun()
6263 {
6364 // {Route::SCRAGGY, "scraggy", "Sewers: Scraggy"},
6465 {Route::WILD_ZONE_19, " wild_zone_19" , " Wild Zone 19" },
66+ {Route::WILD_ZONE_3_TOWER, " wild_zone_3_tower" , " Wild Zone 3 Tower" },
6567 },
6668 LockMode::LOCK_WHILE_RUNNING,
6769 Route::WILD_ZONE_19
@@ -105,6 +107,35 @@ void route_wild_zone_19(SingleSwitchProgramEnvironment& env, ProControllerContex
105107 wait_until_overworld (env.console , context, 50s);
106108}
107109
110+ void route_wild_zone_3_tower (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
111+ for (int i = 0 ; i < 6 ; i++){
112+ // if there is no day/night change and no button drop, this loop should only have three iterations
113+ const double direction = get_facing_direction (env.console , context);
114+ const bool face_east = get_angle_between_facing_directions (direction, 90.0 ) < 10.0 ;
115+ const bool face_west = get_angle_between_facing_directions (direction, 270.0 ) < 10.0 ;
116+ if (i > 0 && (face_east || face_west)){
117+ // we've finished one run of the tower
118+ return ;
119+ }
120+
121+ if (face_east || get_angle_between_facing_directions (direction, 180.0 ) < 10.0 ){
122+ // if facing east or south, run backward
123+ pbf_move_left_joystick (context, 128 , 255 , 500ms, 200ms);
124+ } else if (face_west || get_angle_between_facing_directions (direction, 0.0 ) < 10.0 ){
125+ // if facing west or north, run forward
126+ pbf_move_left_joystick (context, 128 , 0 , 500ms, 200ms);
127+ } else {
128+ OperationFailedException::fire (
129+ ErrorReport::SEND_ERROR_REPORT,
130+ " route_wild_zone_3_tower: unexpected facing direction: " + PokemonAutomation::tostr_fixed (direction, 0 ) + " deg" ,
131+ env.console
132+ );
133+ }
134+ context.wait_for_all_requests ();
135+ wait_until_overworld (env.console , context, 50s);
136+ }
137+ }
138+
108139} // namespace
109140
110141void ShinyHunt_ShuttleRun::program (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
@@ -130,6 +161,9 @@ void ShinyHunt_ShuttleRun::program(SingleSwitchProgramEnvironment& env, ProContr
130161 case Route::WILD_ZONE_19:
131162 route = route_wild_zone_19;
132163 break ;
164+ case Route:: WILD_ZONE_3_TOWER:
165+ route = route_wild_zone_3_tower;
166+ break ;
133167 default :
134168 OperationFailedException::fire (
135169 ErrorReport::SEND_ERROR_REPORT,
0 commit comments