Fix: 增加复刻苍红的回响CD图, 国服热更又把地图视角改回去了

- 修复点击时报类型错误的问题
- 修复无透视图片不被更新的问题
- 增加了灭点和距点的log
This commit is contained in:
LmeSzinc 2020-04-24 23:20:34 +08:00
parent 604cdf4005
commit 516c16beae
17 changed files with 190 additions and 32 deletions

View File

@ -5,7 +5,6 @@ from module.logger import logger
MAP = CampaignMap()
MAP.camera_sight = (-4, -2, 5, 3)
MAP.map_data = '''
-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- --
@ -26,26 +25,15 @@ class Config:
MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_SIREN = True
MAP_HAS_DYNAMIC_RED_BORDER = True
MAP_GRID_CENTER_TOLERANCE = 0.3
MAP_SIREN_COUNT = 2
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 50
EDGE_LINES_HOUGHLINES_THRESHOLD = 50
CAMERA_SWIPE_MULTIPLY_X = 200 * 0.7
CAMERA_SWIPE_MULTIPLY_Y = 140 * 0.7
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.
MID_DIFF_RANGE_H = (45, 70)
MID_DIFF_RANGE_V = (97 - 3, 97 + 3)
TRUST_EDGE_LINES = True
VANISH_POINT_RANGE = ((540, 740), (-4000, -2000))
DISTANCE_POINT_X_RANGE = ((-2000, -1000),)
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (80, 255 - 40),
'width': (0.9, 10),
'prominence': 10,
'distance': 35,
'wlen': 100,
}
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 40, 255),

View File

@ -5,7 +5,6 @@ from module.logger import logger
from campaign.event_20200423_cn.a1 import Config
MAP = CampaignMap()
MAP.camera_sight = (-4, -2, 5, 3)
MAP.map_data = '''
-- -- -- -- -- -- --
-- -- -- ++ ++ ++ --

View File

@ -5,7 +5,6 @@ from module.logger import logger
from campaign.event_20200423_cn.a1 import Config
MAP = CampaignMap()
MAP.camera_sight = (-4, -2, 5, 3)
MAP.map_data = '''
SP SP -- -- -- -- -- -- --
SP -- -- -- ++ ++ ++ -- --

View File

@ -5,7 +5,6 @@ from module.logger import logger
MAP = CampaignMap()
MAP.camera_sight = (-4, -2, 5, 3)
MAP.map_data = '''
-- -- -- -- -- -- -- -- --
-- ++ ++ -- -- -- -- ++ --
@ -25,26 +24,15 @@ class Config:
MAP_HAS_FLEET_STEP = True
MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_SIREN = True
MAP_GRID_CENTER_TOLERANCE = 0.3
MAP_SIREN_COUNT = 2
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 50
EDGE_LINES_HOUGHLINES_THRESHOLD = 50
CAMERA_SWIPE_MULTIPLY_X = 200 * 0.7
CAMERA_SWIPE_MULTIPLY_Y = 140 * 0.7
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.
MID_DIFF_RANGE_H = (45, 70)
MID_DIFF_RANGE_V = (97 - 3, 97 + 3)
TRUST_EDGE_LINES = True
VANISH_POINT_RANGE = ((540, 740), (-4000, -2000))
DISTANCE_POINT_X_RANGE = ((-2000, -1000),)
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (80, 255 - 40),
'width': (0.9, 10),
'prominence': 10,
'distance': 35,
'wlen': 100,
}
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 40, 255),
@ -54,5 +42,6 @@ class Config:
}
class Campaign(CampaignBase):
MAP = MAP

View File

@ -5,7 +5,6 @@ from module.logger import logger
from campaign.event_20200423_cn.b1 import Config as ConfigBase
MAP = CampaignMap()
MAP.camera_sight = (-4, -2, 5, 3)
MAP.map_data = '''
-- -- -- -- SP SP -- -- ++ ++
-- -- -- -- -- -- -- -- ++ ++

View File

@ -5,7 +5,6 @@ from module.logger import logger
from campaign.event_20200423_cn.b1 import Config as ConfigBase
MAP = CampaignMap()
MAP.camera_sight = (-4, -2, 5, 3)
MAP.map_data = '''
-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- ++ ++

View File

@ -0,0 +1,47 @@
from module.campaign.campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
MAP = CampaignMap()
MAP.map_data = '''
-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- --
-- -- -- ++ ++ -- ++ -- --
-- -- -- ++ ++ -- -- -- --
SP -- -- -- -- -- -- ++ --
SP SP -- -- -- -- -- ++ --
'''
class Config:
SUBMARINE = 0
FLEET_BOSS = 1
POOR_MAP_DATA = True
MAP_HAS_AMBUSH = False
MAP_HAS_FLEET_STEP = True
MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_SIREN = True
MAP_HAS_DYNAMIC_RED_BORDER = True
MAP_SIREN_COUNT = 2
TRUST_EDGE_LINES = True
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (80, 255 - 40),
'width': (0.9, 10),
'prominence': 10,
'distance': 35,
}
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 40, 255),
'prominence': 10,
'distance': 50,
'wlen': 1000
}
class Campaign(CampaignBase):
MAP = MAP

View File

@ -0,0 +1,20 @@
from module.campaign.campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
from campaign.event_20200423_cn.c1 import Config
MAP = CampaignMap()
MAP.map_data = '''
-- -- -- -- -- -- --
-- -- -- ++ ++ ++ --
-- -- -- -- -- -- --
-- -- ++ -- -- -- --
-- -- -- -- -- -- --
SP -- -- -- -- ++ --
SP SP -- -- -- ++ --
'''
class Campaign(CampaignBase):
MAP = MAP

View File

@ -0,0 +1,20 @@
from module.campaign.campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
from campaign.event_20200423_cn.c1 import Config
MAP = CampaignMap()
MAP.map_data = '''
SP SP -- -- -- -- -- -- --
SP -- -- -- ++ ++ ++ -- --
-- -- -- -- -- -- -- -- --
-- ++ -- -- -- -- -- -- --
-- ++ -- -- ++ ++ -- -- --
-- -- -- -- -- -- -- ++ ++
-- -- -- -- -- -- -- ++ ++
'''
class Campaign(CampaignBase):
MAP = MAP

View File

@ -0,0 +1,46 @@
from module.campaign.campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
MAP = CampaignMap()
MAP.map_data = '''
-- -- -- -- -- -- -- -- --
-- ++ ++ -- -- -- -- ++ --
-- -- -- -- -- -- -- -- --
-- -- ++ ++ ++ -- -- -- --
-- -- -- -- -- -- -- -- --
++ ++ -- -- -- -- ++ -- --
++ ++ SP SP -- -- ++ -- --
'''
class Config:
SUBMARINE = 0
FLEET_BOSS = 2
POOR_MAP_DATA = True
MAP_HAS_AMBUSH = False
MAP_HAS_FLEET_STEP = True
MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_SIREN = True
MAP_SIREN_COUNT = 3
TRUST_EDGE_LINES = True
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (80, 255 - 40),
'width': (0.9, 10),
'prominence': 10,
'distance': 35,
}
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 40, 255),
'prominence': 10,
'distance': 50,
'wlen': 1000
}
class Campaign(CampaignBase):
MAP = MAP

View File

@ -0,0 +1,24 @@
from module.campaign.campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
from campaign.event_20200423_cn.d1 import Config as ConfigBase
MAP = CampaignMap()
MAP.map_data = '''
-- -- -- -- SP SP -- -- ++ ++
-- -- -- -- -- -- -- -- ++ ++
++ ++ ++ -- -- -- -- -- -- --
-- -- -- -- ++ ++ -- -- -- --
-- -- -- -- -- -- -- -- -- --
-- ++ -- -- -- -- ++ -- -- --
-- ++ -- -- -- -- -- -- -- --
'''
class Config(ConfigBase):
FLEET_BOSS = 2
class Campaign(CampaignBase):
MAP = MAP

View File

@ -0,0 +1,24 @@
from module.campaign.campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
from campaign.event_20200423_cn.d1 import Config as ConfigBase
MAP = CampaignMap()
MAP.map_data = '''
-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- ++ ++
++ ++ -- -- ++ ++ -- -- --
-- -- -- -- ++ ++ -- -- SP
++ ++ -- -- -- -- -- -- SP
-- -- -- -- -- -- -- ++ --
-- -- ++ ++ ++ -- -- -- --
'''
class Config(ConfigBase):
FLEET_BOSS = 2
class Campaign(CampaignBase):
MAP = MAP

View File

@ -66,7 +66,7 @@ class Control(Connection):
# @retry()
def _click_uiautomator2(self, x, y):
self.device.click(x, y)
self.device.click(int(x), int(y))
# @retry()
def _click_adb(self, x, y):

View File

@ -190,7 +190,9 @@ class Fleet(Camera, MapOperation, AmbushHandler):
logger.info(f'Carrier spawn: {diff}')
elif self.config.POOR_MAP_DATA:
for grid in self.map:
grid.wipe_out()
grid.reset()
if result == 'combat':
self.ensure_edge_insight()
self.full_scan()
self.find_path_initial()

View File

@ -38,9 +38,9 @@ class GridPredictor:
0, # g
((-x0 + x1) / (-x2 + x3) - 1) / self.ENEMY_PERSPECTIVE_IMAGE_SIZE[1] # h
)
self.image_transform = self.image.transform(self.ENEMY_PERSPECTIVE_IMAGE_SIZE, Image.PERSPECTIVE, self._perspective)
def predict(self):
self.image_transform = self.image.transform(self.ENEMY_PERSPECTIVE_IMAGE_SIZE, Image.PERSPECTIVE, self._perspective)
# self.image_hole = self.get_relative_image((-1, -1, 1, 1))
self.is_enemy = self.predict_static_red_border()

View File

@ -238,7 +238,7 @@ class Map(Fleet):
logger.hr('Clear BOSS')
grids = grids.sort(cost=True, weight=True)
logger.info('Grids: %s' % str(grids))
self.clear_chosen_enemy(grids[0], expected='boss')
self.clear_chosen_enemy(grids[0])
logger.warning('BOSS not detected, trying all boss spawn point.')
self.clear_potential_boss()

View File

@ -82,6 +82,8 @@ class Perspective:
self.vanish_point = optimize.brute(self._vanish_point_value, self.config.VANISH_POINT_RANGE)
distance_point_x = optimize.brute(self._distant_point_value, self.config.DISTANCE_POINT_X_RANGE)[0]
self.distant_point = np.array([distance_point_x, self.vanish_point[1]])
logger.info(f' vanish_point: ({", ".join([str(int(x)).rjust(5) for x in self.vanish_point])})')
logger.info(f' distant_point: ({", ".join([str(int(x)).rjust(5) for x in self.distant_point])})')
# Re-generate lines. Useless after mid_cleanse function added.
# self.horizontal = self.crossings.link(None, is_horizontal=True).group()