mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Add: Do Himeko trial to achieve daily quests
This commit is contained in:
parent
3fa28fba24
commit
491b848e28
122
route/daily/HimekoTrial.py
Normal file
122
route/daily/HimekoTrial.py
Normal file
@ -0,0 +1,122 @@
|
||||
from module.logger import logger
|
||||
from tasks.combat.combat import Combat
|
||||
from tasks.daily.assets.assets_daily_trial import START_TRIAL
|
||||
from tasks.daily.trail import CharacterTrial
|
||||
from tasks.map.control.waypoint import Waypoint
|
||||
from tasks.map.keywords.plane import Jarilo_BackwaterPass
|
||||
from tasks.map.route.base import RouteBase
|
||||
|
||||
|
||||
class Route(RouteBase, Combat, CharacterTrial):
|
||||
def handle_combat_state(self, auto=True, speed_2x=True):
|
||||
# No auto in character trial
|
||||
auto = False
|
||||
return super().handle_combat_state(auto=auto, speed_2x=speed_2x)
|
||||
|
||||
def wait_next_skill(self, expected_end=None, skip_first_screenshot=True):
|
||||
# Ended at START_TRIAL
|
||||
def combat_end():
|
||||
return self.match_template_color(START_TRIAL)
|
||||
|
||||
return super().wait_next_skill(expected_end=combat_end, skip_first_screenshot=skip_first_screenshot)
|
||||
|
||||
def combat_execute(self, expected_end=None):
|
||||
# Battle 1/3
|
||||
# Enemy cleared by follow up
|
||||
self.wait_next_skill()
|
||||
|
||||
# Battle 2/3
|
||||
# Himeko E
|
||||
# Rest are cleared by follow up
|
||||
self.use_E()
|
||||
self.wait_next_skill()
|
||||
|
||||
# Battle 3/3
|
||||
# Himeko E
|
||||
self.use_E()
|
||||
self.wait_next_skill()
|
||||
# Herta A, or Natasha A, depends on who wasn't being attacked
|
||||
self.use_A()
|
||||
self.wait_next_skill()
|
||||
# Natasha A, this will also cause weakness break
|
||||
# To achieve In_a_single_battle_inflict_3_Weakness_Break_of_different_Types
|
||||
self.use_A()
|
||||
self.wait_next_skill()
|
||||
# Himeko Q
|
||||
# To achieve Use_an_Ultimate_to_deal_the_final_blow_1_time
|
||||
# May kill the enemy
|
||||
self.use_Q(1)
|
||||
if not self.wait_next_skill():
|
||||
return
|
||||
# Herta Q
|
||||
# To achieve Use_an_Ultimate_to_deal_the_final_blow_1_time
|
||||
# May kill the enemy
|
||||
self.use_Q(2)
|
||||
if not self.wait_next_skill():
|
||||
return
|
||||
|
||||
# Combat should end here, just incase
|
||||
logger.warning(f'Himeko trial is not going as expected')
|
||||
for _ in range(3):
|
||||
self.use_E()
|
||||
if not self.wait_next_skill():
|
||||
return
|
||||
|
||||
def route_item_enemy(self):
|
||||
self.enter_himeko_trial()
|
||||
self.map_init(plane=Jarilo_BackwaterPass, position=(519.9, 361.5))
|
||||
|
||||
# Visit 3 items
|
||||
self.clear_item(
|
||||
Waypoint((587.6, 366.9)).run_2x(),
|
||||
)
|
||||
self.clear_item(
|
||||
Waypoint((575.5, 377.4)),
|
||||
)
|
||||
self.clear_item(
|
||||
# Go through arched door
|
||||
Waypoint((581.5, 383.3)).run().set_threshold(3),
|
||||
Waypoint((575.7, 417.2)).run(),
|
||||
)
|
||||
# Goto boss
|
||||
self.clear_enemy(
|
||||
Waypoint((613.5, 427.3)),
|
||||
)
|
||||
|
||||
def route_item(self):
|
||||
self.enter_himeko_trial()
|
||||
self.map_init(plane=Jarilo_BackwaterPass, position=(519.9, 361.5))
|
||||
|
||||
# Visit 3 items
|
||||
self.clear_item(
|
||||
Waypoint((587.6, 366.9)).run_2x(),
|
||||
)
|
||||
self.clear_item(
|
||||
Waypoint((575.5, 377.4)),
|
||||
)
|
||||
self.clear_item(
|
||||
# Go through arched door
|
||||
Waypoint((581.5, 383.3)).run().set_threshold(3),
|
||||
Waypoint((575.7, 417.2)).run(),
|
||||
)
|
||||
# Exit
|
||||
self.exit_trial()
|
||||
|
||||
def route_enemy(self):
|
||||
self.enter_himeko_trial()
|
||||
self.map_init(plane=Jarilo_BackwaterPass, position=(519.9, 361.5))
|
||||
|
||||
# Goto boss
|
||||
self.clear_enemy(
|
||||
# Before the corner, turn right
|
||||
Waypoint((571.7, 371.3)).run_2x(),
|
||||
# Go through arched door
|
||||
Waypoint((581.5, 383.3)).run_2x(),
|
||||
# Boss
|
||||
Waypoint((613.5, 427.3)).run_2x(),
|
||||
)
|
||||
|
||||
def exit(self):
|
||||
# Fake map_init to expose this method
|
||||
# self.map_init(plane=Jarilo_BackwaterPass, position=(519.9, 361.5))
|
||||
self.exit_trial_to_main()
|
@ -264,6 +264,47 @@ class DailyQuestUI(DungeonUI, RouteLoader):
|
||||
self.route_run(ROUTE_DAILY.ForgottenHallStage1__route)
|
||||
done += 1
|
||||
|
||||
"""
|
||||
enemy x1 In_a_single_battle_inflict_3_Weakness_Break_of_different_Types
|
||||
enemy x1 Inflict_Weakness_Break_5_times
|
||||
enemy x2 Defeat_a_total_of_20_enemies
|
||||
enemy x3 Enter_combat_by_attacking_enemy_Weakness_and_win_3_times
|
||||
item x1 Destroy_3_destructible_objects
|
||||
enemy x1 Use_an_Ultimate_to_deal_the_final_blow_1_time
|
||||
"""
|
||||
enemy = 0
|
||||
item = 0
|
||||
quests = [
|
||||
KEYWORDS_DAILY_QUEST.Enter_combat_by_attacking_enemy_Weakness_and_win_3_times,
|
||||
]
|
||||
if KEYWORDS_DAILY_QUEST.In_a_single_battle_inflict_3_Weakness_Break_of_different_Types in quests:
|
||||
enemy = max(enemy, 1)
|
||||
if KEYWORDS_DAILY_QUEST.Inflict_Weakness_Break_5_times in quests:
|
||||
enemy = max(enemy, 1)
|
||||
if KEYWORDS_DAILY_QUEST.Defeat_a_total_of_20_enemies in quests:
|
||||
enemy = max(enemy, 2)
|
||||
if KEYWORDS_DAILY_QUEST.Enter_combat_by_attacking_enemy_Weakness_and_win_3_times in quests:
|
||||
enemy = max(enemy, 3)
|
||||
if KEYWORDS_DAILY_QUEST.Destroy_3_destructible_objects in quests:
|
||||
item = max(item, 1)
|
||||
if KEYWORDS_DAILY_QUEST.Use_an_Ultimate_to_deal_the_final_blow_1_time in quests:
|
||||
enemy = max(enemy, 1)
|
||||
logger.info(f'Himeko trial, enemy={enemy}, item={item}')
|
||||
for run in [1, 2, 3]:
|
||||
if enemy >= run and item >= run:
|
||||
self.route_run(ROUTE_DAILY.HimekoTrial__route_item_enemy)
|
||||
done += 1
|
||||
elif enemy >= run:
|
||||
self.route_run(ROUTE_DAILY.HimekoTrial__route_enemy)
|
||||
done += 1
|
||||
elif item >= run:
|
||||
self.route_run(ROUTE_DAILY.HimekoTrial__route_item)
|
||||
done += 1
|
||||
else:
|
||||
break
|
||||
if max(enemy, item) > 0:
|
||||
self.route_run(ROUTE_DAILY.HimekoTrial__exit)
|
||||
|
||||
return done
|
||||
|
||||
def run(self):
|
||||
|
@ -2,6 +2,7 @@ from functools import cached_property
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from tasks.base.assets.assets_base_page import CLOSE
|
||||
from tasks.combat.combat import Combat
|
||||
from tasks.map.assets.assets_map_control import ROTATION_SWIPE_AREA
|
||||
from tasks.map.control.joystick import JoystickContact
|
||||
@ -74,6 +75,18 @@ class MapControl(Combat, AimDetectorMixin):
|
||||
interval.reset()
|
||||
continue
|
||||
|
||||
def walk_additional(self) -> bool:
|
||||
"""
|
||||
Handle popups during walk
|
||||
|
||||
Returns:
|
||||
bool: If handled
|
||||
"""
|
||||
if self.appear_then_click(CLOSE):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def _goto(
|
||||
self,
|
||||
contact: JoystickContact,
|
||||
@ -139,6 +152,10 @@ class MapControl(Combat, AimDetectorMixin):
|
||||
self.combat_execute()
|
||||
if waypoint.early_stop:
|
||||
return result
|
||||
if self.walk_additional():
|
||||
attacked_enemy.clear()
|
||||
attacked_item.clear()
|
||||
continue
|
||||
|
||||
# The following detection require page_main
|
||||
if not self.is_in_main():
|
||||
|
Loading…
Reference in New Issue
Block a user