Skip to content

Commit

Permalink
优化basecombat
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-oldking committed Jan 21, 2025
1 parent 0320d48 commit d46d3ea
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/task/BaseCombatTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,23 @@ def run_in_circle_to_find_echo(self, circle_count=3):
def switch_next_char(self, current_char, post_action=None, free_intro=False, target_low_con=False):
max_priority = Priority.MIN
switch_to = current_char
has_intro = free_intro
if not has_intro:
switch_to.has_intro = free_intro
if not switch_to.has_intro:
current_con = current_char.get_current_con()
if current_con > 0.8 and current_con != 1:
logger.info(f'switch_next_char current_con {current_con:.2f} almost full, sleep and check again')
self.sleep(0.05)
self.next_frame()
current_con = current_char.get_current_con()
if current_con == 1:
has_intro = True
switch_to.has_intro = True
low_con = 200

for i, char in enumerate(self.chars):
if char == current_char:
priority = Priority.CURRENT_CHAR
else:
priority = char.get_switch_priority(current_char, has_intro, target_low_con)
priority = char.get_switch_priority(current_char, switch_to.has_intro, target_low_con)
logger.info(
f'switch_next_char priority: {char} {priority} {char.current_con} target_low_con {target_low_con}')
if target_low_con:
Expand All @@ -182,8 +182,7 @@ def switch_next_char(self, current_char, post_action=None, free_intro=False, tar
current_char.continues_normal_attack(0.2)
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}')
logger.info(f'switch_next_char {current_char} -> {switch_to} has_intro {switch_to.has_intro}')
last_click = 0
start = time.time()
while True:
Expand All @@ -204,9 +203,8 @@ def switch_next_char(self, current_char, post_action=None, free_intro=False, tar
self.raise_not_in_combat(
f'switch too long failed chars_{current_char}_to_{switch_to}, {now - start}')
continue
if current_index != switch_to.index:
has_intro = free_intro if free_intro else current_char.is_con_full()
switch_to.has_intro = has_intro
switch_to.has_intro = switch_to.has_intro if switch_to.has_intro else current_char.is_con_full()
if current_index != switch_to.index:
if now - start > 10:
if self.debug:
self.screenshot(f'switch_not_detected_{current_char}_to_{switch_to}')
Expand Down

0 comments on commit d46d3ea

Please sign in to comment.