0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-06-07 09:25:34 +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 self.task.in_liberation = True
if send_click: if send_click:
self.task.click(interval=0.1) 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.raise_not_in_combat('too long a liberation, the boss was killed by the liberation')
self.task.next_frame() self.task.next_frame()
self.task.in_liberation = False self.task.in_liberation = False
@ -372,10 +372,11 @@ class BaseChar:
if self.config.get('_full_ring_area', 0) > 0: if self.config.get('_full_ring_area', 0) > 0:
percent = max_area / self.config['_full_ring_area'] percent = max_area / self.config['_full_ring_area']
if not max_is_full and percent >= 1: 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.logger.warning(
self.task.screenshot( f'is_con_full not full but percent greater than 1, set to 0.99, {percent} {max_is_full}')
f'is_con_full not full but percent greater than 1, set to 0.99, {percent} {max_is_full}', # self.task.screenshot(
cropped) # f'is_con_full not full but percent greater than 1, set to 0.99, {percent} {max_is_full}',
# cropped)
percent = 0.99 percent = 0.99
if percent > 1: if percent > 1:
self.logger.error(f'is_con_full percent greater than 1, set to 1, {percent} {max_is_full}') 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: class CombatCheck:
last_out_of_combat_time = 0
def __init__(self): last_combat_check = 0
self.last_out_of_combat_time = 0 _in_combat = False
self.last_combat_check = 0 boss_lv_edge = None
self._in_combat = False boss_lv_box = None
self.boss_lv_edge = None in_liberation = False # return True
self.boss_lv_box = None has_count_down = False # instant end of combat if count_down goes away
self.in_liberation = False # return True boss_health_box = None
self.has_count_down = False # instant end of combat if count_down goes away
self.boss_health_box = None
self.in_liberation = False
def reset_to_false(self): def reset_to_false(self):
self._in_combat = False self._in_combat = False

View File

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