Skip to content

Commit 860ac91

Browse files
committed
修复五合一属性可能识别错误
1 parent 049fa04 commit 860ac91

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/task/FiveToOneTask.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from src.task.BaseCombatTask import BaseCombatTask
77

88
logger = Logger.get_logger(__name__)
9+
chinese_regex = re.compile(r'[\u4e00-\u9fff]{5,12}')
910

1011

1112
class FiveToOneTask(BaseCombatTask):
@@ -27,7 +28,12 @@ def __init__(self, *args, **kwargs):
2728
"热熔伤害加成",
2829
"导电伤害加成",
2930
"气动伤害加成", "衍射伤害加成", "湮灭伤害加成", "治疗效果加成"]
31+
self.all_stats = []
3032
self.black_list = ["主属性生命值", "主属性攻击力", "主属性防御力"]
33+
for main_stat in self.main_stats:
34+
self.all_stats.append("主属性" + main_stat)
35+
self.all_stats += self.black_list
36+
3137
self.add_text_fix(
3238
{'凝夜自霜': '凝夜白霜', '主属性灭伤害加成': '主属性湮灭伤害加成', "灭伤害加成": "主属性湮灭伤害加成",
3339
'主属性行射伤害加成': '主属性衍射伤害加成'})
@@ -40,6 +46,7 @@ def __init__(self, *args, **kwargs):
4046
self.config_type[key] = {'type': "multi_selection", 'options': self.main_stats}
4147

4248
def run(self):
49+
self.log_debug(f"all_stats: {self.all_stats}")
4350
self.log_info("开始任务")
4451
self.ensure_main()
4552
self.log_info("在主页")
@@ -77,9 +84,11 @@ def merge_set(self, name_box, set_name, step):
7784
self.wait_feature("merge_echo_check", box=name_box, raise_if_not_found=True)
7885

7986
self.click_relative(0.895, 0.74, after_sleep=0.5) # 滚动
80-
choices = self.ocr(box=name_box)
87+
choices = self.ocr(box=name_box, match=chinese_regex)
8188
if step == 1:
8289
for choice in choices:
90+
if choice.name not in self.all_stats:
91+
raise Exception(f"无法识别的属性: {choice.name}")
8392
in_keep = False
8493
if choice.name in self.black_list:
8594
continue

0 commit comments

Comments
 (0)