mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: Handle random swipe bug during full scan
This commit is contained in:
parent
1acac2faab
commit
554698f583
@ -215,9 +215,15 @@ class Camera(InfoHandler):
|
||||
else:
|
||||
logger.info('All spawn found, Early stopped.')
|
||||
break
|
||||
|
||||
queue = queue.sort_by_camera_distance(self.camera)
|
||||
self.focus_to(queue[0])
|
||||
self.predict(mode=mode)
|
||||
self.view.predict()
|
||||
success = self.map.update(grids=self.view, camera=self.camera, mode=mode)
|
||||
if not success:
|
||||
self.ensure_edge_insight()
|
||||
continue
|
||||
|
||||
queue = queue[1:]
|
||||
|
||||
if battle_count is not None:
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import copy
|
||||
|
||||
import numpy as np
|
||||
|
||||
from module.base.utils import location2node, node2location
|
||||
from module.logger import logger
|
||||
from module.map_detection.grid_info import GridInfo
|
||||
from module.map.map_grids import SelectedGrids
|
||||
from module.map_detection.grid_info import GridInfo
|
||||
|
||||
|
||||
def location_ensure(location):
|
||||
@ -179,14 +181,24 @@ class CampaignMap:
|
||||
"""
|
||||
offset = np.array(camera) - np.array(grids.center_loca)
|
||||
grids.show()
|
||||
|
||||
failed_count = 0
|
||||
for grid in grids.grids.values():
|
||||
loca = tuple(offset + grid.location)
|
||||
if loca in self.grids:
|
||||
success = self.grids[loca].merge(grid, mode=mode)
|
||||
if not success:
|
||||
if not copy.copy(self.grids[loca]).merge(grid, mode=mode):
|
||||
logger.warning(f"Wrong Prediction. {self.grids[loca]} = '{grid.str}'")
|
||||
failed_count += 1
|
||||
|
||||
return True
|
||||
if failed_count < 2:
|
||||
for grid in grids.grids.values():
|
||||
loca = tuple(offset + grid.location)
|
||||
if loca in self.grids:
|
||||
self.grids[loca].merge(grid, mode=mode)
|
||||
return True
|
||||
else:
|
||||
logger.warning('Too many wrong prediction')
|
||||
return False
|
||||
|
||||
def reset(self):
|
||||
for grid in self:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user