mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-25 03:32:38 +08:00
Merge branch 'campaign_16_main'
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
from module.base.mask import Mask
|
||||
from module.base.timer import Timer
|
||||
from module.campaign.campaign_base import CampaignBase as CampaignBase_
|
||||
from module.handler.assets import STRATEGY_OPENED
|
||||
from module.handler.strategy import MOB_MOVE_OFFSET
|
||||
from module.logger import logger
|
||||
from module.map.map_grids import SelectedGrids
|
||||
from module.map.utils import location_ensure
|
||||
from module.map_detection.grid import GridInfo
|
||||
from module.map_detection.utils_assets import ASSETS
|
||||
|
||||
MASK_MAP_UI_W15 = Mask(file='./assets/mask/MASK_MAP_UI_W15.png')
|
||||
from .campaign_support_fleet import CampaignBase as CampaignBase_
|
||||
|
||||
|
||||
class Config:
|
||||
@@ -45,12 +43,6 @@ class W15GridInfo(GridInfo):
|
||||
class CampaignBase(CampaignBase_):
|
||||
ENEMY_FILTER = '1L > 1M > 1E > 2L > 3L > 2M > 2E > 1C > 2C > 3M > 3E > 3C'
|
||||
|
||||
def map_data_init(self, map_):
|
||||
super().map_data_init(map_)
|
||||
# Patch ui_mask, get rid of supporting fleet
|
||||
_ = ASSETS.ui_mask
|
||||
ASSETS.ui_mask = MASK_MAP_UI_W15.image
|
||||
|
||||
map_has_mob_move = True
|
||||
|
||||
def strategy_set_execute(self, formation=None, sub_view=None, sub_hunt=None):
|
||||
@@ -61,10 +53,6 @@ class CampaignBase(CampaignBase_):
|
||||
)
|
||||
logger.attr("Map has mob move", self.strategy_has_mob_move())
|
||||
|
||||
def _map_swipe(self, vector, box=(239, 159, 1175, 628)):
|
||||
# Left border to 239, avoid swiping on support fleet
|
||||
return super()._map_swipe(vector, box=box)
|
||||
|
||||
def mob_movable(self, location, target):
|
||||
"""
|
||||
Check if mob is movable from location to target.
|
||||
|
||||
81
campaign/campaign_main/campaign_16_1.py
Normal file
81
campaign/campaign_main/campaign_16_1.py
Normal file
@@ -0,0 +1,81 @@
|
||||
from module.map.map_base import CampaignMap
|
||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||
from module.logger import logger
|
||||
|
||||
from .campaign_16_base_submarine import CampaignBase
|
||||
from .campaign_16_base_submarine import Config as ConfigBase
|
||||
|
||||
MAP = CampaignMap('16-1')
|
||||
MAP.shape = 'I9'
|
||||
MAP.camera_data = ['C2', 'C6', 'F2', 'F6']
|
||||
MAP.camera_data_spawn_point = ['F6']
|
||||
MAP.camera_sight = (-2, -1, 3, 2)
|
||||
MAP.map_data = """
|
||||
++ ME -- -- ME -- -- ME --
|
||||
ME -- -- ME ++ ME -- -- ME
|
||||
-- -- ME -- ME -- -- ME ++
|
||||
-- ME ++ ME -- ME -- ME Me
|
||||
-- -- ME -- Me ++ __ -- --
|
||||
-- ME -- __ ME -- -- -- MB
|
||||
-- ++ Me -- -- -- Me ++ ++
|
||||
-- ME -- -- -- -- -- ++ ++
|
||||
-- -- -- -- SP SP ++ ++ --
|
||||
"""
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50
|
||||
"""
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 2},
|
||||
{'battle': 1, 'enemy': 2},
|
||||
{'battle': 2, 'enemy': 2},
|
||||
{'battle': 3, 'enemy': 1},
|
||||
{'battle': 4, 'enemy': 1},
|
||||
{'battle': 5, 'boss': 1}
|
||||
]
|
||||
A1, B1, C1, D1, E1, F1, G1, H1, I1, \
|
||||
A2, B2, C2, D2, E2, F2, G2, H2, I2, \
|
||||
A3, B3, C3, D3, E3, F3, G3, H3, I3, \
|
||||
A4, B4, C4, D4, E4, F4, G4, H4, I4, \
|
||||
A5, B5, C5, D5, E5, F5, G5, H5, I5, \
|
||||
A6, B6, C6, D6, E6, F6, G6, H6, I6, \
|
||||
A7, B7, C7, D7, E7, F7, G7, H7, I7, \
|
||||
A8, B8, C8, D8, E8, F8, G8, H8, I8, \
|
||||
A9, B9, C9, D9, E9, F9, G9, H9, I9, \
|
||||
= MAP.flatten()
|
||||
|
||||
|
||||
class Config(ConfigBase):
|
||||
MAP_HAS_MAP_STORY = False
|
||||
MAP_HAS_FLEET_STEP = False
|
||||
MAP_HAS_AMBUSH = True
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
|
||||
def battle_0(self):
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=1):
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_5(self):
|
||||
boss = self.map.select(is_boss=True)
|
||||
if boss:
|
||||
return self.fleet_boss.clear_boss()
|
||||
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_6(self):
|
||||
return self.fleet_boss.clear_boss()
|
||||
78
campaign/campaign_main/campaign_16_2.py
Normal file
78
campaign/campaign_main/campaign_16_2.py
Normal file
@@ -0,0 +1,78 @@
|
||||
from module.map.map_base import CampaignMap
|
||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||
from module.logger import logger
|
||||
|
||||
from .campaign_16_base_submarine import CampaignBase
|
||||
from .campaign_16_base_submarine import Config as ConfigBase
|
||||
|
||||
MAP = CampaignMap('16-2')
|
||||
MAP.shape = 'J8'
|
||||
MAP.camera_data = ['C2', 'C6', 'G2', 'G6']
|
||||
MAP.camera_data_spawn_point = ['C6']
|
||||
MAP.camera_sight = (-2, -1, 3, 2)
|
||||
MAP.map_data = """
|
||||
MB ++ -- ME -- -- -- -- -- --
|
||||
-- Me ME -- ME ++ ME -- -- --
|
||||
-- __ -- -- -- -- -- ME ++ ++
|
||||
ME -- ME ME ME -- ME -- ++ --
|
||||
Me -- -- Me ++ -- Me -- -- --
|
||||
++ ME -- ME ME -- ME ++ ++ --
|
||||
-- -- -- -- -- Me -- -- ++ --
|
||||
-- SP SP -- ++ ++ ++ -- -- --
|
||||
"""
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50
|
||||
"""
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 3},
|
||||
{'battle': 1, 'enemy': 2},
|
||||
{'battle': 2, 'enemy': 2},
|
||||
{'battle': 3, 'enemy': 1},
|
||||
{'battle': 4, 'enemy': 1},
|
||||
{'battle': 5, 'boss': 1},
|
||||
]
|
||||
A1, B1, C1, D1, E1, F1, G1, H1, I1, J1, \
|
||||
A2, B2, C2, D2, E2, F2, G2, H2, I2, J2, \
|
||||
A3, B3, C3, D3, E3, F3, G3, H3, I3, J3, \
|
||||
A4, B4, C4, D4, E4, F4, G4, H4, I4, J4, \
|
||||
A5, B5, C5, D5, E5, F5, G5, H5, I5, J5, \
|
||||
A6, B6, C6, D6, E6, F6, G6, H6, I6, J6, \
|
||||
A7, B7, C7, D7, E7, F7, G7, H7, I7, J7, \
|
||||
A8, B8, C8, D8, E8, F8, G8, H8, I8, J8, \
|
||||
= MAP.flatten()
|
||||
|
||||
|
||||
class Config(ConfigBase):
|
||||
MAP_HAS_MAP_STORY = False
|
||||
MAP_HAS_FLEET_STEP = False
|
||||
MAP_HAS_AMBUSH = True
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
|
||||
def battle_0(self):
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=1):
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_5(self):
|
||||
boss = self.map.select(is_boss=True)
|
||||
if boss:
|
||||
return self.fleet_boss.clear_boss()
|
||||
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
|
||||
return self.battle_default()
|
||||
|
||||
def battle_6(self):
|
||||
return self.fleet_boss.clear_boss()
|
||||
90
campaign/campaign_main/campaign_16_3.py
Normal file
90
campaign/campaign_main/campaign_16_3.py
Normal file
@@ -0,0 +1,90 @@
|
||||
from module.map.map_base import CampaignMap
|
||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||
from module.logger import logger
|
||||
|
||||
from .campaign_16_base_aircraft import CampaignBase
|
||||
from .campaign_16_base_aircraft import Config as ConfigBase
|
||||
|
||||
MAP = CampaignMap('16-3')
|
||||
MAP.shape = 'K6'
|
||||
MAP.camera_data = ['C2', 'C5', 'F2', 'F5', 'H2', 'H5']
|
||||
MAP.camera_data_spawn_point = ['C5']
|
||||
MAP.camera_sight = (-2, -1, 3, 2)
|
||||
MAP.map_data = """
|
||||
-- -- ++ ++ ++ -- -- ME ++ -- MB
|
||||
-- ME -- ++ -- ME -- -- ++ -- --
|
||||
-- -- ME ME -- ME ++ ME ++ -- --
|
||||
-- -- -- ++ ++ __ ME ME -- -- --
|
||||
SP -- -- ++ -- ME ++ -- -- -- --
|
||||
SP -- -- ME ME -- ++ -- -- -- ++
|
||||
"""
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
50 50 40 40 40 40 50 50 50 50 50
|
||||
50 50 50 50 50 40 40 40 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
"""
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 3},
|
||||
{'battle': 1, 'enemy': 6},
|
||||
{'battle': 2, 'enemy': 3},
|
||||
{'battle': 3, 'boss': 1},
|
||||
]
|
||||
A1, B1, C1, D1, E1, F1, G1, H1, I1, J1, K1, \
|
||||
A2, B2, C2, D2, E2, F2, G2, H2, I2, J2, K2, \
|
||||
A3, B3, C3, D3, E3, F3, G3, H3, I3, J3, K3, \
|
||||
A4, B4, C4, D4, E4, F4, G4, H4, I4, J4, K4, \
|
||||
A5, B5, C5, D5, E5, F5, G5, H5, I5, J5, K5, \
|
||||
A6, B6, C6, D6, E6, F6, G6, H6, I6, J6, K6, \
|
||||
= MAP.flatten()
|
||||
|
||||
road_main = RoadGrids([C3, D3, F3, G4, H4])
|
||||
|
||||
|
||||
class Config(ConfigBase):
|
||||
MAP_HAS_MAP_STORY = False
|
||||
MAP_HAS_FLEET_STEP = False
|
||||
MAP_HAS_AMBUSH = True
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
|
||||
def battle_0(self):
|
||||
self.clear_chosen_enemy(C3)
|
||||
return True
|
||||
|
||||
def battle_1(self):
|
||||
if self.use_support_fleet:
|
||||
self.air_strike(E3)
|
||||
self.clear_chosen_enemy(D3)
|
||||
return True
|
||||
|
||||
def battle_2(self):
|
||||
if self.clear_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_potential_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
return self.battle_default()
|
||||
|
||||
def battle_3(self):
|
||||
boss = self.map.select(is_boss=True)
|
||||
if boss:
|
||||
if not self.check_accessibility(boss[0], fleet='boss'):
|
||||
return self.clear_roadblocks([road_main])
|
||||
if self.use_support_fleet:
|
||||
# at this stage the most right zone should be accessible
|
||||
self.goto(K5)
|
||||
self.air_strike(J6)
|
||||
return self.fleet_boss.clear_boss()
|
||||
if self.clear_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_potential_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
return self.battle_default()
|
||||
97
campaign/campaign_main/campaign_16_4.py
Normal file
97
campaign/campaign_main/campaign_16_4.py
Normal file
@@ -0,0 +1,97 @@
|
||||
from module.map.map_base import CampaignMap
|
||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||
from module.logger import logger
|
||||
|
||||
from .campaign_16_base_aircraft import CampaignBase
|
||||
from .campaign_16_base_aircraft import Config as ConfigBase
|
||||
|
||||
MAP = CampaignMap('16-4')
|
||||
MAP.shape = 'K8'
|
||||
MAP.camera_data = ['C2', 'C6', 'F2', 'F6', 'H2', 'H6']
|
||||
MAP.camera_data_spawn_point = ['C6']
|
||||
MAP.camera_sight = (-2, -1, 3, 2)
|
||||
MAP.map_data = """
|
||||
-- -- ++ -- -- -- ++ ME -- -- MB
|
||||
ME ++ ++ ++ -- -- ME ++ -- -- --
|
||||
-- -- ME -- -- ++ ++ ME -- -- --
|
||||
-- -- -- ME ++ -- ME -- ++ ++ --
|
||||
-- -- ME -- -- ME ++ -- ME ++ --
|
||||
-- __ -- ++ ++ -- ++ ME ME -- --
|
||||
SP -- -- ME -- -- ME ++ -- ++ ++
|
||||
SP -- -- -- ++ -- ++ ++ -- -- ++
|
||||
"""
|
||||
MAP.weight_data = """
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 40 50 50 50
|
||||
50 50 50 40 50 40 40 40 50 50 50
|
||||
50 50 50 40 40 40 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
50 50 50 50 50 50 50 50 50 50 50
|
||||
"""
|
||||
MAP.spawn_data = [
|
||||
{'battle': 0, 'enemy': 5},
|
||||
{'battle': 1, 'enemy': 4},
|
||||
{'battle': 2, 'enemy': 5},
|
||||
{'battle': 3},
|
||||
{'battle': 4, 'boss': 1},
|
||||
]
|
||||
A1, B1, C1, D1, E1, F1, G1, H1, I1, J1, K1, \
|
||||
A2, B2, C2, D2, E2, F2, G2, H2, I2, J2, K2, \
|
||||
A3, B3, C3, D3, E3, F3, G3, H3, I3, J3, K3, \
|
||||
A4, B4, C4, D4, E4, F4, G4, H4, I4, J4, K4, \
|
||||
A5, B5, C5, D5, E5, F5, G5, H5, I5, J5, K5, \
|
||||
A6, B6, C6, D6, E6, F6, G6, H6, I6, J6, K6, \
|
||||
A7, B7, C7, D7, E7, F7, G7, H7, I7, J7, K7, \
|
||||
A8, B8, C8, D8, E8, F8, G8, H8, I8, J8, K8, \
|
||||
= MAP.flatten()
|
||||
|
||||
road_main = RoadGrids([D4, F5, G4, H3])
|
||||
|
||||
class Config(ConfigBase):
|
||||
MAP_HAS_MAP_STORY = False
|
||||
MAP_HAS_FLEET_STEP = False
|
||||
MAP_HAS_AMBUSH = True
|
||||
|
||||
|
||||
class Campaign(CampaignBase):
|
||||
MAP = MAP
|
||||
|
||||
def battle_0(self):
|
||||
self.clear_chosen_enemy(D4)
|
||||
return True
|
||||
|
||||
def battle_1(self):
|
||||
if self.use_support_fleet:
|
||||
self.goto(D1)
|
||||
self.air_strike(B1)
|
||||
self.clear_chosen_enemy(F5)
|
||||
return True
|
||||
|
||||
def battle_2(self):
|
||||
if self.clear_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_potential_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
return self.battle_default()
|
||||
|
||||
def battle_4(self):
|
||||
boss = self.map.select(is_boss=True)
|
||||
if boss:
|
||||
if not self.check_accessibility(boss[0], fleet='boss'):
|
||||
return self.clear_roadblocks([road_main])
|
||||
if self.use_support_fleet:
|
||||
# at this stage the most right zone should be accessible
|
||||
self.goto(J6)
|
||||
self.air_strike(I8)
|
||||
return self.fleet_boss.clear_boss()
|
||||
if self.clear_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_potential_roadblocks([road_main]):
|
||||
return True
|
||||
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
|
||||
return True
|
||||
return self.battle_default()
|
||||
93
campaign/campaign_main/campaign_16_base_aircraft.py
Normal file
93
campaign/campaign_main/campaign_16_base_aircraft.py
Normal file
@@ -0,0 +1,93 @@
|
||||
from module.base.decorator import del_cached_property
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import red_overlay_transparency, get_color
|
||||
from module.handler.assets import MAP_AIR_STRIKE, STRATEGY_OPENED, AIR_STRIKE_CONFIRM
|
||||
from module.handler.strategy import AIR_STRIKE_OFFSET
|
||||
from module.logger import logger
|
||||
from module.map.utils import location_ensure
|
||||
|
||||
from .campaign_support_fleet import CampaignBase as CampaignBase_
|
||||
|
||||
|
||||
class Config:
|
||||
MAP_WALK_TURNING_OPTIMIZE = False
|
||||
MAP_HAS_MYSTERY = False
|
||||
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
||||
'height': (80, 255 - 33),
|
||||
'prominence': 10,
|
||||
'distance': 35,
|
||||
}
|
||||
HOMO_CANNY_THRESHOLD = (50, 100)
|
||||
|
||||
|
||||
class CampaignBase(CampaignBase_):
|
||||
MAP_AIR_STRIKE_OVERLAY_TRANSPARENCY_THRESHOLD = 0.35
|
||||
ENEMY_FILTER = '1L > 1M > 1E > 2L > 3L > 2M > 2E > 1C > 2C > 3M > 3E > 3C'
|
||||
|
||||
def _air_strike_appear(self):
|
||||
return red_overlay_transparency(MAP_AIR_STRIKE.color, get_color(self.device.image, MAP_AIR_STRIKE.area)) > \
|
||||
self.MAP_AIR_STRIKE_OVERLAY_TRANSPARENCY_THRESHOLD
|
||||
|
||||
def _air_strike(self, location):
|
||||
self.in_sight(location)
|
||||
attack_grid = self.convert_global_to_local(location)
|
||||
attack_grid.__str__ = location
|
||||
|
||||
logger.info('Select grid to air strike')
|
||||
skip_first_screenshot = True
|
||||
interval = Timer(5, count=10)
|
||||
for _ in self.loop(skip_first=skip_first_screenshot):
|
||||
# End
|
||||
if self.is_in_strategy_air_strike():
|
||||
self.view.update(image=self.device.image)
|
||||
del_cached_property(attack_grid, "image_trans")
|
||||
if attack_grid.predict_air_strike_icon():
|
||||
break
|
||||
# Click
|
||||
if interval.reached() and self.is_in_strategy_air_strike():
|
||||
self.device.click(attack_grid)
|
||||
interval.reset()
|
||||
continue
|
||||
|
||||
logger.info('Confirm air strike')
|
||||
skip_first_screenshot = True
|
||||
interval = Timer(3, count=6)
|
||||
MAP_AIR_STRIKE.load_color(self.device.image)
|
||||
for _ in self.loop(skip_first=skip_first_screenshot):
|
||||
if self._air_strike_appear():
|
||||
interval.reset()
|
||||
continue
|
||||
# End
|
||||
if self.appear(STRATEGY_OPENED, offset=AIR_STRIKE_OFFSET):
|
||||
break
|
||||
# Click
|
||||
if interval.reached() and self.is_in_strategy_air_strike():
|
||||
self.device.click(AIR_STRIKE_CONFIRM)
|
||||
interval.reset()
|
||||
continue
|
||||
|
||||
def air_strike(self, location):
|
||||
"""
|
||||
Open strategy, air strike on location, close strategy.
|
||||
|
||||
Air strike at location X = (x, y) will hit range [x-2, y-1, x+2, y] as follows:
|
||||
|
||||
OOOOO
|
||||
OOXOO
|
||||
|
||||
Args:
|
||||
location (typle, str, GridInfo): Location of air strike
|
||||
"""
|
||||
location = location_ensure(location)
|
||||
if self.map[location].is_land:
|
||||
logger.warning(f'Air strike location {location} is on land, will abandon attacking')
|
||||
return False
|
||||
self.strategy_open()
|
||||
if not self.strategy_has_air_strike():
|
||||
logger.warning(f'No remain air strike trials, will abandon attacking')
|
||||
self.strategy_close()
|
||||
return False
|
||||
self.strategy_air_strike_enter()
|
||||
self._air_strike(location)
|
||||
self.strategy_close(skip_first_screenshot=False)
|
||||
return True
|
||||
25
campaign/campaign_main/campaign_16_base_submarine.py
Normal file
25
campaign/campaign_main/campaign_16_base_submarine.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from module.logger import logger
|
||||
|
||||
from .campaign_support_fleet import CampaignBase as CampaignBase_
|
||||
|
||||
|
||||
class Config:
|
||||
MAP_WALK_TURNING_OPTIMIZE = False
|
||||
MAP_HAS_MYSTERY = False
|
||||
HOMO_EDGE_COLOR_RANGE = (0, 12)
|
||||
HOMO_EDGE_HOUGHLINES_THRESHOLD = 210
|
||||
|
||||
|
||||
class CampaignBase(CampaignBase_):
|
||||
ENEMY_FILTER = '1T > 1L > 1E > 1M > 2T > 2L > 2E > 2M > 3T > 3L > 3E > 3M'
|
||||
|
||||
def map_init(self, map_):
|
||||
if self.use_support_fleet:
|
||||
logger.hr(f'{self.FUNCTION_NAME_BASE}SUBMARINE', level=2)
|
||||
self.combat(balance_hp=False, emotion_reduce=False, save_get_items=False)
|
||||
super().map_init(map_)
|
||||
|
||||
def handle_submarine_support_popup(self):
|
||||
if self.use_support_fleet and self.handle_popup_confirm("SUBMARINE_SUPPORT"):
|
||||
return True
|
||||
return False
|
||||
28
campaign/campaign_main/campaign_support_fleet.py
Normal file
28
campaign/campaign_main/campaign_support_fleet.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from module.base.mask import Mask
|
||||
from module.campaign.campaign_base import CampaignBase as CampaignBase_
|
||||
from module.logger import logger
|
||||
from module.map.assets import FLEET_SUPPORT_EMPTY
|
||||
from module.map_detection.utils_assets import ASSETS
|
||||
|
||||
MASK_MAP_UI_SUPPORT = Mask(file='./assets/mask/MASK_MAP_UI_SUPPORT.png')
|
||||
|
||||
|
||||
class CampaignBase(CampaignBase_):
|
||||
use_support_fleet = True
|
||||
|
||||
def fleet_preparation(self):
|
||||
if self.appear(FLEET_SUPPORT_EMPTY, offset=(5, 5)):
|
||||
self.use_support_fleet = False
|
||||
logger.attr("use_support_fleet", self.use_support_fleet)
|
||||
super().fleet_preparation()
|
||||
|
||||
def _map_swipe(self, vector, box=(239, 159, 1175, 628)):
|
||||
# Left border to 239, avoid swiping on support fleet
|
||||
return super()._map_swipe(vector, box=box)
|
||||
|
||||
def map_data_init(self, map_):
|
||||
super().map_data_init(map_)
|
||||
if self.use_support_fleet:
|
||||
# Patch ui_mask, get rid of supporting fleet
|
||||
_ = ASSETS.ui_mask
|
||||
ASSETS.ui_mask = MASK_MAP_UI_SUPPORT.image
|
||||
Reference in New Issue
Block a user