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-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 self.last_heavy = 0
def do_get_switch_priority(self, current_char: BaseChar, has_intro=False, target_low_con=False): def do_get_switch_priority(self, current_char: BaseChar, has_intro=False, target_low_con=False):
self.logger.debug( if has_intro:
f'Camellya last heavy time {self.last_heavy} {self.time_elapsed_accounting_for_freeze(self.last_heavy)}') return Priority.MAX - 1
if self.time_elapsed_accounting_for_freeze(self.last_heavy) < 1.2:
return Priority.MIN
else: else:
return super().do_get_switch_priority(current_char, has_intro) 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') self.logger.error('wait wait_resonance_not_gray timed out')
def do_perform(self): def do_perform(self):
self.wait_resonance_not_gray()
self.click_liberation() self.click_liberation()
if self.click_echo(): i = 0
return self.switch_next_char()
# budding_wait = self.get_current_con() > 0.6
# self.task.screenshot('click_reso1')
start_con = self.get_current_con() start_con = self.get_current_con()
if self.is_con_full(): if start_con < 0.7:
self.handle_budding() loop_time = 1.1
return self.switch_next_char() else:
elif self.click_resonance()[0]: loop_time = 4.1
# self.task.screenshot('click_reso2') budding_start_time = time.time()
self.sleep(0.1) budding = False
while self.get_current_con() == start_con: full = False
self.click() while time.time() - budding_start_time < loop_time or self.task.find_one('camellya_budding', threshold=0.7):
self.sleep(0.15) current_con = self.get_current_con()
self.sleep(0.1) 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() self.task.next_frame()
con_change = start_con - self.get_current_con() i += 1
self.logger.debug(f'con_change {con_change}') if budding:
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():
self.click_resonance() self.click_resonance()
self.handle_budding() self.click_echo()
# self.task.screenshot(f'camellya_end_{self.get_current_con()}')
self.switch_next_char() self.switch_next_char()
def handle_budding(self): # def handle_budding(self):
self.logger.info('camellya_budding start') # self.logger.info('camellya_budding start')
# if budding_wait: # budding_start_time = time.time()
# # self.task.screenshot('budding_wait_1') # i = 0
# self.sleep(0.4) # while time.time() - budding_start_time < 4 or self.task.find_one('camellya_budding', threshold=0.7):
# # self.task.screenshot('budding_wait_2') # if self.resonance_available():
# budding = False # self.send_resonance_key(interval=0.1)
self.click_resonance() # if self.current_resonance() < 0.7:
budding_start_time = time.time() # return
while time.time() - budding_start_time < 4 or self.task.find_one('camellya_budding', threshold=0.7): # else:
self.click(after_sleep=0.2) # self.click(interval=0.1)
self.logger.info(f'camellya_budding end') # i += 1
self.click_resonance() # 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") # 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: # if time.time() - current_char.last_perform < 0.1:
current_char.continues_normal_attack(0.2) 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() return current_char.switch_next_char()
switch_to.has_intro = has_intro switch_to.has_intro = has_intro
logger.info(f'switch_next_char {current_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): if self.find_one(['fast_travel_custom', 'remove_custom', 'gray_teleport'], threshold=0.6):
self.click_relative(0.91, 0.92, after_sleep=1) self.click_relative(0.91, 0.92, after_sleep=1)
if self.wait_click_feature(['confirm_btn_hcenter_vcenter', 'confirm_btn_highlight_hcenter_vcenter'], 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, threshold=0.7,
time_out=5): time_out=4):
self.wait_click_feature(['confirm_btn_hcenter_vcenter', 'confirm_btn_highlight_hcenter_vcenter'], self.wait_click_feature(['confirm_btn_hcenter_vcenter', 'confirm_btn_highlight_hcenter_vcenter'],
relative_x=-1, raise_if_not_found=False, relative_x=-1, raise_if_not_found=False,
threshold=0.7, threshold=0.7,
time_out=1) time_out=1)
return True return True
else:
return True
elif btn := self.find_one('gray_teleport', threshold=0.7): elif btn := self.find_one('gray_teleport', threshold=0.7):
return self.click_box(btn, relative_x=1) return self.click_box(btn, relative_x=1)