Fix: Obtain wasn't updated if stamina exhausted

This commit is contained in:
LmeSzinc 2024-05-30 21:16:36 +08:00
parent df46b5d549
commit 20309919d6
2 changed files with 13 additions and 2 deletions

View File

@ -18,6 +18,7 @@ from tasks.map.control.joystick import MapControlJoystick
class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSupport, CombatSkill, CombatObtain, class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSupport, CombatSkill, CombatObtain,
MapControlJoystick): MapControlJoystick):
dungeon: DungeonList | None = None dungeon: DungeonList | None = None
is_doing_planner: bool = False
def handle_combat_prepare(self): def handle_combat_prepare(self):
""" """
@ -243,6 +244,11 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
return True return True
# Stamina # Stamina
if self.config.stored.TrailblazePower.value < self.combat_wave_cost: if self.config.stored.TrailblazePower.value < self.combat_wave_cost:
if self.is_doing_planner:
logger.info('Current trailblaze power is not enough for next run, '
're-enter combat to check obtained items')
return True
else:
logger.info('Current trailblaze power is not enough for next run') logger.info('Current trailblaze power is not enough for next run')
return False return False
# Wave limit # Wave limit

View File

@ -231,8 +231,10 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
dungeon = DungeonList.find(self.config.Dungeon_NameAtDoubleCalyx) dungeon = DungeonList.find(self.config.Dungeon_NameAtDoubleCalyx)
if planner is not None: if planner is not None:
dungeon = planner dungeon = planner
self.is_doing_planner = True
self.running_double = True self.running_double = True
self.dungeon_run(dungeon=dungeon, wave_limit=self.config.stored.DungeonDouble.calyx) self.dungeon_run(dungeon=dungeon, wave_limit=self.config.stored.DungeonDouble.calyx)
self.is_doing_planner = False
# Double relic # Double relic
if self.config.stored.DungeonDouble.relic > 0: if self.config.stored.DungeonDouble.relic > 0:
logger.info('Run double relic') logger.info('Run double relic')
@ -256,6 +258,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
planner = self.planner.get_dungeon() planner = self.planner.get_dungeon()
if planner is not None: if planner is not None:
final = planner final = planner
self.is_doing_planner = True
# Check daily # Check daily
if self.achieved_daily_quest: if self.achieved_daily_quest:
@ -271,6 +274,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
if self.require_compulsory_support(): if self.require_compulsory_support():
logger.info('Run dungeon with support once as stamina is rogue prioritized') logger.info('Run dungeon with support once as stamina is rogue prioritized')
self.dungeon_run(dungeon=final, wave_limit=1) self.dungeon_run(dungeon=final, wave_limit=1)
self.is_doing_planner = False
# Store immersifiers # Store immersifiers
logger.info('Prioritize stamina for simulated universe, skip dungeon') logger.info('Prioritize stamina for simulated universe, skip dungeon')
amount = 0 amount = 0
@ -290,6 +294,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
else: else:
# Combat # Combat
self.dungeon_run(final) self.dungeon_run(final)
self.is_doing_planner = False
self.delay_dungeon_task(final) self.delay_dungeon_task(final)
def delay_dungeon_task(self, dungeon: DungeonList): def delay_dungeon_task(self, dungeon: DungeonList):