Skip to content

Commit

Permalink
fix:公招卡住 (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
EightyDollars authored Oct 28, 2024
1 parent 3c970a8 commit 6e77155
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions arknights_mower/solvers/recruit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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]}"
)
Expand All @@ -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"]
Expand Down Expand Up @@ -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,
}
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6e77155

Please sign in to comment.