0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-06-05 08:25:28 +00:00

优化自动战斗

This commit is contained in:
firedcto@gmail.com 2024-07-30 18:50:33 +08:00
parent a56c646e8b
commit c1fc7012ac
5 changed files with 18 additions and 13 deletions

View File

@ -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]

View File

@ -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():

View File

@ -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):

View File

@ -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')

View File

@ -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: