mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-30 03:16:08 +00:00
Optimize: Redundant campaign_hard file
This commit is contained in:
parent
6d6f686e0f
commit
83674b7a37
@ -1,92 +0,0 @@
|
|||||||
from module.base.timer import Timer
|
|
||||||
from module.campaign.campaign_base import CampaignBase
|
|
||||||
from module.hard.equipment import HardEquipment
|
|
||||||
from module.logger import logger
|
|
||||||
from module.map.assets import MAP_PREPARATION, FLEET_PREPARATION
|
|
||||||
from module.exception import CampaignEnd
|
|
||||||
from module.ui.ui import CAMPAIGN_CHECK
|
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
MAP_HAS_AMBUSH = False
|
|
||||||
EMOTION_REDUCE = False
|
|
||||||
|
|
||||||
class Campaign(CampaignBase, HardEquipment):
|
|
||||||
def run(self):
|
|
||||||
logger.hr(self.ENTRANCE, level=2)
|
|
||||||
self.enter_map(self.ENTRANCE, mode='hard')
|
|
||||||
self.map = self.MAP
|
|
||||||
self.map.reset()
|
|
||||||
|
|
||||||
if self.config.FLEET_HARD == 1:
|
|
||||||
self.ensure_edge_insight(reverse=True)
|
|
||||||
self.full_scan_find_boss()
|
|
||||||
else:
|
|
||||||
self.fleet_switch_click()
|
|
||||||
self.ensure_no_info_bar()
|
|
||||||
self.ensure_edge_insight()
|
|
||||||
self.full_scan_find_boss()
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.clear_boss()
|
|
||||||
except CampaignEnd:
|
|
||||||
logger.hr('Campaign end')
|
|
||||||
|
|
||||||
def fleet_preparation(self):
|
|
||||||
self.equipment_take_on()
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _expected_combat_end(self):
|
|
||||||
return 'in_stage'
|
|
||||||
|
|
||||||
def clear_boss(self):
|
|
||||||
grids = self.map.select(is_boss=True)
|
|
||||||
grids = grids.add(self.map.select(may_boss=True, is_enemy=True))
|
|
||||||
logger.info('May boss: %s' % self.map.select(may_boss=True))
|
|
||||||
logger.info('May boss and is enemy: %s' % self.map.select(may_boss=True, is_enemy=True))
|
|
||||||
logger.info('Is boss: %s' % self.map.select(is_boss=True))
|
|
||||||
# logger.info('Grids: %s' % grids)
|
|
||||||
if grids:
|
|
||||||
logger.hr('Clear BOSS')
|
|
||||||
grids = grids.sort(cost=True, weight=True)
|
|
||||||
logger.info('Grids: %s' % str(grids))
|
|
||||||
self._goto(grids[0])
|
|
||||||
raise CampaignEnd('BOSS Clear.')
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def equipment_take_off_when_finished(self):
|
|
||||||
logger.info('equipment_take_off_when_finished')
|
|
||||||
campaign_timer = Timer(2)
|
|
||||||
map_timer = Timer(1)
|
|
||||||
fleet_timer = Timer(1)
|
|
||||||
|
|
||||||
while 1:
|
|
||||||
self.device.screenshot()
|
|
||||||
|
|
||||||
# Enter campaign
|
|
||||||
if campaign_timer.reached() and self.appear_then_click(self.ENTRANCE):
|
|
||||||
campaign_timer.reset()
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Map preparation
|
|
||||||
if map_timer.reached() and self.appear(MAP_PREPARATION):
|
|
||||||
self.device.click(MAP_PREPARATION)
|
|
||||||
map_timer.reset()
|
|
||||||
campaign_timer.reset()
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Fleet preparation
|
|
||||||
if fleet_timer.reached() and self.appear(FLEET_PREPARATION):
|
|
||||||
self.equipment_take_off()
|
|
||||||
self.ui_back(check_button=CAMPAIGN_CHECK, appear_button=FLEET_PREPARATION)
|
|
||||||
break
|
|
||||||
|
|
||||||
# Retire
|
|
||||||
if self.handle_retirement():
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Emotion
|
|
||||||
pass
|
|
||||||
|
|
||||||
return True
|
|
@ -1,7 +1,7 @@
|
|||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
from module.base.ocr import Digit
|
from module.base.ocr import Digit
|
||||||
from module.campaign.campaign_hard import Campaign
|
from campaign.campaign_hard.campaign_hard import Campaign
|
||||||
from module.campaign.run import CampaignRun
|
from module.campaign.run import CampaignRun
|
||||||
from module.hard.assets import *
|
from module.hard.assets import *
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
|
Loading…
Reference in New Issue
Block a user