AzurLaneAutoScript
AzurLaneAutoScript copied to clipboard
地图出现会走动的敌人的时候,舰队未碰到敌人,但是敌人撞上来了会出问题
在提问之前...
- [X] 我已经搜索了现有的 issues
- [X] 我在提问题之前至少花费了 5 分钟来思考和准备
- [X] 我已经阅读了 Wiki 中的 常见问题(FAQ)
- [X] 我正在使用最新版的 Alas
描述你的问题
开荒时当地图出现会走动的敌人的时候,舰队未碰到敌人,但是敌人撞上来的时候需要进入战斗,但是alas仍然试图在地图上走动,然后就寄了
如何复现
- 前往 '...'
- 点击 '....'
- 滑动到 '....'
- 出现问题
预期行为
在地图上行动前增加判断是否在进入战斗的前置界面,假如在进入战斗的前置界面就执行进入战斗等一系列操作
相关 Logs
INFO 17:20:58.737 │ [enemy_missing] EN: 0, MY: 0, SI: 2, BO: 0, CA: 0
INFO 17:20:58.739 │ [enemy_may____] EN: 3, MY: 0, SI: 3, BO: 0, CA: 2
INFO 17:20:58.743 │ Focus to: B4
INFO 17:20:58.746 │ Map swipe: (-2, -1)
INFO 17:20:58.754 │ Swipe ( 631, 333) -> (1027, 478)
WARNING 17:20:59.678 │ Image to detect is not in_map
WARNING 17:20:59.954 │ Image to detect is not in_map
WARNING 17:21:00.244 │ Image to detect is not in_map
WARNING 17:21:00.542 │ Image to detect is not in_map
WARNING 17:21:00.874 │ Image to detect is not in_map
WARNING 17:21:01.144 │ Image to detect is not in_map
WARNING 17:21:01.474 │ Image to detect is not in_map
WARNING 17:21:01.842 │ Image to detect is not in_map
WARNING 17:21:02.064 │ Image to detect is not in_map
WARNING 17:21:02.344 │ Image to detect is not in_map
WARNING 17:21:02.646 │ Image to detect is not in_map
WARNING 17:21:02.983 │ Image to detect is not in_map
WARNING 17:21:03.282 │ Image to detect is not in_map
WARNING 17:21:03.543 │ Image to detect is not in_map
WARNING 17:21:03.852 │ Image to detect is not in_map
WARNING 17:21:04.163 │ Image to detect is not in_map
WARNING 17:21:04.461 │ Image to detect is not in_map
ERROR 17:21:04.479 │ MapDetectionError: Image to detect is not in_map
╭────────────────── Traceback (most recent call last) ───────────────────╮
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\alas.py:51 in run │
│ │
│ 49 │ │ try: │
│ 50 │ │ │ self.device.screenshot() │
│ ❱ 51 │ │ │ self.__getattribute__(command)() │
│ 52 │ │ │ return True │
│ 53 │ │ except TaskEnd: │
│ │
│ ╭───────────────────────────── locals ─────────────────────────────╮ │
│ │ command = 'event2' │ │
│ │ e = MapDetectionError('Image to detect is not in_map') │ │
│ │ self = <alas.AzurLaneAutoScript object at 0x000001EF38A6E248> │ │
│ ╰──────────────────────────────────────────────────────────────────╯ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\alas.py:299 in event2 │
│ │
│ 297 │ │ from module.campaign.run import CampaignRun │
│ 298 │ │ CampaignRun(config=self.config, device=self.device).run( │
│ ❱ 299 │ │ │ name=self.config.Campaign_Name, folder=self.config.C │
│ mode=self.config.Campaign_Mode) │
│ 300 │ │
│ 301 │ def raid(self): │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ CampaignRun = <class 'module.campaign.run.CampaignRun'> │ │
│ │ self = <alas.AzurLaneAutoScript object at │ │
│ │ 0x000001EF38A6E248> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\campaign\run.py:251 │
│ in run │
│ │
│ 249 │ │ │ # Run │
│ 250 │ │ │ try: │
│ ❱ 251 │ │ │ │ self.campaign.run() │
│ 252 │ │ │ except ScriptEnd as e: │
│ 253 │ │ │ │ logger.hr('Script end') │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ folder = 'event_20200917_cn' │ │
│ │ mode = 'normal' │ │
│ │ name = 'ht3' │ │
│ │ self = <module.campaign.run.CampaignRun object at │ │
│ │ 0x000001EF7F89BEC8> │ │
│ │ total = 0 │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\campaign\campaign_bas │
│ e.py:141 in run │
│ │
│ 139 │ │ │ try: │
│ 140 │ │ │ │ if not self.map_is_auto_search: │
│ ❱ 141 │ │ │ │ │ self.execute_a_battle() │
│ 142 │ │ │ │ else: │
│ 143 │ │ │ │ │ self.auto_search_execute_a_battle() │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ _ = 0 │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\campaign\campaign_bas │
│ e.py:100 in execute_a_battle │
│ │
│ 98 │ │ for _ in range(10): │
│ 99 │ │ │ try: │
│ ❱ 100 │ │ │ │ result = self.battle_function() │
│ 101 │ │ │ │ break │
│ 102 │ │ │ except MapEnemyMoved: │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ _ = 0 │ │
│ │ prev = 0 │ │
│ │ result = False │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\base\decorator.py:67 │
│ in wrapper │
│ │
│ 65 │ │ │ │ │ │ continue │
│ 66 │ │ │ │ │ │
│ ❱ 67 │ │ │ │ │ return record['func'](self, *args, **kwargs) │
│ 68 │ │ │ │ │
│ 69 │ │ │ │ logger.warning(f'No option fits for {name}, usin │
│ func.') │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ args = () │ │
│ │ cls = <class 'module.base.decorator.Config'> │ │
│ │ flag = [True, True] │ │
│ │ func = <function CampaignBase.battle_function at │ │
│ │ 0x000001EF01480798> │ │
│ │ kwargs = {} │ │
│ │ logger = <Logger alas (INFO)> │ │
│ │ name = 'battle_function' │ │
│ │ record = { │ │
│ │ │ 'options': { │ │
│ │ │ │ 'MAP_CLEAR_ALL_THIS_TIME': False, │ │
│ │ │ │ 'POOR_MAP_DATA': False │ │
│ │ │ }, │ │
│ │ │ 'func': <function CampaignBase.battle_function at │ │
│ │ 0x000001EF01480798> │ │
│ │ } │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\campaign\campaign_bas │
│ e.py:90 in battle_function │
│ │
│ 88 │ │ func = self.__getattribute__(func) │
│ 89 │ │ │
│ ❱ 90 │ │ result = func() │
│ 91 │ │ │
│ 92 │ │ return result │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ extra_battle = 0 │ │
│ │ func = <bound method Campaign.battle_0 of │ │
│ │ <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88>> │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\campaign\event_20200917_cn\h │
│ t3.py:85 in battle_0 │
│ │
│ 83 │ │
│ 84 │ def battle_0(self): │
│ ❱ 85 │ │ if self.fleet_2_protect(): │
│ 86 │ │ │ return True │
│ 87 │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\map.py:640 in │
│ fleet_2_protect │
│ │
│ 638 │ │ │ │ grids = nearby.delete(self.map.select(is_fleet=T │
│ 639 │ │ │ │ grids = self.select_grids(grids, sort=('cost_2', │
│ ❱ 640 │ │ │ │ self.goto(grids[0]) │
│ 641 │ │ │ │ continue │
│ 642 │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ approaching = <module.map.map_grids.SelectedGrids object at │ │
│ │ 0x000001EF391B3388> │ │
│ │ grids = <module.map.map_grids.SelectedGrids object at │ │
│ │ 0x000001EF013FA708> │ │
│ │ n = 1 │ │
│ │ nearby = <module.map.map_grids.SelectedGrids object at │ │
│ │ 0x000001EF013C8148> │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\fleet.py:485 in │
│ goto │
│ │
│ 483 │ │ │ │ │ │ self._goto(grids[0], expected='') │
│ 484 │ │ │ │ try: │
│ ❱ 485 │ │ │ │ │ self._goto(node, expected=expected if node │
│ 486 │ │ │ │ except MapWalkError: │
│ 487 │ │ │ │ │ logger.warning('Map walk error.') │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ expected = '' │ │
│ │ location = (1, 5) │ │
│ │ node = (1, 5) │ │
│ │ nodes = [(1, 5)] │ │
│ │ optimize = True │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\fleet.py:447 in │
│ _goto │
│ │
│ 445 │ │ │ if result != 'combat': │
│ 446 │ │ │ │ self.predict() │
│ ❱ 447 │ │ │ self.full_scan_movable(enemy_cleared=result == 'com │
│ 448 │ │ │ self.find_path_initial() │
│ 449 │ │ │ raise MapEnemyMoved │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ ambushed_retry = <module.base.timer.Timer object at │ │
│ │ 0x000001EF0149F408> │ │
│ │ arrive_checker = True │ │
│ │ arrive_predict = '(MAP_WALK_USE_CURRENT_FLEET, │ │
│ │ is_current_fleet)' │ │
│ │ arrive_timer = <module.base.timer.Timer object at │ │
│ │ 0x000001EF016F6F88> │ │
│ │ arrive_unexpected_timer = <module.base.timer.Timer object at │ │
│ │ 0x000001EF01326C08> │ │
│ │ arrived = True │ │
│ │ expected = '' │ │
│ │ extra = 0 │ │
│ │ grid = B5 │ │
│ │ is_portal = False │ │
│ │ location = (1, 5) │ │
│ │ may_submarine_icon = False │ │
│ │ mystery = False │ │
│ │ result = 'nothing' │ │
│ │ result_mystery = '' │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign │ │
│ │ object at 0x000001EF01058D88> │ │
│ │ walk_timeout = <module.base.timer.Timer object at │ │
│ │ 0x000001EF014A1308> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\fleet.py:587 in │
│ full_scan_movable │
│ │
│ 585 │ │ │ │ grid.wipe_out() │
│ 586 │ │ │ self.full_scan(queue=None if enemy_cleared else sel │
│ ❱ 587 │ │ │ │ │ │ must_scan=self.movable_before, mode= │
│ 588 │ │ │ self.track_movable(enemy_cleared=enemy_cleared, sir │
│ 589 │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ enemy_cleared = False │ │
│ │ grid = B8 │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\fleet.py:534 in │
│ full_scan │
│ │
│ 532 │ │ super().full_scan( │
│ 533 │ │ │ queue=queue, must_scan=must_scan, battle_count=self │
│ mystery_count=self.mystery_count, │
│ ❱ 534 │ │ │ siren_count=self.siren_count, carrier_count=self.ca │
│ 535 │ │ │
│ 536 │ │ if self.config.FLEET_2 and not self.fleet_2_location: │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ __class__ = <class 'module.map.fleet.Fleet'> │ │
│ │ mode = 'movable' │ │
│ │ must_scan = <module.map.map_grids.SelectedGrids object at │ │
│ │ 0x000001EF013FD108> │ │
│ │ queue = <module.map.map_grids.SelectedGrids object at │ │
│ │ 0x000001EF013FD108> │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\camera.py:341 in │
│ full_scan │
│ │
│ 339 │ │ │ │
│ 340 │ │ │ queue = queue.sort_by_camera_distance(self.camera) │
│ ❱ 341 │ │ │ self.focus_to(queue[0]) │
│ 342 │ │ │ self.focus_to_grid_center(0.25) │
│ 343 │ │ │ success = self.map.update(grids=self.view, camera=se │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ battle_count = 0 │ │
│ │ carrier_count = 0 │ │
│ │ mode = 'movable' │ │
│ │ must_scan = <module.map.map_grids.SelectedGrids object at │ │
│ │ 0x000001EF013FD108> │ │
│ │ mystery_count = 0 │ │
│ │ queue = <module.map.map_grids.SelectedGrids object at │ │
│ │ 0x000001EF0123F088> │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ │ siren_count = 0 │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\camera.py:305 in │
│ focus_to │
│ │
│ 303 │ │ │ vector = np.array(location) - self.camera │
│ 304 │ │ │ swipe = tuple(np.min([np.abs(vector), swipe_limit], │
│ np.sign(vector)) │
│ ❱ 305 │ │ │ self.map_swipe(swipe) │
│ 306 │ │ │ │
│ 307 │ │ │ if np.all(np.abs(vector) <= 0): │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ location = (1, 3) │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ │ swipe = (-2, -1) │ │
│ │ swipe_limit = (4, 3) │ │
│ │ vector = array([-2, -1]) │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\camera.py:77 in │
│ map_swipe │
│ │
│ 75 │ │ vector = np.array(vector) │
│ 76 │ │ vector = np.array([0.5, 0.5]) - self.view.center_offset │
│ ❱ 77 │ │ self._map_swipe(vector) │
│ 78 │ │
│ 79 │ def focus_to_grid_center(self, tolerance=None): │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ │ vector = array([-2.00417346, -1.05639003]) │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\camera.py:56 in │
│ _map_swipe │
│ │
│ 54 │ │ │ self.device.swipe_vector(vector, name=name, box=box, │
│ whitelist_area=whitelist, blacklist_area=blacklist) │
│ 55 │ │ │ self.device.sleep(0.3) │
│ ❱ 56 │ │ │ self.update() │
│ 57 │ │ else: │
│ 58 │ │ │ # Drop swipe │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ blacklist = [ │ │
│ │ │ (417, 496, 576, 617), │ │
│ │ │ (700, 396, 851, 506), │ │
│ │ │ (428, 396, 579, 506), │ │
│ │ │ (708, 613, 875, 746), │ │
│ │ │ (981, 502, 1154, 623), │ │
│ │ │ (704, 502, 863, 623) │ │
│ │ ] │ │
│ │ box = (123, 159, 1175, 628) │ │
│ │ distance = array([197.49366106, 136.85036202]) │ │
│ │ name = 'MAP_SWIPE_-2_-1' │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ │ vector = array([395.81155461, 144.56735832]) │ │
│ │ whitelist = [ │ │
│ │ │ (734, 432, 813, 482), │ │
│ │ │ (854, 257, 916, 290), │ │
│ │ │ (846, 180, 904, 207), │ │
│ │ │ (1049, 643, 1124, 716), │ │
│ │ │ (728, 257, 796, 290), │ │
│ │ │ (605, 257, 675, 290), │ │
│ │ │ (1258, 340, 1308, 382), │ │
│ │ │ (1106, 257, 1157, 290), │ │
│ │ │ (1320, 532, 1376, 593), │ │
│ │ │ (1465, 532, 1514, 593), │ │
│ │ │ ... +3 │ │
│ │ ] │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\camera.py:224 in │
│ update │
│ │
│ 222 │ │ while 1: │
│ 223 │ │ │ try: │
│ ❱ 224 │ │ │ │ success = self._update(camera=camera) │
│ 225 │ │ │ │ if success: │
│ 226 │ │ │ │ │ break │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ allow_error = False │ │
│ │ camera = True │ │
│ │ confirm_timer = <module.base.timer.Timer object at │ │
│ │ 0x000001EF7F84E888> │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\camera.py:166 in │
│ _update │
│ │
│ 164 │ │ │ │ │ return False │
│ 165 │ │ │ │ else: │
│ ❱ 166 │ │ │ │ │ raise e │
│ 167 │ │ │ elif 'Camera outside map' in str(e): │
│ 168 │ │ │ │ string = str(e) │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ camera = True │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\alise\Desktop\AzurLaneAutoScript\module\map\camera.py:118 in │
│ _update │
│ │
│ 116 │ │ │ │ │ and not self.is_in_strategy_submarine_move() │
│ 117 │ │ │ │ logger.warning('Image to detect is not in_map') │
│ ❱ 118 │ │ │ │ raise MapDetectionError('Image to detect is not │
│ 119 │ │ │ self.view.load(self.device.image) │
│ 120 │ │ except MapDetectionError as e: │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ camera = True │ │
│ │ self = <campaign.event_20200917_cn.ht3.Campaign object at │ │
│ │ 0x000001EF01058D88> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
╰────────────────────────────────────────────────────────────────────────╯
MapDetectionError: Image to detect is not in_map
WARNING 17:21:06.570 │ Saving error: ./log/error/1658222466570
截图
无
还有别的吗?
无