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 @@ -474,6 +474,33 @@ void do_action_and_run_from_battle(
VideoStream& stream,
ProControllerContext& context)
>&& action
){
size_t max_attempts = 5;
for (size_t i = 0; i < max_attempts; i++){
try{
do_action_and_monitor_for_battles(info, stream, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
action(info, stream, context);
}
);
break;
}catch (UnexpectedBattleException&){
stream.log("Detected battle. Now running away.", COLOR_PURPLE);
run_from_battle(stream, context);
}
}

}

void do_action_and_run_from_battle2(
const ProgramInfo& info,
VideoStream& stream,
ProControllerContext& context,
std::function<
void(const ProgramInfo& info,
VideoStream& stream,
ProControllerContext& context)
>&& action
){
size_t max_attempts = 5;
for (size_t i = 0; i < max_attempts; i++){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ void do_action_and_run_from_battle(
>&& action
);

// same as do_action_and_run_from_battle, but will
// stop the action once the overworld disappears
void do_action_and_run_from_battle2(
const ProgramInfo& info,
VideoStream& stream,
ProControllerContext& context,
std::function<
void(const ProgramInfo& info,
VideoStream& stream,
ProControllerContext& context)
>&& action
);

void move_to_start_position_for_letsgo0(VideoStream& stream, ProControllerContext& context);

void move_to_start_position_for_letsgo1(const ProgramInfo& info, VideoStream& stream, ProControllerContext& context);
Expand Down
Loading