1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-08-10 10:36:23 +08:00

Fix: handle OS exploration containers (#5854)

* fix: handle Operation Siren exploration containers

* chore: update os container template
This commit is contained in:
Compeador
2026-08-07 00:17:47 +08:00
committed by GitHub
parent 9c6e5b23b8
commit 84c06a37d9
8 changed files with 30 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

View File

@@ -19,6 +19,7 @@ class OSGridInfo(GridInfo):
is_scanning_device = False
is_logging_tower = False
is_exploration_reward = False
is_exploration_container = False
is_fleet_mechanism = False
is_fleet = False
@@ -37,6 +38,7 @@ class OSGridInfo(GridInfo):
'SD': 'is_scanning_device',
'LT': 'is_logging_tower',
'ER': 'is_exploration_reward',
'EC': 'is_exploration_container',
'FM': 'is_fleet_mechanism',
}
for key, value in dic.items():
@@ -93,6 +95,9 @@ class OSGridInfo(GridInfo):
if info.is_exploration_reward:
self.is_exploration_reward = True
return True
if info.is_exploration_container:
self.is_exploration_container = True
return True
if info.is_fleet_mechanism:
self.is_fleet_mechanism = True
return True
@@ -137,6 +142,7 @@ class OSGridInfo(GridInfo):
self.is_scanning_device = False
self.is_logging_tower = False
self.is_exploration_reward = False
self.is_exploration_container = False
self.is_fleet_mechanism = False
def reset(self):
@@ -161,6 +167,7 @@ class OSGridPredictor(GridPredictor):
self.is_scanning_device = self.enemy_genre == 'ScanningDevice'
self.is_logging_tower = self.enemy_genre == 'LoggingTower'
self.is_exploration_reward = self.enemy_genre == 'ExplorationReward'
self.is_exploration_container = self.enemy_genre == 'ExplorationContainer'
self.is_current_fleet = self.predict_current_fleet()
self.is_fleet = self.is_current_fleet
self.is_fleet_mechanism = self.predict_fleet_mechanism()
@@ -210,6 +217,7 @@ class OSGridPredictor(GridPredictor):
'ScanningDevice': TEMPLATE_ScanningDevice,
'LoggingTower': TEMPLATE_LoggingTower,
'ExplorationReward': TEMPLATE_ExplorationReward,
'ExplorationContainer': TEMPLATE_ExplorationContainer,
}
_os_template_enemy_upper = {
'ScanningDevice': TEMPLATE_ScanningDeviceUpper,

View File

@@ -26,6 +26,7 @@ SELECT_SAFE = Button(area={'cn': (89, 251, 167, 269), 'en': (92, 253, 164, 268),
SELECT_STRONGHOLD = Button(area={'cn': (89, 251, 166, 269), 'en': (81, 252, 175, 272), 'jp': (89, 251, 167, 269), 'tw': (88, 250, 167, 270)}, color={'cn': (113, 114, 118), 'en': (81, 83, 87), 'jp': (115, 116, 119), 'tw': (103, 105, 108)}, button={'cn': (89, 251, 166, 269), 'en': (81, 252, 175, 272), 'jp': (89, 251, 167, 269), 'tw': (88, 250, 167, 270)}, file={'cn': './assets/cn/os/SELECT_STRONGHOLD.png', 'en': './assets/en/os/SELECT_STRONGHOLD.png', 'jp': './assets/jp/os/SELECT_STRONGHOLD.png', 'tw': './assets/tw/os/SELECT_STRONGHOLD.png'})
STRONGHOLD_PERCENTAGE = Button(area={'cn': (293, 125, 340, 143), 'en': (293, 125, 340, 143), 'jp': (293, 125, 340, 143), 'tw': (293, 125, 340, 143)}, color={'cn': (132, 135, 146), 'en': (132, 135, 146), 'jp': (132, 135, 146), 'tw': (132, 135, 146)}, button={'cn': (293, 125, 340, 143), 'en': (293, 125, 340, 143), 'jp': (293, 125, 340, 143), 'tw': (293, 125, 340, 143)}, file={'cn': './assets/cn/os/STRONGHOLD_PERCENTAGE.png', 'en': './assets/en/os/STRONGHOLD_PERCENTAGE.png', 'jp': './assets/jp/os/STRONGHOLD_PERCENTAGE.png', 'tw': './assets/tw/os/STRONGHOLD_PERCENTAGE.png'})
TEMPLATE_EMPTY_HP = Template(file={'cn': './assets/cn/os/TEMPLATE_EMPTY_HP.png', 'en': './assets/en/os/TEMPLATE_EMPTY_HP.png', 'jp': './assets/jp/os/TEMPLATE_EMPTY_HP.png', 'tw': './assets/tw/os/TEMPLATE_EMPTY_HP.png'})
TEMPLATE_ExplorationContainer = Template(file={'cn': './assets/cn/os/TEMPLATE_ExplorationContainer.png', 'en': './assets/en/os/TEMPLATE_ExplorationContainer.png', 'jp': './assets/jp/os/TEMPLATE_ExplorationContainer.png', 'tw': './assets/tw/os/TEMPLATE_ExplorationContainer.png'})
TEMPLATE_ExplorationReward = Template(file={'cn': './assets/cn/os/TEMPLATE_ExplorationReward.png', 'en': './assets/en/os/TEMPLATE_ExplorationReward.png', 'jp': './assets/jp/os/TEMPLATE_ExplorationReward.png', 'tw': './assets/tw/os/TEMPLATE_ExplorationReward.png'})
TEMPLATE_FleetMechanism = Template(file={'cn': './assets/cn/os/TEMPLATE_FleetMechanism.png', 'en': './assets/en/os/TEMPLATE_FleetMechanism.png', 'jp': './assets/jp/os/TEMPLATE_FleetMechanism.png', 'tw': './assets/tw/os/TEMPLATE_FleetMechanism.png'})
TEMPLATE_LoggingTower = Template(file={'cn': './assets/cn/os/TEMPLATE_LoggingTower.png', 'en': './assets/en/os/TEMPLATE_LoggingTower.png', 'jp': './assets/jp/os/TEMPLATE_LoggingTower.png', 'tw': './assets/tw/os/TEMPLATE_LoggingTower.png'})

View File

@@ -785,10 +785,26 @@ class OSMap(OSFleet, Map, GlobeCamera, StrategicSearchHandler):
Returns:
bool: If solved a map random event
"""
grids = self.view.select(is_exploration_container=True)
if 'is_exploration_container' not in self._solved_map_event \
and grids and grids[0].is_exploration_container:
grid = grids[0]
logger.info(f'Found exploration container on {grid}')
self.device.click(grid)
with self.config.temporary(STORY_ALLOW_SKIP=False, STORY_OPTION=1):
result = self.wait_until_walk_stable(
drop=drop, walk_out_of_step=False, confirm_timer=Timer(1.5, count=4))
if 'event' in result:
self._solved_map_event.add('is_exploration_container')
return True
else:
return False
grids = self.view.select(is_exploration_reward=True)
if 'is_exploration_reward' not in self._solved_map_event and grids and grids[0].is_exploration_reward:
grid = grids[0]
logger.info(f'Found exploration reward on {grid}')
self.device.click(grid)
result = self.wait_until_walk_stable(drop=drop, walk_out_of_step=False, confirm_timer=Timer(1.5, count=4))
if 'event' in result:
self._solved_map_event.add('is_exploration_reward')

View File

@@ -91,8 +91,11 @@ class OpsiExplore(OSMap):
self.config.OpsiExplore_LastZone = zone
logger.info(f'Zone cleared: {self.name_to_zone(zone)}')
if finished_combat == 0:
logger.warning('Zone cleared but did not finish any combat')
self._os_explore_failed_zone.append(zone)
if 'is_exploration_container' in self._solved_map_event:
logger.info('Zone cleared by exploration container')
else:
logger.warning('Zone cleared but did not finish any combat')
self._os_explore_failed_zone.append(zone)
self.handle_after_auto_search()
self.config.check_task_switch()