2024-07-19 02:01:57 +00:00
|
|
|
from datetime import timedelta
|
|
|
|
|
2024-06-17 19:04:32 +00:00
|
|
|
from module.base.decorator import set_cached_property
|
2023-07-09 09:48:11 +00:00
|
|
|
from module.base.utils import area_offset
|
2024-07-19 02:01:57 +00:00
|
|
|
from module.config.stored.classes import now
|
2023-06-17 17:09:09 +00:00
|
|
|
from module.logger import logger
|
2024-02-06 21:13:54 +00:00
|
|
|
from tasks.battle_pass.keywords import KEYWORDS_BATTLE_PASS_QUEST
|
2023-06-17 17:09:09 +00:00
|
|
|
from tasks.combat.combat import Combat
|
2023-08-27 09:13:05 +00:00
|
|
|
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
|
2023-07-10 15:36:35 +00:00
|
|
|
from tasks.dungeon.event import DungeonEvent
|
2024-02-12 15:29:21 +00:00
|
|
|
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB
|
2023-12-08 17:14:30 +00:00
|
|
|
from tasks.dungeon.stamina import DungeonStamina
|
2024-06-14 17:26:52 +00:00
|
|
|
from tasks.item.synthesize import Synthesize
|
2023-06-17 17:09:09 +00:00
|
|
|
|
2023-09-26 19:14:12 +00:00
|
|
|
|
2023-12-08 17:14:30 +00:00
|
|
|
class Dungeon(DungeonStamina, DungeonEvent, Combat):
|
2023-08-27 09:13:05 +00:00
|
|
|
called_daily_support = False
|
|
|
|
achieved_daily_quest = False
|
2024-01-01 20:07:35 +00:00
|
|
|
achieved_weekly_quest = False
|
2023-10-03 12:06:44 +00:00
|
|
|
running_double = False
|
2024-07-01 18:41:12 +00:00
|
|
|
support_once = True
|
2023-08-27 09:13:05 +00:00
|
|
|
daily_quests = []
|
2024-01-01 20:07:35 +00:00
|
|
|
weekly_quests = []
|
2023-08-27 09:13:05 +00:00
|
|
|
|
|
|
|
def _dungeon_run(self, dungeon: DungeonList, team: int = None, wave_limit: int = 0, support_character: str = None,
|
|
|
|
skip_ui_switch: bool = False):
|
|
|
|
"""
|
|
|
|
Args:
|
|
|
|
dungeon:
|
|
|
|
team: 1 to 6.
|
|
|
|
wave_limit: Limit combat runs, 0 means no limit.
|
|
|
|
support_character: Support character name
|
|
|
|
skip_ui_switch: True if already at dungeon aside
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
int: Run count
|
|
|
|
|
|
|
|
Pages:
|
2023-10-04 21:04:10 +00:00
|
|
|
in: page_main, DUNGEON_COMBAT_INTERACT
|
|
|
|
or COMBAT_PREPARE
|
2023-08-27 09:13:05 +00:00
|
|
|
out: page_main
|
|
|
|
"""
|
2023-06-17 17:09:09 +00:00
|
|
|
if team is None:
|
|
|
|
team = self.config.Dungeon_Team
|
2023-08-27 09:13:05 +00:00
|
|
|
if support_character is None and self.config.DungeonSupport_Use == 'always_use':
|
|
|
|
support_character = self.config.DungeonSupport_Character
|
|
|
|
|
|
|
|
logger.hr('Dungeon run', level=1)
|
|
|
|
logger.info(f'Dungeon: {dungeon}, team={team}, wave_limit={wave_limit}, support_character={support_character}')
|
|
|
|
|
|
|
|
if not skip_ui_switch:
|
2023-11-02 10:56:20 +00:00
|
|
|
interact = self.get_dungeon_interact()
|
|
|
|
if interact is not None and interact == dungeon:
|
|
|
|
logger.info('Already nearby dungeon')
|
|
|
|
else:
|
|
|
|
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
|
|
|
|
self.dungeon_goto(dungeon)
|
2023-07-10 15:36:35 +00:00
|
|
|
|
2023-08-27 09:13:05 +00:00
|
|
|
if dungeon == KEYWORDS_DUNGEON_LIST.Stagnant_Shadow_Blaze:
|
|
|
|
if self.handle_destructible_around_blaze():
|
|
|
|
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
|
|
|
|
self.dungeon_goto(dungeon)
|
2023-10-04 21:04:10 +00:00
|
|
|
|
|
|
|
self.combat_enter_from_map()
|
2023-10-03 12:06:44 +00:00
|
|
|
# Check double event remain before combat
|
|
|
|
# Conservatively prefer the smaller result
|
|
|
|
if (dungeon.is_Calyx_Golden or dungeon.is_Calyx_Crimson) and \
|
|
|
|
self.running_double and self.config.stored.DungeonDouble.calyx > 0:
|
|
|
|
calyx = self.get_double_event_remain_at_combat()
|
2023-11-03 06:02:54 +00:00
|
|
|
if calyx is not None and calyx < self.config.stored.DungeonDouble.calyx:
|
2023-10-03 12:06:44 +00:00
|
|
|
self.config.stored.DungeonDouble.calyx = calyx
|
|
|
|
wave_limit = calyx
|
|
|
|
if calyx == 0:
|
|
|
|
return 0
|
|
|
|
if dungeon.is_Cavern_of_Corrosion and self.running_double and \
|
|
|
|
self.config.stored.DungeonDouble.relic > 0:
|
|
|
|
relic = self.get_double_event_remain_at_combat()
|
2023-11-03 06:02:54 +00:00
|
|
|
if relic is not None and relic < self.config.stored.DungeonDouble.relic:
|
2023-10-03 12:06:44 +00:00
|
|
|
self.config.stored.DungeonDouble.relic = relic
|
|
|
|
wave_limit = relic
|
|
|
|
if relic == 0:
|
|
|
|
return 0
|
2024-07-01 18:41:12 +00:00
|
|
|
# No need, already checked in Survival_Index
|
|
|
|
# if dungeon.is_Ornament_Extraction and self.running_double and \
|
|
|
|
# self.config.stored.DungeonDouble.rogue > 0:
|
|
|
|
# rogue = self.get_double_event_remain_at_combat()
|
|
|
|
# if rogue is not None and rogue < self.config.stored.DungeonDouble.rogue:
|
|
|
|
# self.config.stored.DungeonDouble.rogue = rogue
|
|
|
|
# wave_limit = rogue
|
|
|
|
# if rogue == 0:
|
|
|
|
# return 0
|
|
|
|
|
2023-07-10 15:36:35 +00:00
|
|
|
# Combat
|
2024-05-17 18:35:44 +00:00
|
|
|
self.dungeon = dungeon
|
2023-08-27 09:13:05 +00:00
|
|
|
count = self.combat(team=team, wave_limit=wave_limit, support_character=support_character)
|
2024-05-17 18:35:44 +00:00
|
|
|
self.dungeon = None
|
2023-08-27 09:13:05 +00:00
|
|
|
|
|
|
|
# Update quest states
|
2024-01-01 20:07:35 +00:00
|
|
|
with self.config.multi_set():
|
|
|
|
# Calyx_Golden
|
|
|
|
if dungeon.is_Calyx_Golden:
|
|
|
|
if KEYWORDS_DAILY_QUEST.Clear_Calyx_Golden_1_times in self.daily_quests:
|
|
|
|
logger.info('Achieved daily quest Clear_Calyx_Golden_1_times')
|
|
|
|
self.achieved_daily_quest = True
|
2024-02-06 21:13:54 +00:00
|
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Clear_Calyx_1_times in self.weekly_quests:
|
2024-01-01 20:07:35 +00:00
|
|
|
logger.info('Done weekly quest Clear_Calyx_1_times once')
|
|
|
|
self.config.stored.BattlePassQuestCalyx.add()
|
|
|
|
if self.config.stored.BattlePassQuestCalyx.is_full():
|
|
|
|
logger.info('Achieved weekly quest BattlePassQuestCalyx')
|
|
|
|
self.achieved_weekly_quest = True
|
|
|
|
# Calyx_Crimson
|
|
|
|
if dungeon.is_Calyx_Crimson:
|
|
|
|
if KEYWORDS_DAILY_QUEST.Clear_Calyx_Crimson_1_times in self.daily_quests:
|
|
|
|
logger.info('Achieve daily quest Clear_Calyx_Crimson_1_times')
|
|
|
|
self.achieved_daily_quest = True
|
2024-02-06 21:13:54 +00:00
|
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Clear_Calyx_1_times in self.weekly_quests:
|
2024-01-01 20:07:35 +00:00
|
|
|
logger.info('Done weekly quest Clear_Calyx_1_times once')
|
|
|
|
self.config.stored.BattlePassQuestCalyx.add()
|
|
|
|
if self.config.stored.BattlePassQuestCalyx.is_full():
|
|
|
|
logger.info('Achieved weekly quest BattlePassQuestCalyx')
|
|
|
|
self.achieved_weekly_quest = True
|
|
|
|
# Stagnant_Shadow
|
|
|
|
if dungeon.is_Stagnant_Shadow:
|
|
|
|
if KEYWORDS_DAILY_QUEST.Clear_Stagnant_Shadow_1_times in self.daily_quests:
|
|
|
|
logger.info('Achieve daily quest Clear_Stagnant_Shadow_1_times')
|
|
|
|
self.achieved_daily_quest = True
|
2024-07-18 17:48:49 +00:00
|
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Clear_Stagnant_Shadow_1_times in self.weekly_quests:
|
|
|
|
logger.info('Done weekly quest Clear_Stagnant_Shadow_1_times once')
|
|
|
|
self.config.stored.BattlePassQuestStagnantShadow.add()
|
|
|
|
if self.config.stored.BattlePassQuestStagnantShadow.is_full():
|
|
|
|
logger.info('Achieved weekly quest Clear_Stagnant_Shadow_1_times')
|
|
|
|
self.achieved_weekly_quest = True
|
2024-01-01 20:07:35 +00:00
|
|
|
# Cavern_of_Corrosion
|
|
|
|
if dungeon.is_Cavern_of_Corrosion:
|
|
|
|
if KEYWORDS_DAILY_QUEST.Clear_Cavern_of_Corrosion_1_times in self.daily_quests:
|
|
|
|
logger.info('Achieve daily quest Clear_Cavern_of_Corrosion_1_times')
|
|
|
|
self.achieved_daily_quest = True
|
2024-02-06 21:13:54 +00:00
|
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Clear_Cavern_of_Corrosion_1_times in self.weekly_quests:
|
2024-01-01 20:07:35 +00:00
|
|
|
logger.info('Done weekly quest Clear_Cavern_of_Corrosion_1_times once')
|
|
|
|
self.config.stored.BattlePassQuestCavernOfCorrosion.add()
|
|
|
|
if self.config.stored.BattlePassQuestCavernOfCorrosion.is_full():
|
|
|
|
logger.info('Achieved weekly quest Clear_Cavern_of_Corrosion_1_times')
|
|
|
|
self.achieved_weekly_quest = True
|
|
|
|
# Echo_of_War
|
|
|
|
if dungeon.is_Echo_of_War:
|
|
|
|
if KEYWORDS_DAILY_QUEST.Complete_Echo_of_War_1_times in self.daily_quests:
|
|
|
|
logger.info('Achieve daily quest Complete_Echo_of_War_1_times')
|
|
|
|
self.achieved_daily_quest = True
|
2024-02-06 21:13:54 +00:00
|
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Complete_Echo_of_War_1_times in self.weekly_quests:
|
2024-01-01 20:07:35 +00:00
|
|
|
logger.info('Done weekly quest Complete_Echo_of_War_1_times once')
|
|
|
|
self.config.stored.BattlePassQuestEchoOfWar.add()
|
|
|
|
if self.config.stored.BattlePassQuestEchoOfWar.is_full():
|
|
|
|
logger.info('Achieved weekly quest Complete_Echo_of_War_1_times')
|
|
|
|
self.achieved_weekly_quest = True
|
2024-07-01 20:25:25 +00:00
|
|
|
# Ornament_Extraction
|
|
|
|
if dungeon.is_Ornament_Extraction:
|
|
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Complete_Divergent_Universe_or_Simulated_Universe_1_times in self.weekly_quests:
|
|
|
|
logger.info('Achieved weekly quest Complete_Divergent_Universe_or_Simulated_Universe_1_times')
|
|
|
|
# No need to add since it's 0/1
|
|
|
|
self.achieved_weekly_quest = True
|
2024-01-01 20:07:35 +00:00
|
|
|
# Support quest
|
|
|
|
if support_character is not None:
|
|
|
|
self.called_daily_support = True
|
2024-05-27 15:09:46 +00:00
|
|
|
if KEYWORDS_DAILY_QUEST.Obtain_victory_in_combat_with_Support_Characters_1_times in self.daily_quests:
|
2024-01-01 20:07:35 +00:00
|
|
|
logger.info('Achieve daily quest Obtain_victory_in_combat_with_Support_Characters_1_times')
|
|
|
|
self.achieved_daily_quest = True
|
|
|
|
# Stamina quest
|
2024-01-12 15:54:37 +00:00
|
|
|
self.check_stamina_quest(self.combat_wave_cost * count)
|
2024-01-01 20:07:35 +00:00
|
|
|
|
|
|
|
# Check trailblaze power, this may stop current task
|
|
|
|
if self.is_trailblaze_power_exhausted():
|
2024-06-14 17:26:52 +00:00
|
|
|
# Scheduler
|
2024-01-01 20:07:35 +00:00
|
|
|
self.delay_dungeon_task(dungeon)
|
2024-06-14 17:26:52 +00:00
|
|
|
self.check_synthesize()
|
|
|
|
self.config.task_stop()
|
2023-08-27 09:13:05 +00:00
|
|
|
|
|
|
|
return count
|
|
|
|
|
|
|
|
def dungeon_run(
|
|
|
|
self, dungeon: DungeonList, team: int = None, wave_limit: int = 0, support_character: str = None):
|
|
|
|
"""
|
|
|
|
Run dungeon, and handle daily support
|
|
|
|
|
|
|
|
Args:
|
|
|
|
dungeon:
|
|
|
|
team: 1 to 6.
|
|
|
|
wave_limit: Limit combat runs, 0 means no limit.
|
|
|
|
support_character: Support character name
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
int: Run count
|
2023-06-17 17:09:09 +00:00
|
|
|
|
2023-08-27 09:13:05 +00:00
|
|
|
Pages:
|
|
|
|
in: Any
|
|
|
|
out: page_main
|
|
|
|
"""
|
|
|
|
require = self.require_compulsory_support()
|
2024-07-01 18:41:12 +00:00
|
|
|
if require and self.support_once:
|
2023-08-27 09:13:05 +00:00
|
|
|
logger.info('Run once with support')
|
|
|
|
count = self._dungeon_run(dungeon=dungeon, team=team, wave_limit=1,
|
|
|
|
support_character=self.config.DungeonSupport_Character)
|
|
|
|
|
|
|
|
logger.info('Run the rest waves without compulsory support')
|
|
|
|
if wave_limit >= 2 or wave_limit == 0:
|
|
|
|
# Already at page_name with DUNGEON_COMBAT_INTERACT
|
|
|
|
if wave_limit >= 2:
|
|
|
|
wave_limit -= 1
|
|
|
|
count += self._dungeon_run(dungeon=dungeon, team=team, wave_limit=wave_limit,
|
|
|
|
support_character=support_character, skip_ui_switch=True)
|
|
|
|
|
|
|
|
return count
|
|
|
|
|
2024-07-01 18:41:12 +00:00
|
|
|
elif require and not self.support_once:
|
|
|
|
# Run with support all the way
|
2024-07-01 21:29:16 +00:00
|
|
|
return self._dungeon_run(dungeon=dungeon, team=team, wave_limit=0,
|
2024-09-10 14:41:00 +00:00
|
|
|
support_character=self.config.DungeonSupport_Character)
|
2024-07-01 18:41:12 +00:00
|
|
|
|
2023-08-27 09:13:05 +00:00
|
|
|
else:
|
|
|
|
# Normal run
|
|
|
|
return self._dungeon_run(dungeon=dungeon, team=team, wave_limit=wave_limit,
|
|
|
|
support_character=support_character)
|
|
|
|
|
2024-07-01 18:41:12 +00:00
|
|
|
def update_double_event_record(self):
|
|
|
|
"""
|
|
|
|
Pages:
|
|
|
|
in: Any
|
|
|
|
out: page_guide, Survival_Index
|
|
|
|
"""
|
2023-08-27 09:13:05 +00:00
|
|
|
# Update double event records
|
2023-11-05 14:30:17 +00:00
|
|
|
if (self.config.stored.DungeonDouble.is_expired()
|
|
|
|
or self.config.stored.DungeonDouble.calyx > 0
|
2024-01-12 14:37:20 +00:00
|
|
|
or self.config.stored.DungeonDouble.relic > 0
|
|
|
|
or self.config.stored.DungeonDouble.rogue > 0):
|
2024-07-19 02:01:57 +00:00
|
|
|
update = self.config.stored.DungeonDouble.time
|
|
|
|
if update <= now() <= update + timedelta(seconds=5):
|
|
|
|
logger.info('Dungeon double just updated, skip')
|
|
|
|
return
|
2023-08-27 09:13:05 +00:00
|
|
|
logger.info('Get dungeon double remains')
|
|
|
|
# UI switches
|
|
|
|
switched = self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
|
2024-07-01 18:41:12 +00:00
|
|
|
if not switched and not self._dungeon_survival_index_top_appear():
|
|
|
|
logger.info('Reset nav states')
|
2023-08-27 09:13:05 +00:00
|
|
|
# Nav must at top, reset nav states
|
|
|
|
self.ui_goto_main()
|
2023-07-10 14:20:35 +00:00
|
|
|
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
|
2023-08-27 09:13:05 +00:00
|
|
|
# Check remains
|
|
|
|
calyx = 0
|
|
|
|
relic = 0
|
2024-01-12 14:37:20 +00:00
|
|
|
rogue = 0
|
|
|
|
if self.has_double_rogue_event():
|
2024-04-10 15:29:25 +00:00
|
|
|
rogue = self.get_double_rogue_remain()
|
2023-08-27 09:13:05 +00:00
|
|
|
if self.has_double_calyx_event():
|
2024-09-10 14:41:00 +00:00
|
|
|
self.dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Calyx_Golden)
|
2023-08-27 09:13:05 +00:00
|
|
|
calyx = self.get_double_event_remain()
|
|
|
|
if self.has_double_relic_event():
|
2024-09-10 14:41:00 +00:00
|
|
|
self.dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Cavern_of_Corrosion)
|
2024-04-26 16:24:15 +00:00
|
|
|
relic = self.get_double_rogue_remain()
|
2023-08-27 09:13:05 +00:00
|
|
|
with self.config.multi_set():
|
|
|
|
self.config.stored.DungeonDouble.calyx = calyx
|
|
|
|
self.config.stored.DungeonDouble.relic = relic
|
2024-01-12 14:37:20 +00:00
|
|
|
self.config.stored.DungeonDouble.rogue = rogue
|
2023-07-09 09:48:11 +00:00
|
|
|
|
2024-07-01 18:41:12 +00:00
|
|
|
def run(self):
|
2024-07-19 04:20:45 +00:00
|
|
|
self.sync_config_traiblaze_power('Ornament')
|
2024-07-01 18:41:12 +00:00
|
|
|
self.config.update_battle_pass_quests()
|
|
|
|
self.config.update_daily_quests()
|
|
|
|
self.check_synthesize()
|
|
|
|
self.called_daily_support = False
|
|
|
|
self.achieved_daily_quest = False
|
|
|
|
self.achieved_weekly_quest = False
|
|
|
|
self.running_double = False
|
|
|
|
self.daily_quests = self.config.stored.DailyQuest.load_quests()
|
|
|
|
self.weekly_quests = self.config.stored.BattlePassWeeklyQuest.load_quests()
|
|
|
|
self.update_double_event_record()
|
|
|
|
|
2023-08-27 09:13:05 +00:00
|
|
|
# Run double events
|
2024-05-17 18:35:44 +00:00
|
|
|
planner = self.planner.get_dungeon(double_calyx=True)
|
2023-08-27 09:13:05 +00:00
|
|
|
# Double calyx
|
2024-03-20 10:37:49 +00:00
|
|
|
if self.config.stored.DungeonDouble.calyx > 0:
|
2023-08-27 09:13:05 +00:00
|
|
|
logger.info('Run double calyx')
|
|
|
|
dungeon = DungeonList.find(self.config.Dungeon_NameAtDoubleCalyx)
|
2024-05-17 18:35:44 +00:00
|
|
|
if planner is not None:
|
|
|
|
dungeon = planner
|
2024-05-30 13:16:36 +00:00
|
|
|
self.is_doing_planner = True
|
2023-10-03 12:06:44 +00:00
|
|
|
self.running_double = True
|
2024-05-26 19:15:42 +00:00
|
|
|
self.dungeon_run(dungeon=dungeon, wave_limit=self.config.stored.DungeonDouble.calyx)
|
2024-05-30 13:16:36 +00:00
|
|
|
self.is_doing_planner = False
|
2023-08-27 09:13:05 +00:00
|
|
|
# Double relic
|
2024-03-20 10:37:49 +00:00
|
|
|
if self.config.stored.DungeonDouble.relic > 0:
|
2023-08-27 09:13:05 +00:00
|
|
|
logger.info('Run double relic')
|
|
|
|
dungeon = DungeonList.find(self.config.Dungeon_NameAtDoubleRelic)
|
2023-10-03 12:06:44 +00:00
|
|
|
self.running_double = True
|
2024-05-26 19:15:42 +00:00
|
|
|
self.dungeon_run(dungeon=dungeon, wave_limit=self.config.stored.DungeonDouble.relic)
|
2023-10-03 12:06:44 +00:00
|
|
|
self.running_double = False
|
2023-08-27 09:13:05 +00:00
|
|
|
|
|
|
|
# Dungeon to clear all trailblaze power
|
2024-01-12 14:37:20 +00:00
|
|
|
do_rogue = False
|
2024-07-01 21:29:16 +00:00
|
|
|
if self.config.is_task_enabled('Rogue') and not self.config.is_task_enabled('Ornament'):
|
2024-01-12 14:37:20 +00:00
|
|
|
if self.config.cross_get('Rogue.RogueWorld.UseStamina'):
|
|
|
|
logger.info('Going to use stamina in rogue')
|
|
|
|
do_rogue = True
|
|
|
|
elif self.config.cross_get('Rogue.RogueWorld.DoubleEvent') \
|
|
|
|
and self.config.stored.DungeonDouble.rogue > 0:
|
|
|
|
logger.info('Going to use stamina in double rogue event')
|
|
|
|
do_rogue = True
|
2024-05-27 20:12:36 +00:00
|
|
|
final = DungeonList.find(self.config.Dungeon_Name)
|
|
|
|
# Planner
|
|
|
|
planner = self.planner.get_dungeon()
|
|
|
|
if planner is not None:
|
|
|
|
final = planner
|
2024-05-30 13:16:36 +00:00
|
|
|
self.is_doing_planner = True
|
2023-08-27 09:13:05 +00:00
|
|
|
|
2023-12-09 09:45:54 +00:00
|
|
|
# Use all stamina
|
2024-05-27 20:12:36 +00:00
|
|
|
if do_rogue:
|
2023-12-09 09:45:54 +00:00
|
|
|
# Use support if prioritize rogue
|
|
|
|
if self.require_compulsory_support():
|
|
|
|
logger.info('Run dungeon with support once as stamina is rogue prioritized')
|
2024-05-27 20:12:36 +00:00
|
|
|
self.dungeon_run(dungeon=final, wave_limit=1)
|
2024-05-30 13:16:36 +00:00
|
|
|
self.is_doing_planner = False
|
2024-01-12 14:37:20 +00:00
|
|
|
# Store immersifiers
|
2023-12-09 09:45:54 +00:00
|
|
|
logger.info('Prioritize stamina for simulated universe, skip dungeon')
|
2024-01-12 14:37:20 +00:00
|
|
|
amount = 0
|
|
|
|
if not self.config.cross_get('Rogue.RogueWorld.UseStamina') \
|
|
|
|
and self.config.cross_get('Rogue.RogueWorld.DoubleEvent') \
|
|
|
|
and self.config.stored.DungeonDouble.rogue > 0:
|
|
|
|
amount = self.config.stored.DungeonDouble.rogue
|
2024-01-12 15:54:37 +00:00
|
|
|
stored = self.immersifier_store(max_store=amount)
|
|
|
|
self.check_stamina_quest(stored * 40)
|
2024-01-12 14:37:20 +00:00
|
|
|
# call rogue task if accumulated to 4
|
2023-12-08 10:09:33 +00:00
|
|
|
with self.config.multi_set():
|
2023-12-08 17:14:30 +00:00
|
|
|
if self.config.stored.Immersifier.value >= 4:
|
2023-12-09 14:41:00 +00:00
|
|
|
# Schedule behind rogue
|
|
|
|
self.config.task_delay(minute=5)
|
2023-12-08 17:14:30 +00:00
|
|
|
self.config.task_call('Rogue')
|
2024-06-14 17:26:52 +00:00
|
|
|
# Scheduler
|
2023-12-08 17:14:30 +00:00
|
|
|
self.delay_dungeon_task(KEYWORDS_DUNGEON_LIST.Simulated_Universe_World_1)
|
2024-06-14 17:26:52 +00:00
|
|
|
self.config.task_stop()
|
2023-12-09 09:45:54 +00:00
|
|
|
else:
|
|
|
|
# Combat
|
|
|
|
self.dungeon_run(final)
|
2024-05-30 13:16:36 +00:00
|
|
|
self.is_doing_planner = False
|
2024-06-14 17:26:52 +00:00
|
|
|
# Scheduler
|
2023-12-09 09:45:54 +00:00
|
|
|
self.delay_dungeon_task(final)
|
2024-06-14 17:26:52 +00:00
|
|
|
self.check_synthesize()
|
|
|
|
self.config.task_stop()
|
|
|
|
|
|
|
|
def check_synthesize(self):
|
|
|
|
logger.info('Check synthesize')
|
|
|
|
synthesize = Synthesize(config=self.config, device=self.device, task=self.config.task.command)
|
2024-06-17 19:04:32 +00:00
|
|
|
set_cached_property(synthesize, 'planner', self.planner)
|
2024-06-14 17:26:52 +00:00
|
|
|
if synthesize.synthesize_needed():
|
|
|
|
synthesize.synthesize_planner()
|
2023-06-17 17:09:09 +00:00
|
|
|
|
2023-12-08 10:09:33 +00:00
|
|
|
def delay_dungeon_task(self, dungeon: DungeonList):
|
2023-08-27 09:13:05 +00:00
|
|
|
logger.attr('achieved_daily_quest', self.achieved_daily_quest)
|
2024-01-01 20:07:35 +00:00
|
|
|
logger.attr('achieved_weekly_quest', self.achieved_weekly_quest)
|
2023-08-27 09:13:05 +00:00
|
|
|
with self.config.multi_set():
|
2023-08-30 17:06:24 +00:00
|
|
|
# Check battle pass
|
2024-01-01 20:07:35 +00:00
|
|
|
if self.achieved_weekly_quest:
|
|
|
|
self.config.task_call('BattlePass')
|
2023-08-30 17:06:24 +00:00
|
|
|
# Check daily
|
2023-08-27 09:13:05 +00:00
|
|
|
if self.achieved_daily_quest:
|
|
|
|
self.config.task_call('DailyQuest')
|
2024-05-27 15:09:46 +00:00
|
|
|
else:
|
|
|
|
# Check future daily
|
|
|
|
if KEYWORDS_DAILY_QUEST.Obtain_victory_in_combat_with_Support_Characters_1_times in self.daily_quests:
|
|
|
|
logger.error("Dungeon ran but support daily haven't been finished yet")
|
|
|
|
self.config.task_call('DailyQuest')
|
|
|
|
|
2023-09-26 19:14:12 +00:00
|
|
|
# Delay tasks
|
2023-12-08 10:09:33 +00:00
|
|
|
self.dungeon_stamina_delay(dungeon)
|
2023-09-26 19:14:12 +00:00
|
|
|
|
2023-07-09 09:48:11 +00:00
|
|
|
def handle_destructible_around_blaze(self):
|
|
|
|
"""
|
|
|
|
Stagnant_Shadow_Blaze has a destructible object nearby, attacks are aimed at it first
|
|
|
|
so destroy it first
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
bool: If handled.
|
|
|
|
|
|
|
|
Pages:
|
|
|
|
in: COMBAT_PREPARE
|
|
|
|
out: page_main, map position changed if handled
|
|
|
|
"""
|
|
|
|
logger.hr('Handle destructible around blaze')
|
|
|
|
self.combat_exit()
|
|
|
|
# Check if there's a front sight at bottom-left corner
|
|
|
|
area = area_offset((-50, -150, 0, 0), offset=self.config.ASSETS_RESOLUTION)
|
|
|
|
|
|
|
|
skip_first_screenshot = True
|
2023-09-19 17:20:52 +00:00
|
|
|
self.map_A_timer.reset()
|
2023-07-09 09:48:11 +00:00
|
|
|
handled = False
|
|
|
|
while 1:
|
|
|
|
if skip_first_screenshot:
|
|
|
|
skip_first_screenshot = False
|
|
|
|
else:
|
|
|
|
self.device.screenshot()
|
|
|
|
|
|
|
|
if self.image_color_count(area, color=(48, 170, 204), threshold=221, count=50):
|
|
|
|
logger.info(f'Found destructible object')
|
|
|
|
if self.handle_map_A():
|
|
|
|
handled = True
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
logger.info(f'No destructible object')
|
|
|
|
if not handled:
|
|
|
|
break
|
2023-09-19 17:20:52 +00:00
|
|
|
if self.map_A_timer.reached():
|
2023-07-09 09:48:11 +00:00
|
|
|
break
|
|
|
|
|
|
|
|
return handled
|
2023-08-27 09:13:05 +00:00
|
|
|
|
|
|
|
def require_compulsory_support(self) -> bool:
|
|
|
|
require = False
|
|
|
|
|
|
|
|
if not self.config.stored.DailyActivity.is_full():
|
2023-12-27 16:56:15 +00:00
|
|
|
if KEYWORDS_DAILY_QUEST.Obtain_victory_in_combat_with_Support_Characters_1_times \
|
2023-08-27 09:13:05 +00:00
|
|
|
in self.daily_quests:
|
|
|
|
require = True
|
|
|
|
|
|
|
|
logger.attr('called_daily_support', self.called_daily_support)
|
|
|
|
if self.called_daily_support:
|
|
|
|
require = False
|
|
|
|
|
|
|
|
# Not required, cause any dungeon run will achieve the quest
|
|
|
|
logger.attr('DungeonSupport_Use', self.config.DungeonSupport_Use)
|
|
|
|
if self.config.DungeonSupport_Use == 'always_use':
|
|
|
|
require = False
|
|
|
|
|
|
|
|
logger.attr('Require compulsory support', require)
|
|
|
|
return require
|
2024-01-12 15:54:37 +00:00
|
|
|
|
|
|
|
def check_stamina_quest(self, stamina_used: int):
|
2024-01-17 10:11:31 +00:00
|
|
|
logger.info(f'Used {stamina_used} stamina')
|
|
|
|
|
2024-02-06 21:13:54 +00:00
|
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max in self.weekly_quests:
|
2024-01-17 10:11:31 +00:00
|
|
|
logger.info(f'Done Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max stamina {stamina_used}')
|
|
|
|
self.config.stored.BattlePassQuestTrailblazePower.add(stamina_used)
|
|
|
|
if self.config.stored.BattlePassQuestTrailblazePower.is_full():
|
|
|
|
logger.info('Achieved weekly quest Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max')
|
|
|
|
self.achieved_weekly_quest = True
|
|
|
|
|
|
|
|
if KEYWORDS_DAILY_QUEST.Consume_120_Trailblaze_Power in self.daily_quests:
|
|
|
|
logger.info(f'Done Consume_120_Trailblaze_Power stamina {stamina_used}')
|
|
|
|
self.achieved_daily_quest = True
|
2024-07-19 04:20:45 +00:00
|
|
|
|
|
|
|
def sync_config_traiblaze_power(self, set_task):
|
|
|
|
# Sync Dungeon.TrailblazePower and Ornament.TrailblazePower
|
|
|
|
with self.config.multi_set():
|
|
|
|
value = self.config.TrailblazePower_ExtractReservedTrailblazePower
|
2024-07-19 20:42:01 +00:00
|
|
|
keys = f'{set_task}.TrailblazePower.ExtractReservedTrailblazePower'
|
2024-07-19 04:20:45 +00:00
|
|
|
if self.config.cross_get(keys) != value:
|
|
|
|
self.config.cross_set(keys, value)
|
|
|
|
value = self.config.TrailblazePower_UseFuel
|
2024-07-19 20:42:01 +00:00
|
|
|
keys = f'{set_task}.TrailblazePower.UseFuel'
|
2024-07-19 04:20:45 +00:00
|
|
|
if self.config.cross_get(keys) != value:
|
|
|
|
self.config.cross_set(keys, value)
|
|
|
|
value = self.config.TrailblazePower_FuelReserve
|
2024-07-19 20:42:01 +00:00
|
|
|
keys = f'{set_task}.TrailblazePower.FuelReserve'
|
2024-07-19 04:20:45 +00:00
|
|
|
if self.config.cross_get(keys) != value:
|
|
|
|
self.config.cross_set(keys, value)
|