From 82f4f255ad55f77fad05fc3bdc5765d3ecf4c5c3 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sun, 19 May 2024 17:17:30 +0800 Subject: [PATCH] Fix: Re-enter dungeon to check obtained items instead of leaving --- tasks/combat/combat.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tasks/combat/combat.py b/tasks/combat/combat.py index 4a6503a2e..f5a7cc7c4 100644 --- a/tasks/combat/combat.py +++ b/tasks/combat/combat.py @@ -126,8 +126,9 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo self.map_A_timer.reset() if self.appear(COMBAT_PREPARE, interval=2): if self.obtained_is_full(self.dungeon): - self.combat_exit() - self.config.task_stop() + # Update stamina so task can be delayed if both obtained_is_full and stamina exhausted + self.combat_get_trailblaze_power() + return False if not self.handle_combat_prepare(): return False self.device.click(COMBAT_PREPARE) @@ -193,18 +194,17 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo in: COMBAT_AGAIN """ current = self.combat_get_trailblaze_power(expect_reduce=self.combat_wave_cost > 0) + # Planner + logger.attr('obtain_frequent_check', self.obtain_frequent_check) + if self.obtain_frequent_check: + logger.info('Exit combat to check obtained items') + return False # Wave limit if self.combat_wave_limit: if self.combat_wave_done + self.combat_waves > self.combat_wave_limit: logger.info(f'Combat wave limit: {self.combat_wave_done}/{self.combat_wave_limit}, ' f'can not run again') return False - # Planner - logger.attr('obtain_frequent_check', self.obtain_frequent_check) - if self.obtain_frequent_check: - logger.info('Exit combat to check obtained items') - return False - # Cost limit if self.combat_wave_cost == 10: if current >= self.combat_wave_cost * self.combat_waves: @@ -229,6 +229,12 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo Returns: bool: True to re-enter combat and run with another wave settings """ + # Planner + logger.attr('obtain_frequent_check', self.obtain_frequent_check) + if self.obtain_frequent_check: + logger.info('Re-enter combat to check obtained items') + return True + # Stamina if self.config.stored.TrailblazePower.value < self.combat_wave_cost: logger.info('Current trailblaze power is not enough for next run') return False