Add combat error beacon and adjust combat recovery

This commit is contained in:
王鹏
2026-04-20 15:32:35 +08:00
parent 6ec468a78b
commit 66b8edf8e4
4 changed files with 82 additions and 12 deletions

View File

@@ -273,6 +273,8 @@ class AutoBotMove:
self.last_attack_scan_time = 0.0
self.attack_stall_scan_threshold = 2.0
self.attack_scan_retry_sec = 2.0
self.attack_stall_s_hold_sec = 0.5
self.min_effective_target_damage_pct = 5
self._last_mouse_path_scale_signature = None
# stop_check: 返回 True 表示需要立即停止(用于中断阻塞中的后勤/路线导航)
self._stop_check = stop_check if callable(stop_check) else (lambda: False)
@@ -698,9 +700,13 @@ class AutoBotMove:
hw_ctrl.keyUp('s')
self._has_braked_for_target = True
# 2. 交互键KEY_LOOT按键策略
hp_dropped = self.last_target_hp > 0 and target_hp < self.last_target_hp
if is_new_target or hp_dropped or self.last_target_damage_time is None:
# 2. 只有超过 5% 的明显掉血才算“新的有效掉血”
hp_drop_amount = max(0, self.last_target_hp - target_hp)
significant_hp_dropped = (
self.last_target_hp > 0
and hp_drop_amount > self.min_effective_target_damage_pct
)
if is_new_target or significant_hp_dropped or self.last_target_damage_time is None:
self.last_target_damage_time = now
# 目标血量100%且超过2秒没掉血按交互键尝试选中/攻击
@@ -715,8 +721,9 @@ class AutoBotMove:
and (now - self.last_target_damage_time) >= self.attack_stall_scan_threshold
and (now - self.last_attack_scan_time) >= self.attack_scan_retry_sec
):
if self.mouse_scan_attack_target():
self.last_target_damage_time = now
hw_ctrl.keyDown('s')
time.sleep(self.attack_stall_s_hold_sec)
hw_ctrl.keyUp('s')
self.last_attack_scan_time = now
self.last_target_hp = target_hp