Skip to content

Commit eabc444

Browse files
committed
Preliminary rewrite of Tera Multi-Farmer state machine.
1 parent e5ef7bf commit eabc444

File tree

7 files changed

+313
-154
lines changed

7 files changed

+313
-154
lines changed

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace PokemonAutomation{
2626
const bool IS_BETA_VERSION = true;
2727
const int PROGRAM_VERSION_MAJOR = 0;
2828
const int PROGRAM_VERSION_MINOR = 54;
29-
const int PROGRAM_VERSION_PATCH = 28;
29+
const int PROGRAM_VERSION_PATCH = 29;
3030

3131
const std::string PROGRAM_VERSION_BASE =
3232
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +

SerialPrograms/Source/PokemonSV/Inference/Tera/PokemonSV_TeraRaidSearchDetector.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ bool TeraRaidSearchDetector::detect_search_location(ImageFloatBox& box, const Im
5858
auto iter = session->make_iterator(100);
5959
WaterfillObject object;
6060

61-
// size_t c = 0;
61+
// static size_t c = 0;
6262
const TeraSearchGlassMatcher& MATCHER = TeraSearchGlassMatcher::instance();
6363
while (iter->find_next(object, false)){
6464
// cout << "yellow = " << object.area << endl;
@@ -67,6 +67,10 @@ bool TeraRaidSearchDetector::detect_search_location(ImageFloatBox& box, const Im
6767
double rmsd = MATCHER.rmsd(extract_box_reference(screen, object));
6868
// cout << "rmsd = " << rmsd << endl;
6969
if (rmsd < 100){
70+
71+
// cout << "rmsd = " << rmsd << endl;
72+
// extract_box_reference(screen, object).save("object-" + std::to_string(c++) + ".png");
73+
7074
box = translate_to_parent(screen, {0, 0, 1, 1}, object);
7175
return true;
7276
}
@@ -97,8 +101,10 @@ bool TeraRaidSearchDetector::move_cursor_to_search(
97101
ok &= arrow.detect(arrow_location, screen);
98102
if (!ok){
99103
consecutive_detection_fails++;
100-
if (consecutive_detection_fails > 10){
101-
dump_image_and_throw_recoverable_exception(info, stream, "UnableToDetectTeraSearch", "Unable to detect Tera Raid Search menu.");
104+
if (consecutive_detection_fails > 3){
105+
// dump_image_and_throw_recoverable_exception(info, stream, "UnableToDetectTeraSearch", "Unable to detect Tera Raid Search menu.");
106+
stream.log("Unable to detect Tera Raid Search menu.", COLOR_RED);
107+
return false;
102108
}
103109
context.wait_for(std::chrono::milliseconds(1000));
104110
continue;

SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostTools.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,16 @@ void TeraFailTracker::on_raid_start(){
7070
}
7171
m_current_raid_error.store(false, std::memory_order_relaxed);
7272

73+
#if 1
7374
if (m_consecutive_failures > 0 && !m_completed_one){
7475
throw_and_log<FatalProgramException>(
7576
m_env.logger(),
7677
ErrorReport::NO_ERROR_REPORT,
7778
"Failed 1st raid attempt. Will not retry due to risk of ban."
7879
);
7980
}
81+
#endif
82+
8083
size_t fail_threshold = m_consecutive_failure_pause;
8184
if (m_consecutive_failures >= fail_threshold){
8285
uint16_t minutes = m_failure_pause_minutes;

0 commit comments

Comments
 (0)