From 9f33ef42bd155b9a4b7b66bbae438a2987b2b3b0 Mon Sep 17 00:00:00 2001 From: "firedcto@gmail.com" Date: Thu, 14 Nov 2024 19:06:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A4=BF=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=88=98=E6=96=97=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E5=86=A0?= =?UTF-8?q?=E8=80=85=E6=97=A0=E6=B3=95=E4=BC=A0=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/char/Camellya.py | 92 +++++++++++++++++++++----------------- src/task/BaseCombatTask.py | 2 +- src/task/BaseWWTask.py | 6 ++- 3 files changed, 55 insertions(+), 45 deletions(-) diff --git a/src/char/Camellya.py b/src/char/Camellya.py index 657d19d..7369cd0 100644 --- a/src/char/Camellya.py +++ b/src/char/Camellya.py @@ -10,10 +10,8 @@ class Camellya(BaseChar): self.last_heavy = 0 def do_get_switch_priority(self, current_char: BaseChar, has_intro=False, target_low_con=False): - self.logger.debug( - f'Camellya last heavy time {self.last_heavy} {self.time_elapsed_accounting_for_freeze(self.last_heavy)}') - if self.time_elapsed_accounting_for_freeze(self.last_heavy) < 1.2: - return Priority.MIN + if has_intro: + return Priority.MAX - 1 else: return super().do_get_switch_priority(current_char, has_intro) @@ -26,47 +24,57 @@ class Camellya(BaseChar): self.logger.error('wait wait_resonance_not_gray timed out') def do_perform(self): - self.wait_resonance_not_gray() self.click_liberation() - if self.click_echo(): - return self.switch_next_char() - # budding_wait = self.get_current_con() > 0.6 - # self.task.screenshot('click_reso1') + i = 0 start_con = self.get_current_con() - if self.is_con_full(): - self.handle_budding() - return self.switch_next_char() - elif self.click_resonance()[0]: - # self.task.screenshot('click_reso2') - self.sleep(0.1) - while self.get_current_con() == start_con: - self.click() - self.sleep(0.15) - self.sleep(0.1) + if start_con < 0.7: + loop_time = 1.1 + else: + loop_time = 4.1 + budding_start_time = time.time() + budding = False + full = False + while time.time() - budding_start_time < loop_time or self.task.find_one('camellya_budding', threshold=0.7): + current_con = self.get_current_con() + if (start_con - current_con > 0.1) and not budding: + self.logger.info(f'confull start budding {current_con}') + budding_start_time = time.time() + loop_time = 5.1 + budding = True + elif current_con == 1 and not budding and not full: + full = True + loop_time = 1 + budding_start_time = time.time() + start_con = current_con + if self.resonance_available(): + self.send_resonance_key(interval=0.1) + if self.get_current_con() < 0.7 and not budding: + # self.task.screenshot(f'camellya_fast_end_{self.get_current_con()}') + return self.switch_next_char() + else: + self.click(interval=0.1) self.task.next_frame() - con_change = start_con - self.get_current_con() - self.logger.debug(f'con_change {con_change}') - if con_change > 0.2 or self.is_con_full(): - self.handle_budding() - return self.switch_next_char() - self.click(after_sleep=0.1) - self.heavy_attack(1.1) - self.last_heavy = time.time() - if self.is_con_full(): + i += 1 + if budding: self.click_resonance() - self.handle_budding() + self.click_echo() + # self.task.screenshot(f'camellya_end_{self.get_current_con()}') self.switch_next_char() - def handle_budding(self): - self.logger.info('camellya_budding start') - # if budding_wait: - # # self.task.screenshot('budding_wait_1') - # self.sleep(0.4) - # # self.task.screenshot('budding_wait_2') - # budding = False - self.click_resonance() - budding_start_time = time.time() - while time.time() - budding_start_time < 4 or self.task.find_one('camellya_budding', threshold=0.7): - self.click(after_sleep=0.2) - self.logger.info(f'camellya_budding end') - self.click_resonance() + # def handle_budding(self): + # self.logger.info('camellya_budding start') + # budding_start_time = time.time() + # i = 0 + # while time.time() - budding_start_time < 4 or self.task.find_one('camellya_budding', threshold=0.7): + # if self.resonance_available(): + # self.send_resonance_key(interval=0.1) + # if self.current_resonance() < 0.7: + # return + # else: + # self.click(interval=0.1) + # i += 1 + # self.logger.info(f'camellya_budding end') + # self.click_resonance() + # def switch_next_char(self, *args): + # self.task.screenshot(f'ca_switch_out_{self.current_con}') + # super().switch_next_char(*args) diff --git a/src/task/BaseCombatTask.py b/src/task/BaseCombatTask.py index b94f981..cec69f5 100644 --- a/src/task/BaseCombatTask.py +++ b/src/task/BaseCombatTask.py @@ -178,7 +178,7 @@ class BaseCombatTask(BaseWWTask, FindFeature, OCR, CombatCheck): # logger.warning(f"can't find next char to switch to, maybe switching too fast click and wait") # if time.time() - current_char.last_perform < 0.1: current_char.continues_normal_attack(0.2) - logger.warning(f"can't find next char to switch to, performing too fast add a normal attack") + logger.warning(f"{current_char} can't find next char to switch to, performing too fast add a normal attack") return current_char.switch_next_char() switch_to.has_intro = has_intro logger.info(f'switch_next_char {current_char} -> {switch_to} has_intro {has_intro}') diff --git a/src/task/BaseWWTask.py b/src/task/BaseWWTask.py index 7c9f56e..1e87a1b 100644 --- a/src/task/BaseWWTask.py +++ b/src/task/BaseWWTask.py @@ -380,14 +380,16 @@ class BaseWWTask(BaseTask, FindFeature, OCR): if self.find_one(['fast_travel_custom', 'remove_custom', 'gray_teleport'], threshold=0.6): self.click_relative(0.91, 0.92, after_sleep=1) if self.wait_click_feature(['confirm_btn_hcenter_vcenter', 'confirm_btn_highlight_hcenter_vcenter'], - relative_x=-1, raise_if_not_found=True, + relative_x=-1, raise_if_not_found=False, threshold=0.7, - time_out=5): + time_out=4): self.wait_click_feature(['confirm_btn_hcenter_vcenter', 'confirm_btn_highlight_hcenter_vcenter'], relative_x=-1, raise_if_not_found=False, threshold=0.7, time_out=1) return True + else: + return True elif btn := self.find_one('gray_teleport', threshold=0.7): return self.click_box(btn, relative_x=1)