From b521c4a52dffdbf9fb2f1595aa3d9dc48b87c91b Mon Sep 17 00:00:00 2001 From: "firedcto@gmail.com" Date: Tue, 23 Jul 2024 10:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=95=BF=E7=A6=BB=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=95=BF=E7=A6=BB=E6=88=96=E5=AE=89=E5=8F=AF?= =?UTF-8?q?=20=E5=8F=AF=E8=83=BD=E5=8D=A1=E4=BD=8F1=E7=A7=92=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 2 +- src/char/BaseChar.py | 24 +++++++++--------------- src/char/Changli.py | 9 +++++---- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/config.py b/config.py index e7fd2b8..cbd1abe 100644 --- a/config.py +++ b/config.py @@ -7,7 +7,7 @@ from src.task.FarmEchoTask import FarmEchoTask from src.task.FarmWorldBossTask import FarmWorldBossTask from src.task.SkipDialogTask import AutoDialogTask -version = "v0.0.11" +version = "v5.0.11" def calculate_pc_exe_path(running_path): diff --git a/src/char/BaseChar.py b/src/char/BaseChar.py index f52802c..e82fbaf 100644 --- a/src/char/BaseChar.py +++ b/src/char/BaseChar.py @@ -35,7 +35,7 @@ char_lib_check_marks = ['char_1_lib_check_mark', 'char_2_lib_check_mark', 'char_ class BaseChar: - def __init__(self, task, index, res_cd=0, echo_cd=0): + def __init__(self, task, index, res_cd=20, echo_cd=20): self.white_off_threshold = 0.01 self.echo_cd = echo_cd self.task = task @@ -74,14 +74,10 @@ class BaseChar: self.logger.debug(f'set current char false {self.index}') def wait_down(self): - start = time.time() while self.flying(): self.task.click() self.sleep(0.2) - self.task.screenshot( - f'{self}_down_finish_{(time.time() - start):.2f}_f:{self.is_forte_full()}_e:{self.resonance_available()}_r:{self.echo_available()}_q:{self.liberation_available()}_i{self.has_intro}') - def click(self, *args: Any, **kwargs: Any): self.task.click(*args, **kwargs) @@ -118,10 +114,6 @@ class BaseChar: else: invalid_count += 1 has_cd = invalid_count == 0 and (has_dot and 2 <= number_count <= 3) - # if self.task.debug: - # msg = f"{self}_{has_cd}_{box_name} number_count {number_count} big_count {big_area_count} invalid_count {invalid_count} has_dot {has_dot}" - # self.task.screenshot(msg, frame=cropped) - # self.logger.debug(msg) return has_cd def is_available(self, percent, box_name): @@ -215,19 +207,21 @@ class BaseChar: def click_echo(self, duration=0, sleep_time=0): self.logger.debug(f'click_echo start') + if self.has_cd('echo'): + self.logger.debug('click_echo has cd return ') + return False clicked = False start = 0 last_click = 0 while True: self.check_combat() current = self.current_echo() + now = time.time() if duration == 0 and not self.echo_available(current): break - now = time.time() - if duration > 0 and start != 0: + elif duration > 0 and start != 0: if now - start > duration: break - self.logger.debug(f'click_echo echo_available click') if now - last_click > 0.1: if current == 0: self.task.click() @@ -549,9 +543,9 @@ class BaseChar: the_area = area ring_count += 1 - if self.task.debug: - # Save or display the image with contours - cv2.imwrite(f'test\\test_{self}_{is_full}_{the_area}_{lower_bound}.jpg', image_with_contours) + # if self.task.debug: + # Save or display the image with contours + # cv2.imwrite(f'test\\test_{self}_{is_full}_{the_area}_{lower_bound}.jpg', image_with_contours) if ring_count > 1: is_full = False the_area = 0 diff --git a/src/char/Changli.py b/src/char/Changli.py index bd8d530..6275a3e 100644 --- a/src/char/Changli.py +++ b/src/char/Changli.py @@ -14,7 +14,7 @@ class Changli(BaseChar): self.enhanced_normal = False def do_get_switch_priority(self, current_char: BaseChar, has_intro=False): - if time.time() - self.last_e < 3: + if time.time() - self.last_e < 4: self.logger.info( f'switch priority MIN because e not finished') return Priority.MIN @@ -22,23 +22,24 @@ class Changli(BaseChar): return super().do_get_switch_priority(current_char, has_intro) def do_perform(self): - # self.logger.debug( - # f'Encore_perform_{self.has_intro}_{self.echo_available()}_{self.resonance_available()}_{self.liberation_available()}') if self.has_intro or self.enhanced_normal: + self.sleep(0.05) self.normal_attack() self.sleep(0.5) self.enhanced_normal = False if self.is_forte_full(): + self.logger.debug('Changli click heavy attack without ult') self.heavy_attack(0.8) return self.switch_next_char() if self.click_liberation(): + self.sleep(0.1) self.heavy_attack(0.8) - return self.switch_next_char() elif self.resonance_available(): self.send_resonance_key() self.enhanced_normal = True self.normal_attack() elif self.click_echo(1.5): + self.logger.debug('Changli click echo success') pass else: self.normal_attack()