mirror of
https://github.com/ok-oldking/ok-wuthering-waves.git
synced 2025-06-05 08:25:28 +00:00
修复今汐E4不喷, 或提前跳出战斗
This commit is contained in:
parent
0a96e24f9c
commit
02bf30f77e
@ -163,13 +163,14 @@ class BaseChar:
|
||||
if sec > 0:
|
||||
self.task.sleep_check_combat(sec + self.sleep_adjust, check_combat=check_combat)
|
||||
|
||||
def click_resonance(self, post_sleep=0, has_animation=False, send_click=True):
|
||||
def click_resonance(self, post_sleep=0, has_animation=False, send_click=True, animation_min_duration=0):
|
||||
clicked = False
|
||||
self.logger.debug(f'click_resonance start')
|
||||
last_click = 0
|
||||
last_op = 'click'
|
||||
resonance_click_time = 0
|
||||
animated = False
|
||||
start = time.time()
|
||||
while True:
|
||||
if resonance_click_time != 0 and time.time() - resonance_click_time > 8:
|
||||
self.task.in_liberation = False
|
||||
@ -179,7 +180,6 @@ class BaseChar:
|
||||
if has_animation:
|
||||
if not self.task.in_team()[0]:
|
||||
self.task.in_liberation = True
|
||||
self.task.last_liberation = time.time()
|
||||
animated = True
|
||||
if time.time() - resonance_click_time > 6:
|
||||
self.task.in_liberation = False
|
||||
@ -187,13 +187,17 @@ class BaseChar:
|
||||
self.task.next_frame()
|
||||
self.check_combat()
|
||||
continue
|
||||
else:
|
||||
self.task.in_liberation = False
|
||||
now = time.time()
|
||||
self.check_combat()
|
||||
current_resonance = self.current_resonance()
|
||||
if not self.resonance_available(current_resonance):
|
||||
if not self.resonance_available(current_resonance) and (
|
||||
not has_animation or now - start > animation_min_duration):
|
||||
self.logger.debug(f'click_resonance not available break')
|
||||
break
|
||||
self.logger.debug(f'click_resonance resonance_available click {current_resonance}')
|
||||
now = time.time()
|
||||
|
||||
if now - last_click > 0.1:
|
||||
if ((current_resonance == 0) and send_click) or last_op == 'resonance':
|
||||
self.task.click()
|
||||
@ -293,6 +297,7 @@ class BaseChar:
|
||||
self.task.next_frame()
|
||||
if clicked:
|
||||
if self.task.wait_until(lambda: not self.task.in_team()[0], time_out=0.6):
|
||||
self.task.in_liberation = True
|
||||
self.logger.debug(f'not in_team successfully casted liberation')
|
||||
else:
|
||||
self.task.in_liberation = False
|
||||
@ -300,11 +305,11 @@ class BaseChar:
|
||||
return False
|
||||
start = time.time()
|
||||
while not self.task.in_team()[0]:
|
||||
self.task.last_liberation = time.time()
|
||||
self.task.in_liberation = True
|
||||
clicked = True
|
||||
if send_click:
|
||||
self.task.click(interval=0.1)
|
||||
if self.task.last_liberation - start > 7:
|
||||
if time.time() - start > 7:
|
||||
self.task.in_liberation = False
|
||||
self.task.raise_not_in_combat('too long a liberation, the boss was killed by the liberation')
|
||||
self.task.next_frame()
|
||||
|
@ -64,20 +64,18 @@ class Jinhsi(BaseChar):
|
||||
self.incarnation = False
|
||||
self.logger.info(f'handle_incarnation click_resonance start')
|
||||
start = time.time()
|
||||
liberated = False
|
||||
while True:
|
||||
current_res = self.current_resonance()
|
||||
if current_res > 0 and not self.has_cd('resonance'):
|
||||
self.logger.debug(f'handle_incarnation current_res: {current_res} breaking')
|
||||
self.logger.info(f'handle_incarnation current_res: {current_res} breaking')
|
||||
if self.task.debug:
|
||||
self.task.screenshot(f'handle_incarnation e available')
|
||||
# self.send_resonance_key()
|
||||
break
|
||||
self.task.click(interval=0.1)
|
||||
if not liberated or not self.task.in_team()[0]:
|
||||
self.check_combat()
|
||||
self.check_combat()
|
||||
|
||||
self.click_resonance(has_animation=True, send_click=True)
|
||||
self.click_resonance(has_animation=True, animation_min_duration=1)
|
||||
if not self.click_echo():
|
||||
self.task.click()
|
||||
# if self.task.debug:
|
||||
|
@ -17,7 +17,7 @@ class CombatCheck:
|
||||
self._in_combat = False
|
||||
self.boss_lv_template = None
|
||||
self.boss_lv_mask = None
|
||||
self.in_liberation = False # return True
|
||||
self._in_liberation = False # return True
|
||||
self.has_count_down = False
|
||||
self.last_out_of_combat_time = 0
|
||||
self.last_combat_check = 0
|
||||
@ -26,7 +26,17 @@ class CombatCheck:
|
||||
self.boss_health = None
|
||||
self.out_of_combat_reason = ""
|
||||
self.combat_check_interval = 0.8
|
||||
self.last_liberation = 0
|
||||
self._last_liberation = 0
|
||||
|
||||
@property
|
||||
def in_liberation(self):
|
||||
return self._in_liberation
|
||||
|
||||
@in_liberation.setter
|
||||
def in_liberation(self, value):
|
||||
self._in_liberation = value
|
||||
if value:
|
||||
self._last_liberation = time.time()
|
||||
|
||||
def reset_to_false(self, recheck=False, reason=""):
|
||||
if self.should_check_monthly_card() and self.handle_monthly_card():
|
||||
@ -59,7 +69,7 @@ class CombatCheck:
|
||||
return False
|
||||
|
||||
def recent_liberation(self):
|
||||
return time.time() - self.last_liberation < 0.3
|
||||
return time.time() - self._last_liberation < 0.4
|
||||
|
||||
def check_count_down(self):
|
||||
count_down_area = self.box_of_screen_scaled(3840, 2160, 1820, 266, 2100,
|
||||
@ -137,7 +147,6 @@ class CombatCheck:
|
||||
|
||||
def in_combat(self, rechecked=False):
|
||||
if self.in_liberation or self.recent_liberation():
|
||||
self.last_combat_check = time.time()
|
||||
logger.debug('in liberation return True')
|
||||
return True
|
||||
if self._in_combat:
|
||||
@ -219,7 +228,7 @@ class CombatCheck:
|
||||
texts = self.ocr(box=self.box_of_screen(1269 / 3840, 10 / 2160, 2533 / 3840, 140 / 2160, hcenter=True),
|
||||
target_height=540, name='boss_lv_text')
|
||||
boss_lv_texts = find_boxes_by_name(texts,
|
||||
[re.compile(r'(?i)^L[V].*')])
|
||||
[re.compile(r'(?i)^L[Vv].*')])
|
||||
if len(boss_lv_texts) > 0:
|
||||
logger.debug(f'boss_lv_texts: {boss_lv_texts}')
|
||||
self.boss_lv_box = boss_lv_texts[0]
|
||||
|
@ -72,7 +72,7 @@ class BaseCombatTask(BaseWWTask, FindFeature, OCR, CombatCheck):
|
||||
raise e
|
||||
except NotInCombatException as e:
|
||||
logger.info(f'combat_once out of combat break {e}')
|
||||
# self.screenshot(f'combat_once out of combat break {self.out_of_combat_reason}')
|
||||
# self.screenshot(f'combat_once_ooc {self.out_of_combat_reason}')
|
||||
break
|
||||
self.wait_in_team_and_world(time_out=10)
|
||||
self.sleep(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user