Skip to content

Commit

Permalink
优化散华, 改成预输入重击
Browse files Browse the repository at this point in the history
优化安可
  • Loading branch information
ok-oldking committed Jan 12, 2025
1 parent aec6d01 commit 42196ab
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 16 deletions.
18 changes: 15 additions & 3 deletions src/char/BaseChar.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,18 @@ def wait_down(self):
self.task.click()
self.sleep(0.2)

def wait_intro(self, time_out=1.2,click=True):
self.task.wait_until(self.down, post_action=self.click_with_interval if click else None, time_out=time_out, wait_until_before_delay=0,
wait_until_check_delay=0)

def down(self):
return (self.current_echo() > 0 and not self.has_cd('echo')) or (self.current_resonance() > 0 and not self.has_cd('resonance'))

def click_with_interval(self, interval=0.1):
self.click(interval=interval)

def click(self, *args: Any, **kwargs: Any):
self.logger.debug(f'click {args} {kwargs}')
self.task.click(*args, **kwargs)

def do_perform(self):
Expand Down Expand Up @@ -156,7 +167,7 @@ def click_resonance(self, post_sleep=0, has_animation=False, send_click=True, an
self.logger.debug(f'click_resonance resonance_available click {current_resonance}')

if now - last_click > 0.1:
if ((current_resonance == 0) and send_click) or last_op == 'resonance':
if send_click and (current_resonance == 0 or last_op == 'resonance'):
self.task.click()
last_op = 'click'
continue
Expand Down Expand Up @@ -242,7 +253,8 @@ def click_liberation(self, con_less_than=-1, send_click=False, wait_if_cd_ready=
while time.time() - start < wait_if_cd_ready and not self.liberation_available() and not self.has_cd(
'liberation'):
self.logger.debug(f'click_liberation wait ready {wait_if_cd_ready}')
self.click(interval=0.1)
if send_click:
self.click(interval=0.1)
self.task.next_frame()
while self.liberation_available(): # clicked and still in team wait for animation
self.logger.debug(f'click_liberation liberation_available click')
Expand All @@ -268,7 +280,7 @@ def click_liberation(self, con_less_than=-1, send_click=False, wait_if_cd_ready=
self.task.in_liberation = True
clicked = True
if send_click:
self.task.click(interval=0.1)
self.click(interval=0.1)
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')
Expand Down
17 changes: 13 additions & 4 deletions src/char/Encore.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ def switch_out(self):

def do_perform(self):
if self.has_intro:
self.logger.debug('encore wait intro')
self.continues_normal_attack(1.4)
self.wait_down()
elapsed = self.time_elapsed_accounting_for_freeze(self.liberation_time)
self.logger.debug(f'encore wait intro {elapsed}')
if 6 < elapsed < 10 and self.is_forte_full():
self.logger.debug('encore heavy attack after intro')
self.task.mouse_down()
self.wait_intro(time_out=1.4, click=False)
self.task.mouse_up()
self.sleep(0.1)
self.last_heavy = time.time()
return self.switch_next_char()
else:
self.wait_intro(time_out=1.4, click=True)
if self.still_in_liberation():
self.n4()
return self.switch_next_char()
Expand Down Expand Up @@ -57,7 +66,7 @@ def can_resonance_step2(self, delay=2):
def do_get_switch_priority(self, current_char: BaseChar, has_intro=False, target_low_con=False):
self.logger.debug(
f'encore 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) < 4.5:
if self.time_elapsed_accounting_for_freeze(self.last_heavy) < 4.6:
return Priority.MIN
elif self.still_in_liberation() or self.can_resonance_step2():
self.logger.info(
Expand Down
29 changes: 20 additions & 9 deletions src/char/Sanhua.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import time

from src.char.BaseChar import BaseChar


class Sanhua(BaseChar):
def do_perform(self):
sleep_time = 0.65
self.sleep(0.02)
self.task.mouse_down()
self.sleep(0.1)
start = time.time()
if self.has_intro:
self.continues_normal_attack(1.2)
self.click_liberation()
if self.click_resonance()[0]:
return self.switch_next_char()
if self.click_echo():
return self.switch_next_char()

self.heavy_attack(0.75)
self.sleep(0.4)
sleep_time -= 0.1
self.wait_intro(click=False, time_out=1.1)
if self.click_liberation(send_click=False):
sleep_time += 0.40
pass
clicked, duration, _ = self.click_resonance(send_click=False)
if not clicked:
self.click_echo()
sleep_time -= self.time_elapsed_accounting_for_freeze(start)
self.logger.debug('Sanhua to_sleep {}'.format(sleep_time))
self.sleep(sleep_time)
self.task.mouse_up()
self.sleep(0.45)
self.switch_next_char()

0 comments on commit 42196ab

Please sign in to comment.