diff --git a/src/char/i_char.py b/src/char/i_char.py index b146f56..f67cd6e 100644 --- a/src/char/i_char.py +++ b/src/char/i_char.py @@ -329,10 +329,20 @@ class IChar: break self._weapon_switch() keyboard.send(Config().char["battle_command"]) - # Skill icon takes ~0.5s to update after the hotkey; checking too early - # fails every first pass and costs a full extra swap cycle per game. - wait(0.6, 0.8) - if skills.is_right_skill_selected(["BC", "BO"]): + # Skill icon takes anywhere from ~0.3s to ~0.9s to update after the + # hotkey. A single fixed-wait-then-check raced this and consistently + # logged a false "failed" (the very next loop pass would see the + # skill just fine, with no extra wait in between) — poll instead so + # we catch it the moment it renders, and only swap weapons again if + # it genuinely never shows up. + found = False + poll_start = time.time() + while time.time() - poll_start < 1.2: + if skills.is_right_skill_selected(["BC", "BO"]): + found = True + break + wait(0.1, 0.15) + if found: switch_success = True break else: