-
Notifications
You must be signed in to change notification settings - Fork 66
优化: 培养计划每次进入次数+功能: 饰品提取使用预备编队+修复: 饰品提取切换存档陈年bug #581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
25d4190
b3d5494
9425af6
67b5253
dc3e8d8
7267770
75eba18
26491e1
edc463f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| import math | ||
|
|
||
| from PIL.ImageChops import screen | ||
| from typing import Optional, Callable, ClassVar | ||
|
|
||
| from one_dragon.base.operation.operation_edge import node_from | ||
| from one_dragon.base.operation.operation_node import operation_node | ||
| from one_dragon.base.operation.operation_round_result import OperationRoundResult | ||
| from one_dragon.utils import str_utils | ||
| from one_dragon.utils.i18_utils import gt | ||
| from one_dragon.utils.log_utils import log | ||
| from sr_od.challenge_mission.choose_challenge_times import ChooseChallengeTimes | ||
|
|
@@ -54,6 +57,9 @@ def __init__(self, ctx: SrContext, mission: GuideMission, | |
| self.current_challenge_times: int = 1 # 当前挑战的次数 | ||
| self.finish_times: int = 0 # 已经完成的次数 | ||
| self.battle_fail_times: int = 0 # 战斗失败次数 | ||
| # 培养目标识别单次体力和关卡连续运行上限 | ||
| self.mission_power_ocr: int = 0 | ||
| self.mission_challenge_times: int = 6 | ||
|
|
||
| @node_from(from_name='阵亡传送恢复') | ||
| @operation_node(name='传送', is_start_node=True) | ||
|
|
@@ -90,8 +96,31 @@ def _get_current_challenge_times(self) -> int: | |
| return min(24, current_challenge_times) | ||
| elif self.mission.cate.cn == '凝滞虚影': | ||
| return min(8, current_challenge_times) | ||
| elif self.mission.cate.cn in ['侵蚀隧洞', '培养目标']: | ||
| elif self.mission.cate.cn in ['侵蚀隧洞']: | ||
| return min(6, current_challenge_times) | ||
| elif self.mission.cate.cn == '培养目标': | ||
| if self.mission_power_ocr == 0: | ||
| # 识别单次体力消耗 | ||
| area1 = self.ctx.screen_loader.get_area('挑战副本', '预计消耗体力-其他') | ||
| ocr_result_list = self.ctx.ocr_service.get_ocr_result_list(self.last_screenshot, rect=area1.rect) | ||
|
JoshCai233 marked this conversation as resolved.
|
||
| if len(ocr_result_list) > 0: | ||
| power_unit_str = ocr_result_list[0].data | ||
| if power_unit_str[0] in ['×', 'x']: | ||
| power_unit_str = power_unit_str[1:] | ||
|
Comment on lines
+108
to
+109
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
OCR 结果 🐛 建议修复- if power_unit_str[0] in ['×', 'x']:
- power_unit_str = power_unit_str[1:]
+ if power_unit_str and power_unit_str[0] in ['\u00d7', 'x']: # × 或 x 前缀
+ power_unit_str = power_unit_str[1:]🧰 Tools🪛 Ruff (0.15.2)[warning] 108-108: String contains ambiguous (RUF001) 🤖 Prompt for AI Agents |
||
| mission_power_ocr = str_utils.get_positive_digits(power_unit_str, err=None) | ||
| if mission_power_ocr is None: | ||
| log.error('识别体力单位失败:' + power_unit_str) | ||
| elif self.mission.power < mission_power_ocr: | ||
| log.error('哪个本体力消耗>40? 识别的体力为: ' + power_unit_str) | ||
| return 1 | ||
| else: | ||
| self.mission_power_ocr = mission_power_ocr | ||
| # 根据单次体力消耗计算真实一次可以打的次数 (替换掉默认的40体力一次) | ||
| self.mission_challenge_times = math.floor(self.mission_challenge_times * self.mission.power / self.mission_power_ocr) | ||
| self.plan_times = math.floor(self.plan_times * self.mission.power / self.mission_power_ocr) | ||
| current_challenge_times = math.floor(current_challenge_times * self.mission.power / self.mission_power_ocr) | ||
|
JoshCai233 marked this conversation as resolved.
|
||
| self.mission.power = self.mission_power_ocr | ||
| return min(self.mission_challenge_times, current_challenge_times) | ||
| return 1 | ||
|
|
||
| @node_from(from_name='选择次数') | ||
|
|
@@ -110,16 +139,17 @@ def confirm_after_click_challenge(self) -> OperationRoundResult: | |
| screen = self.last_screenshot | ||
|
|
||
| result1 = self.round_by_find_area(screen, '挑战副本', '开拓力弹框-标题') | ||
| if not result1.is_success: | ||
| # 培养目标-周本 挑战次数用完 | ||
| result1 = self.round_by_find_area(screen, '挑战副本', '提示弹框-次数用完') | ||
| if result1.is_success: | ||
| if self.on_battle_success is not None: | ||
| self.on_battle_success(0, 200) # 清空开拓力 | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '开拓力弹框-取消', | ||
| success_wait=1, retry_wait=1) | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '开拓力弹框-取消', success_wait=1, retry_wait=1) | ||
|
JoshCai233 marked this conversation as resolved.
|
||
|
|
||
| result2 = self.round_by_find_area(screen, '挑战副本', '阵亡弹框-标题') | ||
| if result2.is_success: | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '阵亡弹框-取消', | ||
| retry_wait=1) | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '阵亡弹框-取消', retry_wait=1) | ||
|
|
||
| return self.round_retry('无对话框', wait=0.3) | ||
|
|
||
|
|
@@ -158,8 +188,7 @@ def _after_start_challenge(self) -> OperationRoundResult: | |
| # 有阵亡角色 | ||
| result2 = self.round_by_find_area(screen, '挑战副本', '阵亡弹框-标题') | ||
| if result2.is_success: | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '阵亡弹框-取消', | ||
| success_wait=1, retry_wait=1) | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '阵亡弹框-取消', success_wait=1, retry_wait=1) | ||
|
|
||
|
|
||
| if self.mission.cate.cn == '凝滞虚影': | ||
|
|
@@ -235,8 +264,7 @@ def confirm_after_challenge_again(self) -> OperationRoundResult: | |
|
|
||
| result2 = self.round_by_find_area(screen, '挑战副本', '阵亡弹框-标题') | ||
| if result2.is_success: | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '阵亡弹框-取消', | ||
| retry_wait=1) | ||
| return self.round_by_find_and_click_area(screen, '挑战副本', '阵亡弹框-取消', retry_wait=1) | ||
|
|
||
| return self.round_retry('无对话框', wait=0.5) | ||
|
|
||
|
|
@@ -269,6 +297,8 @@ def __debug_op(): | |
| tab = ctx.guide_data.best_match_tab_by_name('生存索引') | ||
| category = ctx.guide_data.best_match_category_by_name('拟造花萼(赤)', tab) | ||
| mission = ctx.guide_data.best_match_mission_by_name('存护之蕾', category, '克劳克影视乐园') | ||
| # category = ctx.guide_data.best_match_category_by_name('培养目标', tab) | ||
| # mission = ctx.guide_data.best_match_mission_by_name('培养目标', category, None) | ||
|
|
||
| op = UseTrailblazePower(ctx, mission, 2, 2, support='hyacine') | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.