1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-31 12:20:33 +08:00

Fix: 修复精英检测

- 修复红框会越到下面一个格子的问题
- 修复BD图红框闪烁检测的问题
This commit is contained in:
LmeSzinc
2020-04-25 02:09:27 +08:00
parent 4e58edadbd
commit f9b2a9358b
5 changed files with 19 additions and 4 deletions

View File

@@ -19,11 +19,13 @@ MAP.map_data = '''
class Config: class Config:
SUBMARINE = 0 SUBMARINE = 0
FLEET_BOSS = 1 FLEET_BOSS = 1
POOR_MAP_DATA = True POOR_MAP_DATA = True
MAP_HAS_AMBUSH = False MAP_HAS_AMBUSH = False
MAP_HAS_FLEET_STEP = True MAP_HAS_FLEET_STEP = True
MAP_HAS_MOVABLE_ENEMY = True MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_SIREN = True MAP_HAS_SIREN = True
MAP_HAS_DYNAMIC_RED_BORDER = True
MAP_SIREN_COUNT = 2 MAP_SIREN_COUNT = 2
TRUST_EDGE_LINES = True TRUST_EDGE_LINES = True

View File

@@ -19,11 +19,13 @@ MAP.map_data = '''
class Config: class Config:
SUBMARINE = 0 SUBMARINE = 0
FLEET_BOSS = 2 FLEET_BOSS = 2
POOR_MAP_DATA = True POOR_MAP_DATA = True
MAP_HAS_AMBUSH = False MAP_HAS_AMBUSH = False
MAP_HAS_FLEET_STEP = True MAP_HAS_FLEET_STEP = True
MAP_HAS_MOVABLE_ENEMY = True MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_SIREN = True MAP_HAS_SIREN = True
MAP_HAS_DYNAMIC_RED_BORDER = True
MAP_SIREN_COUNT = 2 MAP_SIREN_COUNT = 2
TRUST_EDGE_LINES = True TRUST_EDGE_LINES = True

View File

@@ -429,8 +429,8 @@ class Fleet(Camera, MapOperation, AmbushHandler):
for grid in grids: for grid in grids:
if grid.is_boss: if grid.is_boss:
appear = True appear = True
for grid in self.map: for g in self.map:
grid.wipe_out() g.wipe_out()
break break
if appear: if appear:

View File

@@ -9,6 +9,7 @@ from module.template.assets import *
class GridPredictor: class GridPredictor:
ENEMY_SCALE_IMAGE_SIZE = (50, 50) ENEMY_SCALE_IMAGE_SIZE = (50, 50)
ENEMY_PERSPECTIVE_IMAGE_SIZE = (50, 50) ENEMY_PERSPECTIVE_IMAGE_SIZE = (50, 50)
RED_BORDER_IGNORE_TOP = 10
def __init__(self, location, image, corner): def __init__(self, location, image, corner):
""" """
@@ -111,7 +112,9 @@ class GridPredictor:
def predict_static_red_border(self): def predict_static_red_border(self):
# image = self.image.transform(self.ENEMY_PERSPECTIVE_IMAGE_SIZE, Image.PERSPECTIVE, self._perspective) # image = self.image.transform(self.ENEMY_PERSPECTIVE_IMAGE_SIZE, Image.PERSPECTIVE, self._perspective)
image = color_similarity_2d(self.image_transform, color=(255, 36, 82)) image = color_similarity_2d(
self.image_transform.crop((0, self.RED_BORDER_IGNORE_TOP, *self.ENEMY_PERSPECTIVE_IMAGE_SIZE)),
color=(255, 36, 82))
# Image.fromarray(np.array(image).astype('uint8'), mode='RGB').save(f'{self}.png') # Image.fromarray(np.array(image).astype('uint8'), mode='RGB').save(f'{self}.png')
@@ -119,7 +122,9 @@ class GridPredictor:
return count > 40 return count > 40
def predict_dynamic_red_border(self, pad=4): def predict_dynamic_red_border(self, pad=4):
image = np.array(self.image_transform).astype(float) image = np.array(
self.image_transform.crop((0, self.RED_BORDER_IGNORE_TOP, *self.ENEMY_PERSPECTIVE_IMAGE_SIZE))
).astype(float)
r, b = image[:, :, 0], image[:, :, 2] r, b = image[:, :, 0], image[:, :, 2]
image = r - b image = r - b
image[image < 0] = 0 image[image < 0] = 0

View File

@@ -97,6 +97,12 @@ class Grids(Perspective):
for grid in self: for grid in self:
grid.is_siren = False grid.is_siren = False
# for grid in self:
# if grid.is_enemy and grid.enemy_scale == 0:
# import time
# self.image.save(f'{int(time.time()*1000)}.png')
# break
def update(self, image): def update(self, image):
self.image = image self.image = image
for grid in self: for grid in self: