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

@@ -218,6 +218,8 @@ class AutoBot:
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
def execute_disengage_loot(self):
@@ -513,9 +515,13 @@ class AutoBot:
hw_ctrl.keyUp('s')
self._has_braked_for_target = True
# 2. 交互逻辑
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 = current_time
if (
@@ -524,8 +530,9 @@ class AutoBot:
and (current_time - self.last_target_damage_time) >= self.attack_stall_scan_threshold
and (current_time - self.last_attack_scan_time) >= self.attack_scan_retry_sec
):
if self.mouse_scan_attack_target():
self.last_target_damage_time = current_time
hw_ctrl.keyDown('s')
time.sleep(self.attack_stall_s_hold_sec)
hw_ctrl.keyUp('s')
self.last_attack_scan_time = current_time
self.last_target_hp = target_hp
if state['combat']: