diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp index 461d83537b..0edff8c78c 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp @@ -706,11 +706,11 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi } ); - // marker 5 {0.780729, 0.216667} + // marker 5 {0.780729, 0.216667}, {0.775, 0.216667} place_marker_offset_from_flypoint(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, -1, +1, 0ms}, FlyPoint::POKECENTER, - {0.780729, 0.216667} + {0.775, 0.216667} ); handle_when_stationary_in_overworld(env.program_info(), env.console, context, [&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ @@ -734,7 +734,7 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi do_action_and_monitor_for_battles(env.program_info(), env.console, context, [&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ // walk towards wall - direction.change_direction(env.program_info(), env.console, context, 2.949863); + direction.change_direction(env.program_info(), env.console, context, 2.85); walk_forward_while_clear_front_path(env.program_info(), env.console, context, 5600ms); @@ -744,6 +744,7 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi // move back towards wall pbf_move_left_joystick(context, {0, +1}, 800ms, 400ms); + pbf_move_left_joystick(context, {-1, 0}, 800ms, 400ms); pbf_move_left_joystick(context, {-1, +1}, 3200ms, 400ms); direction.change_direction(env.program_info(), env.console, context, 2.575); //2.566167 diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp index 278b1f5b49..d147bfec6f 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp @@ -420,6 +420,17 @@ void move_cursor_to_position_offset_from_flypoint(const ProgramInfo& info, Video const uint16_t push_time_ticks = std::max(uint16_t(magnitude * scale + 0.5), uint16_t(3)); Milliseconds push_time = push_time_ticks * 8ms; pbf_move_left_joystick(context, {move_x, move_y}, push_time, 240ms); + if (closest_dist2 > 100 && i > 4){ + // add a wait for the case where the cursor is bouncing between a snap point and the desired location. + // the wait allows the true distance to be calculated. Without the wait, you could end up capturing a transitional moment + // where the cursor is falling towards the snap point, therefore causing the calculated distance to be + // less than expected, leading to the push being weaker than needed, which could perpetuate the issue + // as the push may not be strong enough to escape the gravity of a snap point. + // e.g. when caught in the gravity of a snap point, sqrt(closest_dist2) could be 45-50. But if you wait to let the + // distance settle, the true sqrt(closest_dist2) could be 68. + // we only add the wait if closest_dist2 is large, so that we don't reduce the efficiency of small adjustments + pbf_wait(context, 500ms); + } context.wait_for_all_requests(); }