Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class WhiteDialogWatcher : public DetectorToFinder<WhiteDialogDetector>{
{}
};

class WhiteDialogOverWatcher : public DetectorToFinder<WhiteDialogDetector>{
public:
WhiteDialogOverWatcher(Color color)
: DetectorToFinder("WhiteDialogOverWatcher", FinderType::GONE, std::chrono::milliseconds(250), color)
{}
};

// Same as WhiteDialogDetector, but filter for the red arrow
// Detect the red advancement arrow by filtering for DARK red.
// There is red/pink color text for female npcs in non-japan versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ bool EggRng::held_frame_check(
}

if (locked_in && !(definitely_hit_held_frame || possibly_hit_held_frame)){
STARTING_POINT.set(EggProgramState::held_prep);
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"EggRng(): Missed held frame after saving. Restart the program after repeating the manual in-game setup.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,25 +806,69 @@ void walk_from_pond_to_daycare_man(ConsoleHandle& console, ProControllerContext&

void egg_pickup(ConsoleHandle& console, ProControllerContext& context){
console.log("Picking up egg...");
WhiteDialogWatcher dialogue(COLOR_RED);

// Clear the save dialogue, if it is open
WhiteDialogOverWatcher dialogue_cleared(COLOR_RED);
context.wait_for_all_requests();
int ret = run_until<ProControllerContext>(
console, context,
[](ProControllerContext& context) {
pbf_mash_button(context, BUTTON_A, 5000ms);
pbf_mash_button(context, BUTTON_B, 5000ms);
},
{ dialogue_cleared }
);
if (ret < 0){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"egg_pickup(): Failed to clear dialogue before talking to the daycare man.",
console
);
}

// Talk to the daycare man and wait for the egg prompt.
SelectionDialogWatcher egg_prompt(COLOR_RED);
context.wait_for_all_requests();
ret = run_until<ProControllerContext>(
console, context,
[](ProControllerContext& context) {
for (int i=0; i<12; i++){
pbf_press_button(context, BUTTON_A, 200ms, 800ms);
}
},
{ dialogue }
{ egg_prompt }
);
if (ret < 0){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"egg_pickup(): Failed to initiate dialogue.",
"egg_pickup(): Failed to detect the egg selection dialogue.",
console
);
}
console.log("Egg selection dialogue detected. Taking the egg...");

// accept the egg
pbf_mash_button(context, BUTTON_A, 1000ms);

// clear the rest of the dialogue
WhiteDialogOverWatcher dialogue_over(COLOR_RED);
context.wait_for_all_requests();
ret = run_until<ProControllerContext>(
console, context,
[](ProControllerContext& context) {
pbf_mash_button(context, BUTTON_B, 10000ms);
},
{ dialogue_over }
);
if (ret < 0){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"egg_pickup(): Failed to return to the overworld after taking the egg.",
console
);
}
context.wait_for_all_requests();

pbf_mash_button(context, BUTTON_A, 5000ms);
pbf_mash_button(context, BUTTON_B, 2500ms);
console.log("Egg picked up.");
}

bool walk_from_daycare_man_to_pond(ConsoleHandle& console, ProControllerContext& context){
Expand Down
Loading