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