From c1fc7012ac8eea5a00c649b5d5a44bdeff3e7905 Mon Sep 17 00:00:00 2001 From: "firedcto@gmail.com" Date: Tue, 30 Jul 2024 18:50:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E6=88=98?= =?UTF-8?q?=E6=96=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/char/BaseChar.py | 10 ++++++---- src/char/Encore.py | 6 +++++- src/char/Verina.py | 4 +++- src/combat/CombatCheck.py | 2 +- src/task/BaseCombatTask.py | 9 +++------ 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/char/BaseChar.py b/src/char/BaseChar.py index b8adc8f..fbccb09 100644 --- a/src/char/BaseChar.py +++ b/src/char/BaseChar.py @@ -121,9 +121,9 @@ class BaseChar: return percent == 0 or not self.has_cd(box_name) def switch_out(self): + self.last_switch_time = time.time() self.is_current_char = False self.has_intro = False - self.liberation_available_mark = self.liberation_available() if self.current_con == 1: self.logger.info(f'switch_out at full con set current_con to 0') self.current_con = 0 @@ -133,8 +133,10 @@ class BaseChar: def switch_next_char(self, post_action=None, free_intro=False, target_low_con=False): self.is_forte_full() - self.last_switch_time = self.task.switch_next_char(self, post_action=post_action, free_intro=free_intro, - target_low_con=target_low_con) + self.has_intro = False + self.liberation_available_mark = self.liberation_available() + self.task.switch_next_char(self, post_action=post_action, free_intro=free_intro, + target_low_con=target_low_con) def sleep(self, sec, check_combat=True): if sec > 0: @@ -290,7 +292,7 @@ class BaseChar: self.logger.info(f'click_liberation end {duration}') return clicked - def add_freeze_duration(self, start, duration, freeze_time=0.2): + def add_freeze_duration(self, start, duration, freeze_time=0): if duration > freeze_time: current_time = time.time() self.freeze_durations = [item for item in self.freeze_durations if item[0] <= current_time - 15] diff --git a/src/char/Encore.py b/src/char/Encore.py index 3f1aef1..7411940 100644 --- a/src/char/Encore.py +++ b/src/char/Encore.py @@ -14,11 +14,15 @@ class Encore(BaseChar): def still_in_liberation(self): return self.time_elapsed_accounting_for_freeze(self.liberation_time) < 9.5 + def switch_out(self): + super().switch_out() + self.last_resonance = 0 + def do_perform(self): target_low_con = False if self.has_intro: self.logger.debug('encore wait intro') - self.continues_normal_attack(1.0) + self.continues_normal_attack(1.5) self.wait_down() else: while not self.still_in_liberation() and self.can_resonance_step2(): diff --git a/src/char/Verina.py b/src/char/Verina.py index 1ed6deb..063098e 100644 --- a/src/char/Verina.py +++ b/src/char/Verina.py @@ -10,7 +10,9 @@ class Verina(BaseChar): if self.click_resonance(send_click=False)[0]: return self.switch_next_char() self.click_echo() - self.normal_attack() + if self.is_forte_full(): + self.heavy_attack() + # self.normal_attack() self.switch_next_char() def count_base_priority(self): diff --git a/src/combat/CombatCheck.py b/src/combat/CombatCheck.py index 82e7154..cdda8a5 100644 --- a/src/combat/CombatCheck.py +++ b/src/combat/CombatCheck.py @@ -29,7 +29,7 @@ class CombatCheck: self.last_liberation = 0 def reset_to_false(self, recheck=False, reason=""): - if self.handle_monthly_card(): + if self.should_check_monthly_card() and self.handle_monthly_card(): return True if is_pure_black(self.frame): logger.error('getting a pure black frame for unknown reason, reset_to_false return true') diff --git a/src/task/BaseCombatTask.py b/src/task/BaseCombatTask.py index fefd378..f30f351 100644 --- a/src/task/BaseCombatTask.py +++ b/src/task/BaseCombatTask.py @@ -121,10 +121,9 @@ class BaseCombatTask(BaseWWTask, FindFeature, OCR, CombatCheck): max_priority = priority switch_to = char if switch_to == current_char: - self.check_combat() - self.click() + # self.check_combat() logger.warning(f"can't find next char to switch to, maybe switching too fast click and wait") - return self.switch_next_char(current_char, post_action, free_intro, target_low_con) + return current_char.perform() switch_to.has_intro = has_intro logger.info(f'switch_next_char {current_char} -> {switch_to} has_intro {has_intro}') last_click = 0 @@ -159,15 +158,13 @@ class BaseCombatTask(BaseWWTask, FindFeature, OCR, CombatCheck): self.next_frame() else: self.in_liberation = False - switch_time = time.time() current_char.switch_out() switch_to.is_current_char = True break if post_action: post_action() - logger.info(f'switch_next_char end {(switch_time - start):.3f}s') - return switch_time + logger.info(f'switch_next_char end {(current_char.last_switch_time - start):.3f}s') def click(self, x=-1, y=-1, move_back=False, name=None, interval=-1): if x == -1 and y == -1: