Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 旨在让「饰品提取」像其他副本一样支持连续挑战,并通过合并体力处理逻辑来减少 power.py 中的重复代码,从而统一不同副本的执行入口。
Changes:
- 将清体力与体力计划执行逻辑统一收敛到
Power.process(...),以“挑战次数”为统一计数口径。 - 调整
Instance.run/start_instance的入参语义为“每轮挑战次数”,并在「饰品提取」流程中支持通过“+”设置连续挑战次数。
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tasks/power/power.py | 合并原先标准/饰品提取两套执行逻辑为 Power.process,并用于清体力与体力计划执行。 |
| tasks/power/instance.py | 将副本启动参数改为“每轮挑战次数”,并为「饰品提取」补齐连续挑战次数的 UI 设置流程。 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Comments suppressed due to low confidence (1)
tasks/activity/doubleactivity.py:42
_run_instances()在调用Power.process(...)后没有返回值,导致run()返回None。在ActivityManager里对部分活动使用while not func(): pass的逻辑时,None会被当作 False,从而可能造成死循环。请确保_run_instances()返回明确的 bool(例如根据Power.process的返回值判断是否执行成功)。
Power.process(instance_type, instance_name, planned_attempts = reward_count)
def run(self):
reward_count = self._get_reward_count()
if reward_count == 0:
return True
log.info(f"{self.name}剩余次数:{reward_count}")
return self._run_instances(reward_count)
|
wow怎么这么多bug,哈哈 |
|
应该没有更多的问题了 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
tasks/power/instance.py:289
- 同上:在通用副本(含“历战余响”)的连续挑战次数选择中,如果未找到“+”按钮也会继续执行,可能导致实际挑战次数仍为 1,但外部按
attempts_per_run计算,产生次数/计划统计偏差。建议在attempts_per_run > 1时要求必须找到“+”按钮(否则返回 False 或降级为 1),并对“历战余响”单独做一次 UI 适配校验。
count = attempts_per_run - 1
# if not 0 <= count <= challenge_count_max - 1:
# Base.send_notification_with_screenshot(cfg.notify_template['InstanceNotCompleted'].format(error="连续挑战次数错误"))
# return False
result = auto.find_element("./assets/images/screen/guide/plus.png", "image", 0.8, max_retries=10, crop=(1174.0 / 1920, 775.0 / 1080, 738.0 / 1920, 174.0 / 1080))
|
@copilot apply changes based on the comments in this thread |
|
吔,copilot不能自动更改吗,那我手动push一下 |
| log.error(f"获取培养目标副本失败: {e}") | ||
|
|
||
| Instance.run("饰品提取", instance_name, 40, immersifier_count) | ||
| Power.process("饰品提取", instance_name, immersifier_only = True) |
There was a problem hiding this comment.
同 tasks/weekly/universe.py:此处在 Power.process(..., immersifier_only=True) 前已经 OCR 读取沉浸器数量并判断 >0,但 Power.process 内部会再次识别沉浸器数量,造成重复 OCR 与潜在不一致。建议复用一次识别结果(例如直接依赖 Power.process 的返回值,或把 immersifier_count 传入 Power.process)。
|
|
||
| @staticmethod | ||
| def process_standard(instance_type, instance_name, challenge_count): | ||
| def process(instance_type: str, instance_name: str, planned_attempts: int = 0, immersifier_only: bool = False): |
There was a problem hiding this comment.
建议在 Power.process() 一开始就用 Instance.validate_instance(instance_type, instance_name) 做快速校验(instance_name 为“无”时直接返回 0)。否则像活动/计划传入未配置副本时,会进入多次重试与界面操作,既耗时也会把“未配置”误报成“体力不足/运行失败”。
| def process(instance_type: str, instance_name: str, planned_attempts: int = 0, immersifier_only: bool = False): | |
| def process(instance_type: str, instance_name: str, planned_attempts: int = 0, immersifier_only: bool = False): | |
| if instance_name == "无": | |
| return 0 | |
| if not Instance.validate_instance(instance_type, instance_name): | |
| return 0 |
允许饰品提取像其他副本一样连续挑战。
同时精简power.py中的重复代码,将原有的四个函数合并为一个函数。