fix: 无法选中 坚不可摧随心所欲 分队

This commit is contained in:
uye
2025-07-29 01:33:29 +08:00
parent 3c9c4e6e32
commit f07d3eb845
2 changed files with 28 additions and 12 deletions

View File

@@ -60,13 +60,14 @@
"RoguelikeCustom-HijackRoles": {
"algorithm": "OcrDetect",
"text": [],
"roi": [54, 356, 1172, 183]
"roi": [54, 356, 1172, 183],
"postDelay": 1000
},
"RoguelikeCustom-HijackSquad": {
"algorithm": "OcrDetect",
"text": [],
"roi": [0, 383, 1280, 142],
"postDelay": 800,
"postDelay": 1000,
"ocrReplace": [["蓝图测绘分.*", "蓝图测绘分队"]]
},
"RoguelikeFoldartalSlowlySwipeToTheUp": {

View File

@@ -134,7 +134,7 @@ bool asst::RoguelikeCustomStartTaskPlugin::hijack_squad()
.run();
}
constexpr size_t SwipeTimes = 7;
constexpr size_t SwipeTimes = 2;
for (size_t i = 0; i != SwipeTimes; ++i) {
if (need_exit()) {
return false;
@@ -190,19 +190,34 @@ bool asst::RoguelikeCustomStartTaskPlugin::hijack_reward()
bool asst::RoguelikeCustomStartTaskPlugin::hijack_roles()
{
auto image = ctrler()->get_image();
OCRer analyzer(image);
analyzer.set_task_info("RoguelikeCustom-HijackRoles");
analyzer.set_required({ m_customs[RoguelikeCustomType::Roles] });
constexpr size_t SwipeTimes = 2;
const std::string& required_role = m_customs[RoguelikeCustomType::Roles];
if (!analyzer.analyze()) {
return false;
for (size_t i = 0; i != SwipeTimes; ++i) {
if (need_exit()) {
return false;
}
auto image = ctrler()->get_image();
OCRer analyzer(image);
analyzer.set_task_info("RoguelikeCustom-HijackRoles");
analyzer.set_required({ required_role });
if (analyzer.analyze()) {
const auto& rect = analyzer.get_result().front().rect;
ctrler()->click(rect);
return true;
}
ProcessTask(*this, { "Roguelike@SquadSlowlySwipeToTheRight" }).run();
sleep(Task.get("RoguelikeCustom-HijackRoles")->post_delay);
}
const auto& rect = analyzer.get_result().front().rect;
ctrler()->click(rect);
return true;
ProcessTask(*this, { "SwipeToTheLeft" }).run();
return false;
}
bool asst::RoguelikeCustomStartTaskPlugin::hijack_core_char()
{
static const std::unordered_map<battle::Role, std::string> RoleOcrNameMap = {