mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 10:01:10 +00:00
Fix: Ornament scheduling
This commit is contained in:
parent
779d4e4c1c
commit
0339b1c852
@ -203,7 +203,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
|
||||
|
||||
elif require and not self.support_once:
|
||||
# Run with support all the way
|
||||
return self._dungeon_run(dungeon=dungeon, team=team, wave_limit=1,
|
||||
return self._dungeon_run(dungeon=dungeon, team=team, wave_limit=0,
|
||||
support_character=self.config.DungeonSupport_Character)
|
||||
|
||||
else:
|
||||
@ -281,7 +281,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
|
||||
|
||||
# Dungeon to clear all trailblaze power
|
||||
do_rogue = False
|
||||
if self.config.is_task_enabled('Rogue'):
|
||||
if self.config.is_task_enabled('Rogue') and not self.config.is_task_enabled('Ornament'):
|
||||
if self.config.cross_get('Rogue.RogueWorld.UseStamina'):
|
||||
logger.info('Going to use stamina in rogue')
|
||||
do_rogue = True
|
||||
|
@ -19,6 +19,10 @@ class OrnamentCombat(Dungeon, RouteLoader, DungeonState):
|
||||
# Enter from survival index instead
|
||||
pass
|
||||
|
||||
def _combat_should_reenter(self):
|
||||
# Never re-enter, can only enter from Survival_Index
|
||||
return False
|
||||
|
||||
def get_double_event_remain_at_combat(self, button=OCR_DOUBLE_EVENT_REMAIN_AT_OE):
|
||||
# Different position to OCR
|
||||
return super().get_double_event_remain_at_combat(button)
|
||||
@ -100,10 +104,16 @@ class OrnamentCombat(Dungeon, RouteLoader, DungeonState):
|
||||
else:
|
||||
self._search_support(support_character_name) # Search support
|
||||
selected_support = True
|
||||
self.device.click(OCR_DOUBLE_EVENT_REMAIN_AT_OE)
|
||||
self.device.click(SUPPORT_ADD)
|
||||
self.interval_reset(COMBAT_SUPPORT_LIST)
|
||||
continue
|
||||
|
||||
def get_equivalent_stamina(self):
|
||||
value = self.config.stored.Immersifier.value * 40
|
||||
if self.config.Ornament_UseStamina:
|
||||
value += self.config.stored.TrailblazePower.value
|
||||
return value
|
||||
|
||||
def combat_get_trailblaze_power(self, expect_reduce=False, skip_first_screenshot=True) -> int:
|
||||
"""
|
||||
Args:
|
||||
@ -116,12 +126,12 @@ class OrnamentCombat(Dungeon, RouteLoader, DungeonState):
|
||||
Pages:
|
||||
in: COMBAT_PREPARE or COMBAT_REPEAT
|
||||
"""
|
||||
before = self.config.stored.TrailblazePower.value + self.config.stored.Immersifier.value * 40
|
||||
before = self.get_equivalent_stamina()
|
||||
|
||||
after = before
|
||||
for _ in range(3):
|
||||
self.dungeon_update_stamina()
|
||||
after = self.config.stored.TrailblazePower.value + self.config.stored.Immersifier.value * 40
|
||||
after = self.get_equivalent_stamina()
|
||||
if expect_reduce:
|
||||
if before > after:
|
||||
break
|
||||
@ -130,6 +140,11 @@ class OrnamentCombat(Dungeon, RouteLoader, DungeonState):
|
||||
|
||||
return after
|
||||
|
||||
def is_trailblaze_power_exhausted(self):
|
||||
flag = self.get_equivalent_stamina() < self.combat_wave_cost
|
||||
logger.attr('TrailblazePowerExhausted', flag)
|
||||
return flag
|
||||
|
||||
def is_team_prepared(self) -> bool:
|
||||
"""
|
||||
Pages:
|
||||
|
@ -56,6 +56,14 @@ class Ornament(OrnamentCombat):
|
||||
|
||||
return result
|
||||
|
||||
def delay_dungeon_task(self, dungeon: DungeonList):
|
||||
with self.config.multi_set():
|
||||
super().delay_dungeon_task(dungeon)
|
||||
if not self.config.Ornament_UseStamina and self.config.stored.DungeonDouble.rogue <= 0:
|
||||
if self.config.stored.Immersifier.value <= 0:
|
||||
logger.info('Immersifier exhausted')
|
||||
self.config.task_delay(server_update=True)
|
||||
|
||||
def run(self):
|
||||
self.config.update_battle_pass_quests()
|
||||
self.config.update_daily_quests()
|
||||
@ -79,6 +87,7 @@ class Ornament(OrnamentCombat):
|
||||
|
||||
# Run
|
||||
dungeon = DungeonList.find(self.config.Ornament_Dungeon)
|
||||
self.support_once = False
|
||||
self.combat_wave_cost = 40
|
||||
self.dungeon = dungeon
|
||||
if self.config.Ornament_UseStamina:
|
||||
@ -91,9 +100,8 @@ class Ornament(OrnamentCombat):
|
||||
self.running_double = True
|
||||
self.dungeon_run(dungeon, wave_limit=self.config.stored.DungeonDouble.rogue)
|
||||
self.running_double = False
|
||||
|
||||
self.config.task_delay(server_update=True)
|
||||
self.dungeon_stamina_delay(dungeon)
|
||||
else:
|
||||
# Use immersifier only, wave limited in _dungeon_wait_until_dungeon_list_loaded
|
||||
self.dungeon_run(dungeon, wave_limit=0)
|
||||
self.config.task_delay(server_update=True)
|
||||
self.dungeon_stamina_delay(dungeon)
|
||||
|
@ -353,6 +353,8 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonRogueUI
|
||||
f'RogueWorld_DoubleEvent={self.config.RogueWorld_DoubleEvent}, '
|
||||
f'RogueWorld_WeeklyFarming={self.config.RogueWorld_WeeklyFarming}, '
|
||||
f'RogueDebug_DebugMode={self.config.RogueDebug_DebugMode}')
|
||||
ornament = self.config.is_task_enabled('Ornament')
|
||||
logger.info(f'Ornament: {ornament}')
|
||||
# This shouldn't happen
|
||||
if self.config.RogueWorld_UseStamina and not self.config.RogueWorld_UseImmersifier:
|
||||
logger.error('Invalid rogue reward settings')
|
||||
@ -376,6 +378,9 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonRogueUI
|
||||
if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0:
|
||||
logger.info(
|
||||
'Reached weekly point limit but still have immersifiers left, continue to use them')
|
||||
if ornament:
|
||||
logger.info('Ornament enabled, skip farming rogue')
|
||||
raise RogueReachedWeeklyPointLimit
|
||||
elif self.config.RogueWorld_WeeklyFarming and not self.config.stored.SimulatedUniverseFarm.is_full():
|
||||
logger.info(
|
||||
'Reached weekly point limit but still continue to farm materials')
|
||||
|
Loading…
Reference in New Issue
Block a user