(cha: bool, wq_type, wq_info)
| 143 | # 找到一个最优的关卡来挑战 |
| 144 | challenge = True if num_challenge >= 10 else False |
| 145 | def check_battle(cha: bool, wq_type, wq_info) -> tuple: |
| 146 | battle = False |
| 147 | self.screenshot() |
| 148 | type_wq = wq_type.ocr(self.device.image) |
| 149 | if cha and type_wq == '挑战': |
| 150 | battle = 'CHALLENGE' |
| 151 | if type_wq == '秘闻': |
| 152 | battle = 'SECRET' |
| 153 | if not battle: |
| 154 | return None, None |
| 155 | info = wq_info.ocr(self.device.image) |
| 156 | try: |
| 157 | # 匹配: 第九章(数量:5) |
| 158 | one_number = int(re.findall(r'(\d+)', info)[-1]) |
| 159 | # one_number = int(re.findall(r'\*\(\数量:\s*(\d+)\)', info)[0]) |
| 160 | except IndexError: |
| 161 | # 匹配: 第九章 |
| 162 | one_number = 3 |
| 163 | # num_want / one_number = 一共要打几次 |
| 164 | if one_number > num_want: |
| 165 | return battle, 1 |
| 166 | else: |
| 167 | return battle, num_want // one_number + 1 |
| 168 | |
| 169 | battle, num, goto = None, None, None |
| 170 | if not battle: |
nothing calls this directly
no test coverage detected