Refine combat approach timing and always run mouse loot
This commit is contained in:
@@ -252,6 +252,7 @@ class AutoBotMove:
|
||||
enable_mouse_loot=True,
|
||||
turn_error_key=None,
|
||||
turn_error_hold_sec=None,
|
||||
distance_interact_pause_sec=None,
|
||||
):
|
||||
self.last_tab_time = 0
|
||||
self.last_interaction_time = 0 # 记录上一次按互动键的时间
|
||||
@@ -275,6 +276,12 @@ class AutoBotMove:
|
||||
self.combat_signal_retry_sec = 1.0
|
||||
self.turn_error_key = (turn_error_key or 's').strip().lower() or 's'
|
||||
self.turn_error_hold_sec = float(turn_error_hold_sec) if turn_error_hold_sec is not None else 0.8
|
||||
self.distance_interact_pause_until = 0.0
|
||||
self.distance_interact_brake_pending = False
|
||||
self.distance_interact_pause_sec = (
|
||||
float(distance_interact_pause_sec) if distance_interact_pause_sec is not None else 1.0
|
||||
)
|
||||
self.distance_interact_brake_sec = 0.08
|
||||
self._last_mouse_path_scale_signature = None
|
||||
# stop_check: 返回 True 表示需要立即停止(用于中断阻塞中的后勤/路线导航)
|
||||
self._stop_check = stop_check if callable(stop_check) else (lambda: False)
|
||||
@@ -404,8 +411,6 @@ class AutoBotMove:
|
||||
score_threshold=0.7,
|
||||
return_on_first_click=False,
|
||||
):
|
||||
if random.random() < 0.1:
|
||||
return False
|
||||
hwnd = win32gui.FindWindow(None, WIN_TITLE)
|
||||
if not hwnd:
|
||||
return False
|
||||
@@ -499,7 +504,6 @@ class AutoBotMove:
|
||||
score_threshold=0.7,
|
||||
return_on_first_click=False,
|
||||
)
|
||||
if random.random() < 0.1: return False
|
||||
hwnd = win32gui.FindWindow(None, WIN_TITLE)
|
||||
if not hwnd: return False
|
||||
|
||||
@@ -692,6 +696,8 @@ class AutoBotMove:
|
||||
is_new_target = (target_hp > self.last_target_hp + 5)
|
||||
if is_new_target:
|
||||
self._has_braked_for_target = False
|
||||
self.distance_interact_brake_pending = False
|
||||
self.distance_interact_pause_until = 0.0
|
||||
|
||||
# 1. 掉血刹车逻辑:第一次发现目标掉血且正在移动,按一下 S 停住
|
||||
if not self._has_braked_for_target and 0 < target_hp < self.last_target_hp:
|
||||
@@ -699,6 +705,20 @@ class AutoBotMove:
|
||||
time.sleep(0.05)
|
||||
hw_ctrl.keyUp('s')
|
||||
self._has_braked_for_target = True
|
||||
|
||||
if self.distance_interact_brake_pending:
|
||||
if now < self.distance_interact_pause_until:
|
||||
self.last_target_hp = target_hp
|
||||
self._was_in_combat_or_target = True
|
||||
return
|
||||
hw_ctrl.keyDown('s')
|
||||
time.sleep(self.distance_interact_brake_sec)
|
||||
hw_ctrl.keyUp('s')
|
||||
self.distance_interact_brake_pending = False
|
||||
self.distance_interact_pause_until = 0.0
|
||||
self.last_target_hp = target_hp
|
||||
self._was_in_combat_or_target = True
|
||||
return
|
||||
|
||||
# 根据战斗信号执行纠偏动作
|
||||
if (
|
||||
@@ -707,6 +727,11 @@ class AutoBotMove:
|
||||
):
|
||||
hw_ctrl.press(KEY_LOOT)
|
||||
self.last_interaction_time = now
|
||||
self.distance_interact_pause_until = now + self.distance_interact_pause_sec
|
||||
self.distance_interact_brake_pending = True
|
||||
self.last_target_hp = target_hp
|
||||
self._was_in_combat_or_target = True
|
||||
return
|
||||
|
||||
if (
|
||||
combat_error_signal == 50
|
||||
@@ -725,6 +750,8 @@ class AutoBotMove:
|
||||
self.last_target_hp = 0
|
||||
self.last_turn_signal_time = 0.0
|
||||
self.last_interaction_time = 0.0
|
||||
self.distance_interact_brake_pending = False
|
||||
self.distance_interact_pause_until = 0.0
|
||||
self._has_braked_for_target = False
|
||||
if state['combat']:
|
||||
hw_ctrl.press(KEY_TAB)
|
||||
@@ -743,12 +770,16 @@ class AutoBotMove:
|
||||
self.target_acquired_time = None
|
||||
self.last_turn_signal_time = 0.0
|
||||
self.last_interaction_time = 0.0
|
||||
self.distance_interact_brake_pending = False
|
||||
self.distance_interact_pause_until = 0.0
|
||||
self.last_tab_time = time.time() + 1.0 # 给找怪增加 1 秒额外冷却
|
||||
return
|
||||
|
||||
self.target_acquired_time = None
|
||||
self.last_turn_signal_time = 0.0
|
||||
self.last_interaction_time = 0.0
|
||||
self.distance_interact_brake_pending = False
|
||||
self.distance_interact_pause_until = 0.0
|
||||
self._was_in_combat_or_target = False
|
||||
|
||||
# 4. 脱战低血量:就地吃面包(最多等待 30 秒或回满)
|
||||
|
||||
Reference in New Issue
Block a user