Add: Enter Stagnant Shadow dungeons

This commit is contained in:
LmeSzinc 2023-06-28 02:26:32 +08:00
parent a745c6607d
commit ad451133d1
4 changed files with 29 additions and 6 deletions

View File

@ -203,6 +203,9 @@ class UI(PopupHandler, StateMixin):
self.device.click(button)
retry.reset()
def is_in_main(self):
return self.appear(page_main.check_button)
def ui_goto_main(self):
return self.ui_ensure(destination=page_main)

View File

@ -1,6 +1,5 @@
from module.logger import logger
from tasks.base.assets.assets_base_page import CLOSE
from tasks.base.page import page_main
from tasks.combat.assets.assets_combat_finish import COMBAT_AGAIN, COMBAT_EXIT
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
from tasks.combat.assets.assets_combat_team import COMBAT_TEAM_PREPARE
@ -8,9 +7,10 @@ from tasks.combat.interact import CombatInteract
from tasks.combat.prepare import CombatPrepare
from tasks.combat.state import CombatState
from tasks.combat.team import CombatTeam
from tasks.map.control.joystick import MapControlJoystick
class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam):
class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, MapControlJoystick):
def handle_combat_prepare(self):
"""
Pages:
@ -26,6 +26,17 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam):
else:
logger.info(f'Current has {current}, combat costs {self.combat_wave_cost}, do 1 wave')
def handle_ascension_dungeon_prepare(self):
"""
Returns:
bool: If clicked.
"""
if self.is_in_main():
if self.handle_map_A():
return True
return False
def combat_prepare(self, team=1):
"""
Args:
@ -59,6 +70,7 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam):
continue
if self.appear(COMBAT_TEAM_PREPARE):
self.interval_reset(COMBAT_PREPARE)
self._map_A_timer.reset()
if self.appear(COMBAT_PREPARE, interval=2):
self.handle_combat_prepare()
if self.state.TrailblazePower < self.combat_wave_cost:
@ -68,6 +80,8 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam):
continue
if self.handle_combat_interact():
continue
if self.handle_ascension_dungeon_prepare():
continue
def combat_execute(self):
"""
@ -140,7 +154,7 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam):
self.device.screenshot()
# End
if self.appear(page_main.check_button):
if self.is_in_main():
logger.info('Combat finishes at page_main')
return True
if self.is_combat_executing():
@ -170,7 +184,7 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam):
self.device.screenshot()
# End
if self.appear(page_main.check_button):
if self.is_in_main():
break
# Click

View File

@ -1,6 +1,6 @@
from module.logger import logger
from tasks.base.assets.assets_base_page import CLOSE
from tasks.base.page import page_camera, page_main
from tasks.base.page import page_camera
from tasks.base.ui import UI
from tasks.daily.assets.assets_daily_camera import PICTURE_TAKEN, TAKE_PICTURE
@ -39,7 +39,7 @@ class CameraUI(UI):
skip_first_screenshot = False
else:
self.device.screenshot()
if self.appear(page_main.check_button):
if self.is_in_main():
logger.info('Back to camera main page')
break
if self.appear(PICTURE_TAKEN, interval=1):

View File

@ -59,6 +59,7 @@ class OcrDungeonNav(Ocr):
result = super().after_process(result)
if self.lang == 'ch':
result = result.replace('萼喜', '')
result = result.replace('', '') # 凝带虚影
return result
@ -261,6 +262,11 @@ class DungeonUI(UI):
self._dungeon_insight(dungeon)
self._dungeon_enter(dungeon)
return True
if dungeon.is_Stagnant_Shadow:
DUNGEON_NAV_LIST.select_row(KEYWORDS_DUNGEON_NAV.Stagnant_Shadow, main=self)
self._dungeon_insight(dungeon)
self._dungeon_enter(dungeon)
return True
if dungeon.is_Cavern_of_Corrosion:
DUNGEON_NAV_LIST.select_row(KEYWORDS_DUNGEON_NAV.Cavern_of_Corrosion, main=self)
self._dungeon_insight(dungeon)