From 114ccf23867a113db71e1a629cea1d40de7f974b Mon Sep 17 00:00:00 2001 From: Mirageorwhatever <84392723+Mirageorwhatever@users.noreply.github.com> Date: Wed, 14 Dec 2022 00:56:10 +0800 Subject: [PATCH] Fix: Fleet position initialize in war archive Visitors Dyed in Red (#2000) --- campaign/war_archives_20190321_en/a1.py | 20 +++++++++++++++++++- campaign/war_archives_20190321_en/a3.py | 4 +++- campaign/war_archives_20190321_en/c1.py | 4 +++- campaign/war_archives_20190321_en/c3.py | 4 +++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/campaign/war_archives_20190321_en/a1.py b/campaign/war_archives_20190321_en/a1.py index 0f550405c..9e5acccdd 100644 --- a/campaign/war_archives_20190321_en/a1.py +++ b/campaign/war_archives_20190321_en/a1.py @@ -4,10 +4,13 @@ from module.map.map_grids import RoadGrids, SelectedGrids from ..campaign_war_archives.campaign_base import CampaignBase +from module.map_detection.grid import Grid +from module.template.assets import TEMPLATE_FLEET_CURRENT + MAP = CampaignMap('A1') MAP.shape = 'H5' MAP.camera_data = ['D2', 'D3', 'E2', 'E3'] -MAP.camera_data_spawn_point = ['D3', 'D2'] +MAP.camera_data_spawn_point = ['D3', 'C1'] MAP.map_data = """ SP -- -- ++ ++ ++ ++ ++ -- ++ ME Me ME -- Me ++ @@ -38,6 +41,20 @@ A5, B5, C5, D5, E5, F5, G5, H5, \ = MAP.flatten() +class EventGrid(Grid): + def predict_current_fleet(self): + count = self.relative_hsv_count(area=(-0.5, -3.5, 0.5, -2.5), h=(141 - 3, 141 + 10), shape=(50, 50)) + if count < 200: + return False + + # image = self.relative_crop((-0.5, -3.5, 0.5, -2.5), shape=(60, 60)) + # image = color_similarity_2d(image, color=(24, 255, 107)) + # if not TEMPLATE_FLEET_CURRENT.match(image, similarity=0.75): + # return False + + return True + + class Config: # ===== Start of generated config ===== MAP_HAS_MAP_STORY = True @@ -48,6 +65,7 @@ class Config: class Campaign(CampaignBase): + grid_class = EventGrid MAP = MAP ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C' diff --git a/campaign/war_archives_20190321_en/a3.py b/campaign/war_archives_20190321_en/a3.py index 5a355204e..ee97d20e7 100644 --- a/campaign/war_archives_20190321_en/a3.py +++ b/campaign/war_archives_20190321_en/a3.py @@ -4,11 +4,12 @@ from module.map.map_grids import RoadGrids, SelectedGrids from ..campaign_war_archives.campaign_base import CampaignBase from .a1 import Config as ConfigBase +from .a1 import EventGrid MAP = CampaignMap('A3') MAP.shape = 'H7' MAP.camera_data = ['D2', 'D5', 'E2', 'E5'] -MAP.camera_data_spawn_point = ['D2'] +MAP.camera_data_spawn_point = ['C1'] MAP.map_data = """ SP -- -- ++ ++ ++ ++ ++ -- ++ Me -- ME -- -- ++ @@ -56,6 +57,7 @@ class Config(ConfigBase): class Campaign(CampaignBase): + grid_class = EventGrid MAP = MAP ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C' diff --git a/campaign/war_archives_20190321_en/c1.py b/campaign/war_archives_20190321_en/c1.py index b456537b1..a1cfdef12 100644 --- a/campaign/war_archives_20190321_en/c1.py +++ b/campaign/war_archives_20190321_en/c1.py @@ -3,11 +3,12 @@ from module.map.map_base import CampaignMap from module.map.map_grids import RoadGrids, SelectedGrids from ..campaign_war_archives.campaign_base import CampaignBase +from .a1 import EventGrid MAP = CampaignMap('C1') MAP.shape = 'H5' MAP.camera_data = ['D2', 'D3', 'E2', 'E3'] -MAP.camera_data_spawn_point = ['D3', 'D2'] +MAP.camera_data_spawn_point = ['D3', 'C1'] MAP.map_data = """ SP -- -- ++ ++ ++ ++ ++ -- ++ ME Me ME -- Me ++ @@ -48,6 +49,7 @@ class Config: class Campaign(CampaignBase): + grid_class = EventGrid MAP = MAP ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C' diff --git a/campaign/war_archives_20190321_en/c3.py b/campaign/war_archives_20190321_en/c3.py index 3acca8c2f..935da005e 100644 --- a/campaign/war_archives_20190321_en/c3.py +++ b/campaign/war_archives_20190321_en/c3.py @@ -4,11 +4,12 @@ from module.map.map_grids import RoadGrids, SelectedGrids from ..campaign_war_archives.campaign_base import CampaignBase from .c1 import Config as ConfigBase +from .a1 import EventGrid MAP = CampaignMap('C3') MAP.shape = 'H7' MAP.camera_data = ['D2', 'D5', 'E2', 'E5'] -MAP.camera_data_spawn_point = ['D2'] +MAP.camera_data_spawn_point = ['C1'] MAP.map_data = """ SP -- -- ++ ++ ++ ++ ++ -- ++ Me -- ME -- -- ++ @@ -56,6 +57,7 @@ class Config(ConfigBase): class Campaign(CampaignBase): + grid_class = EventGrid MAP = MAP ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C'