Fix: Stamina status wasn't updated before checking

This commit is contained in:
LmeSzinc 2024-08-27 11:53:34 +08:00
parent b0363d6c30
commit c839732fd9

View File

@ -32,13 +32,12 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
""" """
self.combat_waves = 1 self.combat_waves = 1
cost = self.combat_get_wave_cost() cost = self.combat_get_wave_cost()
if self.config.stored.TrailblazePower.value < self.combat_wave_cost: current = self.combat_get_trailblaze_power()
if current < self.combat_wave_cost:
if self._try_get_more_trablaize_power(self.combat_wave_cost): if self._try_get_more_trablaize_power(self.combat_wave_cost):
current = self.config.stored.TrailblazePower.value current = self.config.stored.TrailblazePower.value
else: else:
return False return False
else:
current = self.combat_get_trailblaze_power()
if cost == 10: if cost == 10:
# Calyx # Calyx
@ -61,7 +60,7 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
# Check limits # Check limits
if self.config.stored.TrailblazePower.value < self.combat_wave_cost: if self.config.stored.TrailblazePower.value < self.combat_wave_cost:
return False return self._try_get_more_trablaize_power(self.combat_wave_cost)
if self.combat_waves <= 0: if self.combat_waves <= 0:
logger.info('Combat wave limited, cannot continue combat') logger.info('Combat wave limited, cannot continue combat')
return False return False
@ -220,9 +219,6 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
if self.obtain_frequent_check: if self.obtain_frequent_check:
logger.info('Exit combat to check obtained items') logger.info('Exit combat to check obtained items')
return False return False
if self.combat_waves <= 0:
logger.warning(f'combat_waves {self.combat_waves} <= 0 in _combat_can_again, revise to 1')
self.combat_waves = 1
# Wave limit # Wave limit
if self.combat_wave_limit: if self.combat_wave_limit:
if self.combat_wave_done + self.combat_waves > self.combat_wave_limit: if self.combat_wave_done + self.combat_waves > self.combat_wave_limit: