0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-06-07 01:15:18 +00:00

fix out of combat error

This commit is contained in:
firedcto@gmail.com 2024-07-05 17:06:14 +08:00
parent e3dc08b852
commit 69767bc5cc
3 changed files with 18 additions and 19 deletions

View File

@ -270,7 +270,7 @@ class BaseChar:
self.task.in_liberation = True
if send_click:
self.task.click(interval=0.1)
if time.time() - start > 5:
if time.time() - start > 0:
self.task.raise_not_in_combat('too long a liberation, the boss was killed by the liberation')
self.task.next_frame()
self.task.in_liberation = False
@ -372,10 +372,11 @@ class BaseChar:
if self.config.get('_full_ring_area', 0) > 0:
percent = max_area / self.config['_full_ring_area']
if not max_is_full and percent >= 1:
self.logger.error(f'is_con_full not full but percent greater than 1, set to 0.99, {percent} {max_is_full}')
self.task.screenshot(
f'is_con_full not full but percent greater than 1, set to 0.99, {percent} {max_is_full}',
cropped)
self.logger.warning(
f'is_con_full not full but percent greater than 1, set to 0.99, {percent} {max_is_full}')
# self.task.screenshot(
# f'is_con_full not full but percent greater than 1, set to 0.99, {percent} {max_is_full}',
# cropped)
percent = 0.99
if percent > 1:
self.logger.error(f'is_con_full percent greater than 1, set to 1, {percent} {max_is_full}')

View File

@ -12,17 +12,14 @@ logger = get_logger(__name__)
class CombatCheck:
def __init__(self):
self.last_out_of_combat_time = 0
self.last_combat_check = 0
self._in_combat = False
self.boss_lv_edge = None
self.boss_lv_box = None
self.in_liberation = False # return True
self.has_count_down = False # instant end of combat if count_down goes away
self.boss_health_box = None
self.in_liberation = False
last_out_of_combat_time = 0
last_combat_check = 0
_in_combat = False
boss_lv_edge = None
boss_lv_box = None
in_liberation = False # return True
has_count_down = False # instant end of combat if count_down goes away
boss_health_box = None
def reset_to_false(self):
self._in_combat = False

View File

@ -1,10 +1,11 @@
from ok.logging.Logger import get_logger
from ok.task.TriggerTask import TriggerTask
from src.task.BaseCombatTask import BaseCombatTask, NotInCombatException
logger = get_logger(__name__)
class AutoCombatTask(BaseCombatTask):
class AutoCombatTask(BaseCombatTask, TriggerTask):
def run(self):
while self.in_combat():
@ -13,8 +14,8 @@ class AutoCombatTask(BaseCombatTask):
self.get_current_char().perform()
except NotInCombatException as e:
logger.info(f'out of combat break {e}')
if self.debug:
self.screenshot(f'out of combat break {e}')
# if self.debug:
self.screenshot(f'out of combat break {e}')
break
def trigger(self):