0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-06-03 09:25:19 +00:00

优化椿自动战斗

修复无冠者无法传送
This commit is contained in:
firedcto@gmail.com 2024-11-14 19:06:32 +08:00
parent 3b8c792fb8
commit 9f33ef42bd
3 changed files with 55 additions and 45 deletions

View File

@ -10,10 +10,8 @@ class Camellya(BaseChar):
self.last_heavy = 0
def do_get_switch_priority(self, current_char: BaseChar, has_intro=False, target_low_con=False):
self.logger.debug(
f'Camellya last heavy time {self.last_heavy} {self.time_elapsed_accounting_for_freeze(self.last_heavy)}')
if self.time_elapsed_accounting_for_freeze(self.last_heavy) < 1.2:
return Priority.MIN
if has_intro:
return Priority.MAX - 1
else:
return super().do_get_switch_priority(current_char, has_intro)
@ -26,47 +24,57 @@ class Camellya(BaseChar):
self.logger.error('wait wait_resonance_not_gray timed out')
def do_perform(self):
self.wait_resonance_not_gray()
self.click_liberation()
if self.click_echo():
return self.switch_next_char()
# budding_wait = self.get_current_con() > 0.6
# self.task.screenshot('click_reso1')
i = 0
start_con = self.get_current_con()
if self.is_con_full():
self.handle_budding()
return self.switch_next_char()
elif self.click_resonance()[0]:
# self.task.screenshot('click_reso2')
self.sleep(0.1)
while self.get_current_con() == start_con:
self.click()
self.sleep(0.15)
self.sleep(0.1)
if start_con < 0.7:
loop_time = 1.1
else:
loop_time = 4.1
budding_start_time = time.time()
budding = False
full = False
while time.time() - budding_start_time < loop_time or self.task.find_one('camellya_budding', threshold=0.7):
current_con = self.get_current_con()
if (start_con - current_con > 0.1) and not budding:
self.logger.info(f'confull start budding {current_con}')
budding_start_time = time.time()
loop_time = 5.1
budding = True
elif current_con == 1 and not budding and not full:
full = True
loop_time = 1
budding_start_time = time.time()
start_con = current_con
if self.resonance_available():
self.send_resonance_key(interval=0.1)
if self.get_current_con() < 0.7 and not budding:
# self.task.screenshot(f'camellya_fast_end_{self.get_current_con()}')
return self.switch_next_char()
else:
self.click(interval=0.1)
self.task.next_frame()
con_change = start_con - self.get_current_con()
self.logger.debug(f'con_change {con_change}')
if con_change > 0.2 or self.is_con_full():
self.handle_budding()
return self.switch_next_char()
self.click(after_sleep=0.1)
self.heavy_attack(1.1)
self.last_heavy = time.time()
if self.is_con_full():
i += 1
if budding:
self.click_resonance()
self.handle_budding()
self.click_echo()
# self.task.screenshot(f'camellya_end_{self.get_current_con()}')
self.switch_next_char()
def handle_budding(self):
self.logger.info('camellya_budding start')
# if budding_wait:
# # self.task.screenshot('budding_wait_1')
# self.sleep(0.4)
# # self.task.screenshot('budding_wait_2')
# budding = False
self.click_resonance()
budding_start_time = time.time()
while time.time() - budding_start_time < 4 or self.task.find_one('camellya_budding', threshold=0.7):
self.click(after_sleep=0.2)
self.logger.info(f'camellya_budding end')
self.click_resonance()
# def handle_budding(self):
# self.logger.info('camellya_budding start')
# budding_start_time = time.time()
# i = 0
# while time.time() - budding_start_time < 4 or self.task.find_one('camellya_budding', threshold=0.7):
# if self.resonance_available():
# self.send_resonance_key(interval=0.1)
# if self.current_resonance() < 0.7:
# return
# else:
# self.click(interval=0.1)
# i += 1
# self.logger.info(f'camellya_budding end')
# self.click_resonance()
# def switch_next_char(self, *args):
# self.task.screenshot(f'ca_switch_out_{self.current_con}')
# super().switch_next_char(*args)

View File

@ -178,7 +178,7 @@ class BaseCombatTask(BaseWWTask, FindFeature, OCR, CombatCheck):
# logger.warning(f"can't find next char to switch to, maybe switching too fast click and wait")
# if time.time() - current_char.last_perform < 0.1:
current_char.continues_normal_attack(0.2)
logger.warning(f"can't find next char to switch to, performing too fast add a normal attack")
logger.warning(f"{current_char} can't find next char to switch to, performing too fast add a normal attack")
return current_char.switch_next_char()
switch_to.has_intro = has_intro
logger.info(f'switch_next_char {current_char} -> {switch_to} has_intro {has_intro}')

View File

@ -380,14 +380,16 @@ class BaseWWTask(BaseTask, FindFeature, OCR):
if self.find_one(['fast_travel_custom', 'remove_custom', 'gray_teleport'], threshold=0.6):
self.click_relative(0.91, 0.92, after_sleep=1)
if self.wait_click_feature(['confirm_btn_hcenter_vcenter', 'confirm_btn_highlight_hcenter_vcenter'],
relative_x=-1, raise_if_not_found=True,
relative_x=-1, raise_if_not_found=False,
threshold=0.7,
time_out=5):
time_out=4):
self.wait_click_feature(['confirm_btn_hcenter_vcenter', 'confirm_btn_highlight_hcenter_vcenter'],
relative_x=-1, raise_if_not_found=False,
threshold=0.7,
time_out=1)
return True
else:
return True
elif btn := self.find_one('gray_teleport', threshold=0.7):
return self.click_box(btn, relative_x=1)