From 6e77155683e00eecd2506b9a8a05148de7a5bc5f Mon Sep 17 00:00:00 2001 From: EightyDollars <81128280+EightyDollars@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:37:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=85=AC=E6=8B=9B=E5=8D=A1=E4=BD=8F=20(#70?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arknights_mower/solvers/recruit.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arknights_mower/solvers/recruit.py b/arknights_mower/solvers/recruit.py index 4ec5a61d..27191f20 100644 --- a/arknights_mower/solvers/recruit.py +++ b/arknights_mower/solvers/recruit.py @@ -64,7 +64,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None: # 默认要支援机械 self.recruit_order_index = 2 self.recruit_order = [6, 5, 1, 4, 3, 2] - + self.refresh = False self.result_agent = {} self.tags = {} self.ticket_number = None @@ -154,6 +154,8 @@ def transition(self) -> bool: if self.find("recruit/job_requirements", scope=job_requirements_scope): self.recruit_index = self.recruit_index + 1 + if self.recruit_index in self.agent_choose.keys(): + self.agent_choose[self.recruit_index]["choosed"] = True logger.debug(f"{self.recruit_index}正在招募") return elif pos := self.find("recruit/recruit_lock", scope=recruit_lock_scope): @@ -177,12 +179,13 @@ def transition(self) -> bool: elif scene == Scene.RECRUIT_TAGS: self.ticket_number = self.get_ticket_number() - if self.recruit_index not in self.tags.keys(): + if self.recruit_index not in self.tags.keys() or self.refresh: tmp_tags = self.get_recruit_tag() if tmp_tags is False: self.back() return self.tags[self.recruit_index] = tmp_tags + self.refresh = False logger.info( f"{self.recruit_index}号位置的tag识别结果{self.tags[self.recruit_index]}" ) @@ -193,6 +196,7 @@ def transition(self) -> bool: self.tap(pos) del self.tags[self.recruit_index] del self.agent_choose[self.recruit_index] + self.refresh = True return choose = self.agent_choose[self.recruit_index]["tags"] @@ -346,8 +350,8 @@ def recruit_tags(self, tags): if recruit_result_level != 3: self.agent_choose[self.recruit_index] = { - "tags": list(recruit_cal_result[0]["tag"]), - "result": list(recruit_cal_result[0]["result"]), + "tags": list(recruit_cal_result[-1]["tag"]), + "result": list(recruit_cal_result[-1]["result"]), "level": recruit_result_level, "choosed": False, } @@ -425,7 +429,7 @@ def recruit_cal(self, tags: list[str]): if max_star < 6 and agent["star"] == 6: continue result_dict[item[0]].append(agent) - logger.debug(item[0], agent) + try: for key in list(result_dict.keys()): if len(result_dict[key]) == 0: