Skip to content

Commit 29754ce

Browse files
authored
Autostory: add wait to move_cursor_to_position_offset_from_flypoint. updated routine to move to Alfornada (#1239)
* move_cursor_to_position_offset_from_flypoint: add wait when caught in gravitation pull of snap point * move_from_west_province_area_one_north_to_alfornada: adjust marker placement to account for possible Tera raid.
1 parent 0ee9237 commit 29754ce

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,11 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi
706706
}
707707
);
708708

709-
// marker 5 {0.780729, 0.216667}
709+
// marker 5 {0.780729, 0.216667}, {0.775, 0.216667}
710710
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
711711
{ZoomChange::KEEP_ZOOM, -1, +1, 0ms},
712712
FlyPoint::POKECENTER,
713-
{0.780729, 0.216667}
713+
{0.775, 0.216667}
714714
);
715715
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
716716
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
@@ -734,7 +734,7 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi
734734
do_action_and_monitor_for_battles(env.program_info(), env.console, context,
735735
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
736736
// walk towards wall
737-
direction.change_direction(env.program_info(), env.console, context, 2.949863);
737+
direction.change_direction(env.program_info(), env.console, context, 2.85);
738738

739739
walk_forward_while_clear_front_path(env.program_info(), env.console, context, 5600ms);
740740

@@ -744,6 +744,7 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi
744744

745745
// move back towards wall
746746
pbf_move_left_joystick(context, {0, +1}, 800ms, 400ms);
747+
pbf_move_left_joystick(context, {-1, 0}, 800ms, 400ms);
747748
pbf_move_left_joystick(context, {-1, +1}, 3200ms, 400ms);
748749

749750
direction.change_direction(env.program_info(), env.console, context, 2.575); //2.566167

SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,17 @@ void move_cursor_to_position_offset_from_flypoint(const ProgramInfo& info, Video
420420
const uint16_t push_time_ticks = std::max(uint16_t(magnitude * scale + 0.5), uint16_t(3));
421421
Milliseconds push_time = push_time_ticks * 8ms;
422422
pbf_move_left_joystick(context, {move_x, move_y}, push_time, 240ms);
423+
if (closest_dist2 > 100 && i > 4){
424+
// add a wait for the case where the cursor is bouncing between a snap point and the desired location.
425+
// the wait allows the true distance to be calculated. Without the wait, you could end up capturing a transitional moment
426+
// where the cursor is falling towards the snap point, therefore causing the calculated distance to be
427+
// less than expected, leading to the push being weaker than needed, which could perpetuate the issue
428+
// as the push may not be strong enough to escape the gravity of a snap point.
429+
// 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
430+
// distance settle, the true sqrt(closest_dist2) could be 68.
431+
// we only add the wait if closest_dist2 is large, so that we don't reduce the efficiency of small adjustments
432+
pbf_wait(context, 500ms);
433+
}
423434
context.wait_for_all_requests();
424435
}
425436

0 commit comments

Comments
 (0)