From a2100474d5ec9c7751a7856601b37ffa87401cb8 Mon Sep 17 00:00:00 2001 From: "firedcto@gmail.com" Date: Sat, 17 Aug 2024 21:50:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E5=B9=B3a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/char/BaseChar.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/char/BaseChar.py b/src/char/BaseChar.py index 01898c9..ea13735 100644 --- a/src/char/BaseChar.py +++ b/src/char/BaseChar.py @@ -238,32 +238,31 @@ class BaseChar: self.last_echo = time.time() def click_echo(self, duration=0, sleep_time=0): - self.logger.debug(f'click_echo start') + self.logger.debug(f'click_echo start duration: {duration}') if self.has_cd('echo'): self.logger.debug('click_echo has cd return ') return False clicked = False - start = 0 + start = time.time() last_click = 0 while True: self.check_combat() current = self.current_echo() - now = time.time() - if duration == 0 and not self.echo_available(current): + if not self.echo_available(current) and (duration == 0 or not clicked): break - elif duration > 0 and start != 0: + now = time.time() + if duration > 0 and start != 0: if now - start > duration: break if now - last_click > 0.1: - if current == 0: - self.task.click() - else: - if start == 0: - start = now - clicked = True + if not clicked: self.update_echo_cd() - self.task.send_key(self.get_echo_key()) + clicked = True + self.task.send_key(self.get_echo_key()) last_click = now + if now - start > 5: + self.logger.error(f'click_echo too long {clicked}') + break self.task.next_frame() self.logger.debug(f'click_echo end {clicked}') return clicked