1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-05-20 20:42:27 +08:00

Merge pull request #6 from nEEtdo0d/enhance_rework

Enhance rework
This commit is contained in:
nEEtdo0d
2020-08-06 22:04:41 -04:00
committed by GitHub
3 changed files with 17 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ class Equipment(UI):
equipment_has_take_on = False equipment_has_take_on = False
def _view_swipe(self, distance, check_button=EQUIPMENT_OPEN): def _view_swipe(self, distance, check_button=EQUIPMENT_OPEN):
swipe_count = 0
swipe_timer = Timer(5, count=10) swipe_timer = Timer(5, count=10)
SWIPE_CHECK.load_color(self.device.image) SWIPE_CHECK.load_color(self.device.image)
while 1: while 1:
@@ -24,19 +25,24 @@ class Equipment(UI):
swipe_timer.reset() swipe_timer.reset()
self.device.swipe(vector=(distance, 0), box=SWIPE_AREA.area, random_range=SWIPE_RANDOM_RANGE, self.device.swipe(vector=(distance, 0), box=SWIPE_AREA.area, random_range=SWIPE_RANDOM_RANGE,
padding=0, duration=(0.1, 0.12), name='EQUIP_SWIPE') padding=0, duration=(0.1, 0.12), name='EQUIP_SWIPE')
swipe_count += 1
self.device.screenshot() self.device.screenshot()
if SWIPE_CHECK.match(self.device.image): if SWIPE_CHECK.match(self.device.image):
if swipe_count > 3:
logger.warning('Same ship on multiple swipes')
return False
continue continue
if self.appear(check_button, offset=(30, 30)) and not SWIPE_CHECK.match(self.device.image): if self.appear(check_button, offset=(30, 30)) and not SWIPE_CHECK.match(self.device.image):
break logger.info('New ship detected on swipe')
return True
def equip_view_next(self, check_button=EQUIPMENT_OPEN): def equip_view_next(self, check_button=EQUIPMENT_OPEN):
self._view_swipe(distance=-SWIPE_DISTANCE, check_button=check_button) return self._view_swipe(distance=-SWIPE_DISTANCE, check_button=check_button)
def equip_view_prev(self, check_button=EQUIPMENT_OPEN): def equip_view_prev(self, check_button=EQUIPMENT_OPEN):
self._view_swipe(distance=SWIPE_DISTANCE, check_button=check_button) return self._view_swipe(distance=SWIPE_DISTANCE, check_button=check_button)
def equip_enter(self, click_button, check_button=EQUIPMENT_OPEN, long_click=True): def equip_enter(self, click_button, check_button=EQUIPMENT_OPEN, long_click=True):
enter_timer = Timer(10) enter_timer = Timer(10)

View File

@@ -80,6 +80,7 @@ class Fleet(Camera, MapOperation, AmbushHandler):
self.find_path_initial() self.find_path_initial()
self.map.show_cost() self.map.show_cost()
self.show_fleet() self.show_fleet()
self.hp_get()
self.handle_strategy(index=self.fleet_current_index) self.handle_strategy(index=self.fleet_current_index)
def switch_to(self): def switch_to(self):

View File

@@ -118,14 +118,18 @@ class Enhancement(Dock):
if self.info_bar_count(): if self.info_bar_count():
if status > 0.98: if status > 0.98:
logger.info('Fully enhanced for this ship') logger.info('Fully enhanced for this ship')
self.equip_view_next(check_button=ENHANCE_RECOMMEND) swiped = self.equip_view_next(check_button=ENHANCE_RECOMMEND)
self.ensure_no_info_bar() self.ensure_no_info_bar()
if not swiped:
return False
continue continue
else: else:
if choose: if choose:
logger.info('Unable to enhance this ship') logger.info('Unable to enhance this ship')
self.equip_view_next(check_button=ENHANCE_RECOMMEND) swiped = self.equip_view_next(check_button=ENHANCE_RECOMMEND)
self.ensure_no_info_bar() self.ensure_no_info_bar()
if not swiped:
return False
continue continue
else: else:
logger.info('Enhancement material exhausted') logger.info('Enhancement material exhausted')
@@ -219,7 +223,7 @@ class Enhancement(Dock):
self.ui_back(DOCK_FILTER) self.ui_back(DOCK_FILTER)
if exhaust_count > 2: if exhaust_count > 2:
logger.info(f'Mats exhausted, threshold exceeded, terminate early. Last filter was {ship_type}') logger.warning(f'Too many failed enhancements, terminate early')
break break
self._enhance_quit() self._enhance_quit()