diff --git a/arknights_mower/data/scene.json b/arknights_mower/data/scene.json index a466043b..50df9758 100644 --- a/arknights_mower/data/scene.json +++ b/arknights_mower/data/scene.json @@ -551,4 +551,4 @@ "label": "CONFIRM", "comment": "确认对话框" } -} +} \ No newline at end of file diff --git a/arknights_mower/resources/ope_select_start_empty.png b/arknights_mower/resources/ope_select_start_empty.png new file mode 100644 index 00000000..0375aaeb Binary files /dev/null and b/arknights_mower/resources/ope_select_start_empty.png differ diff --git a/arknights_mower/solvers/auto_fight.py b/arknights_mower/solvers/auto_fight.py index 870ce986..3d6568fe 100644 --- a/arknights_mower/solvers/auto_fight.py +++ b/arknights_mower/solvers/auto_fight.py @@ -107,8 +107,9 @@ def in_fight(self) -> bool: tpl = loadres("fight/enemy", True) result = cv2.matchTemplate(img, tpl, cv2.TM_SQDIFF_NORMED) min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result) - logger.debug(f"是否在战斗:{min_val}") - return min_val < 0.4 + value = 0.4 + logger.debug(f"{min_val}小于{value}则判定在战斗") + return min_val < value def battle_complete(self) -> bool: "识别行动是否结束" @@ -117,8 +118,9 @@ def battle_complete(self) -> bool: tpl = loadres("fight/complete", True) result = cv2.matchTemplate(img, tpl, cv2.TM_SQDIFF_NORMED) min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result) - logger.debug(f"行动结束:{min_val}") - return min_val < 0.4 + value = 0.4 + logger.debug(f"{min_val}小于{value}则判定行动结束/胜利") + return min_val < value def battle_fail(self) -> bool: "识别行动是否失败" @@ -126,8 +128,9 @@ def battle_fail(self) -> bool: tpl = loadres("fight/failed_text", True) result = cv2.matchTemplate(img, tpl, cv2.TM_SQDIFF_NORMED) min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result) - logger.debug(f"行动失败:{min_val}") - return min_val < 0.05 # 测试时数值很低,基本为0,或有其他方法 + value = 0.05 + logger.debug(f"{min_val}小于{value}则判定行动失败") + return min_val < value # 测试时数值很低,基本为0,或有其他方法 def update_operators(self): "识别可部署的干员" @@ -282,7 +285,7 @@ def transition(self): if not self.in_fight(): if self.battle_fail(): - logger.info("行动失败,请检查干员/练度") + logger.warning("行动失败,请检查干员/练度") return True elif self.battle_complete(): logger.info("行动结束") diff --git a/arknights_mower/solvers/credit_fight.py b/arknights_mower/solvers/credit_fight.py index d933e828..82907c04 100644 --- a/arknights_mower/solvers/credit_fight.py +++ b/arknights_mower/solvers/credit_fight.py @@ -58,6 +58,9 @@ def transition(self): return self.tap_element("ope_start", interval=2) elif scene == Scene.OPERATOR_SELECT: + if self.find("ope_select_start_empty"): + logger.info("编队内没有编入干员,停止OF-1") + return True squad = self.current_squad() target = config.conf["credit_fight"]["squad"] if squad != target: diff --git a/arknights_mower/utils/recognize.py b/arknights_mower/utils/recognize.py index 52b50659..62c41c38 100644 --- a/arknights_mower/utils/recognize.py +++ b/arknights_mower/utils/recognize.py @@ -791,6 +791,7 @@ def find( "ope_failed": (183, 465), "ope_finish": (87, 265), "ope_plan": (1278, 24), + "ope_select_start_empty": ((0, 0), (400, 400)), "riic/assistants": ((1320, 400), (1600, 650)), "riic/iron": ((1570, 230), (1630, 340)), "riic/orundum": ((1500, 320), (1800, 550)),