Skip to content

Commit

Permalink
优化自动战斗锁定敌人
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-oldking committed Nov 15, 2024
1 parent edac182 commit 25c9f66
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/combat/CombatCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,8 @@ def in_combat(self):
if not self._in_realm:
self._in_multiplayer = self.in_multiplayer()
in_combat = self.has_target() or ((not self.check_team or self.in_team()[0]) and self.check_health_bar())
in_combat = in_combat and self.check_target_enemy_btn()
in_combat = in_combat and self.check_target_enemy_btn() and self.target_enemy(wait=True)
if in_combat:
self.target_enemy(wait=False)
logger.info(
f'enter combat cost {(time.time() - start):2f} boss_lv_template:{self.boss_lv_template is not None} boss_health_box:{self.boss_health_box} has_count_down:{self.has_count_down}')
self._in_combat = True
Expand Down Expand Up @@ -220,9 +219,11 @@ def target_enemy(self, wait=True):
else:
if self.has_target():
return True
return self.wait_until(self.has_target, time_out=1.5, wait_until_before_delay=0,
wait_until_check_delay=0.3,
pre_action=self.middle_click)
else:
logger.info(f'target lost try retarget')
return self.wait_until(self.has_target, time_out=2.1, wait_until_before_delay=0.1,
wait_until_check_delay=0.5,
pre_action=self.middle_click)

def check_health_bar(self):
if self._in_combat:
Expand Down

0 comments on commit 25c9f66

Please sign in to comment.