Skip to content

Commit 2538234

Browse files
committed
checkpoint 49: team star base to East Province (Area Two) Pokecenter.
1 parent 5c0f168 commit 2538234

File tree

4 files changed

+143
-5
lines changed

4 files changed

+143
-5
lines changed

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

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ std::string AutoStory_Segment_22::start_text() const{
3939
}
4040

4141
std::string AutoStory_Segment_22::end_text() const{
42-
return "End: ";
42+
return "End: Defeated Team Star (Fire). At East Province (Area One) Pokecenter.";
4343
}
4444

4545
void AutoStory_Segment_22::run_segment(
@@ -56,6 +56,7 @@ void AutoStory_Segment_22::run_segment(
5656

5757
checkpoint_47(env, context, options.notif_status_update);
5858
checkpoint_48(env, context, options.notif_status_update);
59+
checkpoint_49(env, context, options.notif_status_update);
5960

6061
context.wait_for_all_requests();
6162
env.console.log("End Segment " + name(), COLOR_GREEN);
@@ -288,7 +289,6 @@ void checkpoint_48(
288289
}
289290

290291

291-
// todo: uncomment checkpoint_save
292292
void checkpoint_49(
293293
SingleSwitchProgramEnvironment& env,
294294
ProControllerContext& context,
@@ -299,7 +299,7 @@ void checkpoint_49(
299299
while (true){
300300
try{
301301
if (first_attempt){
302-
// checkpoint_save(env, context, notif_status_update);
302+
checkpoint_save(env, context, notif_status_update);
303303
first_attempt = false;
304304
}else{
305305
enter_menu_from_overworld(env.program_info(), env.console, context, -1);
@@ -310,6 +310,102 @@ void checkpoint_49(
310310
}
311311

312312
context.wait_for_all_requests();
313+
// marker 1
314+
realign_player_from_landmark(
315+
env.program_info(), env.console, context,
316+
{ZoomChange::KEEP_ZOOM, 255, 128, 30},
317+
{ZoomChange::ZOOM_IN, 0, 90, 90}
318+
);
319+
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
320+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
321+
overworld_navigation(env.program_info(), env.console, context,
322+
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
323+
128, 0, 30, 10, false);
324+
},
325+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
326+
pbf_move_left_joystick(context, 0, 128, 40, 50);
327+
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
328+
}
329+
);
330+
331+
// marker 2
332+
realign_player_from_landmark(
333+
env.program_info(), env.console, context,
334+
{ZoomChange::KEEP_ZOOM, 128, 0, 30},
335+
{ZoomChange::ZOOM_IN, 128, 255, 30}
336+
);
337+
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
338+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
339+
overworld_navigation(env.program_info(), env.console, context,
340+
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
341+
128, 0, 30, 10, false);
342+
},
343+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
344+
pbf_move_left_joystick(context, 255, 128, 40, 50);
345+
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
346+
}
347+
);
348+
349+
// marker 3
350+
realign_player_from_landmark(
351+
env.program_info(), env.console, context,
352+
{ZoomChange::KEEP_ZOOM, 255, 180, 50},
353+
{ZoomChange::ZOOM_IN, 0, 70, 175}
354+
);
355+
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
356+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
357+
overworld_navigation(env.program_info(), env.console, context,
358+
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
359+
128, 0, 30, 10, false);
360+
},
361+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
362+
pbf_move_left_joystick(context, 255, 128, 40, 50);
363+
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
364+
}
365+
);
366+
367+
// marker 4
368+
realign_player_from_landmark(
369+
env.program_info(), env.console, context,
370+
{ZoomChange::KEEP_ZOOM, 255, 180, 50},
371+
{ZoomChange::ZOOM_IN, 0, 50, 185}
372+
);
373+
// walk until you run into the wall
374+
overworld_navigation(env.program_info(), env.console, context,
375+
NavigationStopCondition::STOP_TIME, NavigationMovementMode::DIRECTIONAL_ONLY,
376+
128, 0, 10, 10, false);
377+
378+
379+
// marker 5. put marker on other side of bridge
380+
realign_player_from_landmark(
381+
env.program_info(), env.console, context,
382+
{ZoomChange::ZOOM_IN, 128, 128, 0},
383+
{ZoomChange::ZOOM_IN, 128, 0, 10}
384+
);
385+
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
386+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
387+
overworld_navigation(env.program_info(), env.console, context,
388+
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
389+
128, 0, 30, 10, false);
390+
},
391+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
392+
pbf_move_left_joystick(context, 0, 128, 40, 50);
393+
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
394+
}
395+
);
396+
397+
398+
// marker 6. set marker past pokecenter
399+
handle_unexpected_battles(env.program_info(), env.console, context,
400+
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
401+
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 255, 255, 30);
402+
});
403+
overworld_navigation(env.program_info(), env.console, context,
404+
NavigationStopCondition::STOP_TIME, NavigationMovementMode::DIRECTIONAL_ONLY,
405+
128, 15, 12, 12, false); // can't wrap in handle_when_stationary_in_overworld(), since we expect to be stationary when walking into the pokecenter
406+
407+
408+
fly_to_overlapping_flypoint(env.program_info(), env.console, context);
313409

314410

315411

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_22.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ void checkpoint_48(
4242
EventNotificationOption& notif_status_update
4343
);
4444

45-
// start:
46-
// end:
45+
// start: Beat Team Star (Fire)
46+
// end: At East Province (Area Two) Pokecenter.
4747
void checkpoint_49(
4848
SingleSwitchProgramEnvironment& env,
4949
ProControllerContext& context,

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,41 @@ void AutoStory_Segment_23::run_segment(
5858

5959
}
6060

61+
// todo: uncomment checkpoint_save
62+
void checkpoint_50(
63+
SingleSwitchProgramEnvironment& env,
64+
ProControllerContext& context,
65+
EventNotificationOption& notif_status_update
66+
){
67+
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();
68+
bool first_attempt = true;
69+
while (true){
70+
try{
71+
if (first_attempt){
72+
// checkpoint_save(env, context, notif_status_update);
73+
first_attempt = false;
74+
}else{
75+
enter_menu_from_overworld(env.program_info(), env.console, context, -1);
76+
// we wait 10 seconds then save, so that the initial conditions are slightly different on each reset.
77+
env.log("Wait 10 seconds.");
78+
context.wait_for(Milliseconds(10 * 1000));
79+
save_game_from_overworld(env.program_info(), env.console, context);
80+
}
81+
82+
context.wait_for_all_requests();
83+
84+
break;
85+
}catch(OperationFailedException&){
86+
context.wait_for_all_requests();
87+
env.console.log("Resetting from checkpoint.");
88+
reset_game(env.program_info(), env.console, context);
89+
stats.m_reset++;
90+
env.update_stats();
91+
}
92+
}
93+
94+
}
95+
6196

6297

6398
}

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_23.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ class AutoStory_Segment_23 : public AutoStory_Segment{
2525
) const override;
2626
};
2727

28+
// start:
29+
// end:
30+
void checkpoint_50(
31+
SingleSwitchProgramEnvironment& env,
32+
ProControllerContext& context,
33+
EventNotificationOption& notif_status_update
34+
);
2835

2936

3037

0 commit comments

Comments
 (0)