From 87127c882a1c8cebefaede3557ed99ff36ffadaf Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Wed, 3 Jun 2020 23:11:31 +0800 Subject: [PATCH] Fix: Now able to use 1 or 2 fleets in chapter 2 to 6 - If using 1 fleet in 6-4, will pick up the ammo --- campaign/campaign_main/campaign_2_1.py | 8 ++++---- campaign/campaign_main/campaign_2_2.py | 4 ++-- campaign/campaign_main/campaign_2_3.py | 4 ++-- campaign/campaign_main/campaign_2_4.py | 4 ++-- campaign/campaign_main/campaign_3_1.py | 8 ++++---- campaign/campaign_main/campaign_3_2.py | 4 ++-- campaign/campaign_main/campaign_3_3.py | 4 ++-- campaign/campaign_main/campaign_3_4.py | 4 ++-- campaign/campaign_main/campaign_4_1.py | 8 ++++---- campaign/campaign_main/campaign_4_2.py | 4 ++-- campaign/campaign_main/campaign_4_3.py | 4 ++-- campaign/campaign_main/campaign_4_4.py | 4 ++-- campaign/campaign_main/campaign_5_1.py | 8 ++++---- campaign/campaign_main/campaign_5_2.py | 4 ++-- campaign/campaign_main/campaign_5_3.py | 4 ++-- campaign/campaign_main/campaign_5_4.py | 4 ++-- campaign/campaign_main/campaign_6_1.py | 6 +++--- campaign/campaign_main/campaign_6_2.py | 4 ++-- campaign/campaign_main/campaign_6_3.py | 4 ++-- campaign/campaign_main/campaign_6_4.py | 7 +++++-- module/config/argparser.py | 4 ++-- module/config/argparser_en.py | 4 ++-- module/config/config.py | 2 +- module/map/fleet.py | 16 ++++++++++++++-- 24 files changed, 71 insertions(+), 56 deletions(-) diff --git a/campaign/campaign_main/campaign_2_1.py b/campaign/campaign_main/campaign_2_1.py index 04950bd7f..f825deb13 100644 --- a/campaign/campaign_main/campaign_2_1.py +++ b/campaign/campaign_main/campaign_2_1.py @@ -32,8 +32,8 @@ A4, B4, C4, D4, E4, F4, \ class Config: - FLEET_2 = 0 - SUBMARINE = 0 + FLEET_BOSS = 1 + INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { 'height': (120, 255 - 40), 'width': (1.5, 10), @@ -59,7 +59,7 @@ class Campaign(CampaignBase): def battle_2(self): self.clear_all_mystery() - if not self.check_accessibility(D4): + if not self.check_accessibility(D4, fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_2_2.py b/campaign/campaign_main/campaign_2_2.py index 40b4a502d..25b44806e 100644 --- a/campaign/campaign_main/campaign_2_2.py +++ b/campaign/campaign_main/campaign_2_2.py @@ -48,7 +48,7 @@ class Campaign(CampaignBase): def battle_3(self): self.clear_all_mystery() - if not self.check_accessibility(D1): + if not self.check_accessibility(D1, fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_2_3.py b/campaign/campaign_main/campaign_2_3.py index e5458632f..69c90455e 100644 --- a/campaign/campaign_main/campaign_2_3.py +++ b/campaign/campaign_main/campaign_2_3.py @@ -48,7 +48,7 @@ class Campaign(CampaignBase): def battle_3(self): self.clear_all_mystery() - if not self.check_accessibility(E1): + if not self.check_accessibility(E1, fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_2_4.py b/campaign/campaign_main/campaign_2_4.py index f6f1fff85..785496dde 100644 --- a/campaign/campaign_main/campaign_2_4.py +++ b/campaign/campaign_main/campaign_2_4.py @@ -41,7 +41,7 @@ class Campaign(CampaignBase): return self.battle_default() def battle_3(self): - if not self.check_accessibility(G1): + if not self.check_accessibility(G1, fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_3_1.py b/campaign/campaign_main/campaign_3_1.py index 68f638cfc..29980b8b1 100644 --- a/campaign/campaign_main/campaign_3_1.py +++ b/campaign/campaign_main/campaign_3_1.py @@ -33,8 +33,8 @@ A4, B4, C4, D4, E4, F4, G4, \ class Config: - FLEET_2 = 0 - SUBMARINE = 0 + FLEET_BOSS = 1 + MAP_MYSTERY_HAS_CARRIER = True INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { 'height': (120, 255 - 40), @@ -61,7 +61,7 @@ class Campaign(CampaignBase): def battle_3(self): self.clear_all_mystery() - if not self.check_accessibility(G2): - return self.battle_default() + if not self.check_accessibility(G2, fleet='boss'): + return self.fleet_boss.battle_default() return self.clear_boss() diff --git a/campaign/campaign_main/campaign_3_2.py b/campaign/campaign_main/campaign_3_2.py index e14eb2697..7d35d6e33 100644 --- a/campaign/campaign_main/campaign_3_2.py +++ b/campaign/campaign_main/campaign_3_2.py @@ -45,7 +45,7 @@ class Campaign(CampaignBase): def battle_3(self): self.clear_all_mystery() - if not self.check_accessibility(H1): + if not self.check_accessibility(H1, fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_3_3.py b/campaign/campaign_main/campaign_3_3.py index 21b343f44..dbddd0c7f 100644 --- a/campaign/campaign_main/campaign_3_3.py +++ b/campaign/campaign_main/campaign_3_3.py @@ -47,7 +47,7 @@ class Campaign(CampaignBase): def battle_3(self): self.clear_all_mystery() - if not self.check_accessibility(A4): + if not self.check_accessibility(A4, fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_3_4.py b/campaign/campaign_main/campaign_3_4.py index 47a8c83e2..d1348f4a9 100644 --- a/campaign/campaign_main/campaign_3_4.py +++ b/campaign/campaign_main/campaign_3_4.py @@ -50,10 +50,10 @@ class Campaign(CampaignBase): return self.battle_default() def battle_3(self): - if not self.check_accessibility(H3): + if not self.check_accessibility(H3, fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() def handle_boss_appear_refocus(self): for data in self.map.spawn_data: diff --git a/campaign/campaign_main/campaign_4_1.py b/campaign/campaign_main/campaign_4_1.py index d325662e6..edf3f7f47 100644 --- a/campaign/campaign_main/campaign_4_1.py +++ b/campaign/campaign_main/campaign_4_1.py @@ -39,8 +39,8 @@ A6, B6, C6, D6, E6, F6, \ class Config: - FLEET_2 = 0 - SUBMARINE = 0 + FLEET_BOSS = 1 + MAP_MYSTERY_HAS_CARRIER = True INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { 'height': (120, 255 - 40), @@ -72,7 +72,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_4_2.py b/campaign/campaign_main/campaign_4_2.py index 419635618..8139fa6c2 100644 --- a/campaign/campaign_main/campaign_4_2.py +++ b/campaign/campaign_main/campaign_4_2.py @@ -58,7 +58,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_4_3.py b/campaign/campaign_main/campaign_4_3.py index de0c507f6..4d6ef8aa5 100644 --- a/campaign/campaign_main/campaign_4_3.py +++ b/campaign/campaign_main/campaign_4_3.py @@ -54,7 +54,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_4_4.py b/campaign/campaign_main/campaign_4_4.py index 6e1714e61..7c7389318 100644 --- a/campaign/campaign_main/campaign_4_4.py +++ b/campaign/campaign_main/campaign_4_4.py @@ -65,10 +65,10 @@ class Campaign(CampaignBase): def battle_4(self): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): if self.clear_roadblocks([road_main]): return True if self.clear_potential_roadblocks([road_main]): return True - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_5_1.py b/campaign/campaign_main/campaign_5_1.py index ada07b882..5c66dc724 100644 --- a/campaign/campaign_main/campaign_5_1.py +++ b/campaign/campaign_main/campaign_5_1.py @@ -41,9 +41,9 @@ A6, B6, C6, D6, E6, F6, G6, H6, \ class Config: - FLEET_2 = 0 - SUBMARINE = 0 + FLEET_BOSS = 1 MAP_MYSTERY_HAS_CARRIER = True + INTERNAL_LINES_FIND_PEAKS_PARAMETERS = { 'height': (120, 255 - 40), 'width': (1.5, 10), @@ -71,7 +71,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_5_2.py b/campaign/campaign_main/campaign_5_2.py index cd9e34a55..7a730f51c 100644 --- a/campaign/campaign_main/campaign_5_2.py +++ b/campaign/campaign_main/campaign_5_2.py @@ -51,7 +51,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_5_3.py b/campaign/campaign_main/campaign_5_3.py index 1cc464d0a..1911057c4 100644 --- a/campaign/campaign_main/campaign_5_3.py +++ b/campaign/campaign_main/campaign_5_3.py @@ -51,7 +51,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): return self.battle_default() - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_5_4.py b/campaign/campaign_main/campaign_5_4.py index b97e959d4..43c220b92 100644 --- a/campaign/campaign_main/campaign_5_4.py +++ b/campaign/campaign_main/campaign_5_4.py @@ -62,10 +62,10 @@ class Campaign(CampaignBase): def battle_4(self): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0]): + if not self.check_accessibility(boss[0], fleet='boss'): if self.clear_roadblocks([road_center]): return True if self.clear_potential_roadblocks([road_ring]): return True - return self.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_6_1.py b/campaign/campaign_main/campaign_6_1.py index 362dca4da..8d9bdaf36 100644 --- a/campaign/campaign_main/campaign_6_1.py +++ b/campaign/campaign_main/campaign_6_1.py @@ -42,7 +42,7 @@ road_mystery = RoadGrids([[C4, D5], D4, G2, [G1, H2]]) class Config: - SUBMARINE = 0 + FLEET_BOSS = 1 MAP_MYSTERY_HAS_CARRIER = True @@ -70,7 +70,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0], fleet=2): + if not self.check_accessibility(boss[0], fleet='boss'): return self.clear_roadblocks([road_boss]) - return self.fleet_2.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_6_2.py b/campaign/campaign_main/campaign_6_2.py index ca7093447..dc03fd34f 100644 --- a/campaign/campaign_main/campaign_6_2.py +++ b/campaign/campaign_main/campaign_6_2.py @@ -64,7 +64,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0], fleet=2): + if not self.check_accessibility(boss[0], fleet='boss'): return self.clear_roadblocks([road_boss]) - return self.fleet_2.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_6_3.py b/campaign/campaign_main/campaign_6_3.py index fab3c4e97..219643b60 100644 --- a/campaign/campaign_main/campaign_6_3.py +++ b/campaign/campaign_main/campaign_6_3.py @@ -77,7 +77,7 @@ class Campaign(CampaignBase): boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0], fleet=2): + if not self.check_accessibility(boss[0], fleet='boss'): return self.clear_roadblocks([road_boss]) - return self.fleet_2.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/campaign/campaign_main/campaign_6_4.py b/campaign/campaign_main/campaign_6_4.py index 8d56d61b6..fc99d9c1c 100644 --- a/campaign/campaign_main/campaign_6_4.py +++ b/campaign/campaign_main/campaign_6_4.py @@ -68,9 +68,12 @@ class Campaign(CampaignBase): def battle_5(self): self.clear_all_mystery() + if not self.config.FLEET_2: + self.pick_up_ammo() + boss = self.map.select(is_boss=True) if boss: - if not self.check_accessibility(boss[0], fleet=2): + if not self.check_accessibility(boss[0], fleet='boss'): return self.clear_roadblocks([road_boss]) - return self.fleet_2.clear_boss() + return self.fleet_boss.clear_boss() diff --git a/module/config/argparser.py b/module/config/argparser.py index f3baab998..209a620a5 100644 --- a/module/config/argparser.py +++ b/module/config/argparser.py @@ -141,12 +141,12 @@ def main(ini_name=''): f1.add_argument('--舰队步长1', default=default('--舰队步长1'), choices=['1', '2', '3', '4', '5', '6']) f2 = fleet.add_argument_group('BOSS队') - f2.add_argument('--舰队编号2', default=default('--舰队编号2'), choices=['1', '2', '3', '4', '5', '6']) + f2.add_argument('--舰队编号2', default=default('--舰队编号2'), choices=['不使用', '1', '2', '3', '4', '5', '6']) f2.add_argument('--舰队阵型2', default=default('--舰队阵型2'), choices=['单纵阵', '复纵阵', '轮形阵']) f2.add_argument('--舰队步长2', default=default('--舰队步长2'), choices=['1', '2', '3', '4', '5', '6']) f3 = fleet.add_argument_group('备用道中队') - f3.add_argument('--舰队编号3', default=default('--舰队编号3'), choices=['1', '2', '3', '4', '5', '6']) + f3.add_argument('--舰队编号3', default=default('--舰队编号3'), choices=['不使用', '1', '2', '3', '4', '5', '6']) f3.add_argument('--舰队阵型3', default=default('--舰队阵型3'), choices=['单纵阵', '复纵阵', '轮形阵']) f3.add_argument('--舰队步长3', default=default('--舰队步长3'), choices=['1', '2', '3', '4', '5', '6']) diff --git a/module/config/argparser_en.py b/module/config/argparser_en.py index ad53be009..86614c4ec 100644 --- a/module/config/argparser_en.py +++ b/module/config/argparser_en.py @@ -139,12 +139,12 @@ def main(ini_name=''): f1.add_argument('--fleet_step_1', default=default('--fleet_step_1'), choices=['1', '2', '3', '4', '5', '6'], help='In event map, fleet has limit on moving, so fleet_step is how far can a fleet goes in one operation, if map cleared, it will be ignored') f2 = fleet.add_argument_group('Boss Fleet') - f2.add_argument('--fleet_index_2', default=default('--fleet_index_2'), choices=['1', '2', '3', '4', '5', '6']) + f2.add_argument('--fleet_index_2', default=default('--fleet_index_2'), choices=['do_not_use', '1', '2', '3', '4', '5', '6']) f2.add_argument('--fleet_formation_2', default=default('--fleet_formation_2'), choices=['Line Ahead', 'Double Line', 'Diamond']) f2.add_argument('--fleet_step_2', default=default('--fleet_step_2'), choices=['1', '2', '3', '4', '5', '6'], help='In event map, fleet has limit on moving, so fleet_step is how far can a fleet goes in one operation, if map cleared, it will be ignored') f3 = fleet.add_argument_group('Alternate Mob Fleet') - f3.add_argument('--fleet_index_3', default=default('--fleet_index_3'), choices=['1', '2', '3', '4', '5', '6']) + f3.add_argument('--fleet_index_3', default=default('--fleet_index_3'), choices=['do_not_use', '1', '2', '3', '4', '5', '6']) f3.add_argument('--fleet_formation_3', default=default('--fleet_formation_3'), choices=['Line Ahead', 'Double Line', 'Diamond']) f3.add_argument('--fleet_step_3', default=default('--fleet_step_3'), choices=['1', '2', '3', '4', '5', '6'], help='In event map, fleet has limit on moving, so fleet_step is how far can a fleet goes in one operation, if map cleared, it will be ignored') diff --git a/module/config/config.py b/module/config/config.py index e4efe1db3..6760073f8 100644 --- a/module/config/config.py +++ b/module/config/config.py @@ -419,7 +419,7 @@ class AzurLaneConfig: self.ENABLE_FLEET_CONTROL = to_bool(option['enable_fleet_control']) self.ENABLE_MAP_FLEET_LOCK = to_bool(option['enable_map_fleet_lock']) for n in ['1', '2', '3']: - self.__setattr__(f'FLEET_{n}', int(option[f'fleet_index_{n}'])) + self.__setattr__(f'FLEET_{n}', int(option[f'fleet_index_{n}']) if to_bool(option[f'fleet_index_{n}']) else 0) self.__setattr__(f'FLEET_{n}_FORMATION', int(option[f'fleet_formation_{n}'].split('_')[1])) self.__setattr__(f'FLEET_{n}_STEP', int(option[f'fleet_step_{n}'])) self.COMBAT_AUTO_MODE = option['combat_auto_mode'] diff --git a/module/map/fleet.py b/module/map/fleet.py index c247afaa3..421cca48b 100644 --- a/module/map/fleet.py +++ b/module/map/fleet.py @@ -50,11 +50,18 @@ class Fleet(Camera, MapOperation, AmbushHandler): @property def fleet_boss(self): - if self.config.FLEET_BOSS == 2 and self.config.FLEET_2: + if self.config.FLEET_BOSS == 2 or self.config.FLEET_2: return self.fleet_2 else: return self.fleet_1 + @property + def fleet_boss_index(self): + if self.config.FLEET_BOSS == 2 or self.config.FLEET_2: + return 1 + else: + return 1 + @property def fleet_step(self): if not self.config.MAP_HAS_FLEET_STEP: @@ -410,13 +417,18 @@ class Fleet(Camera, MapOperation, AmbushHandler): """ Args: grid (Grid): - fleet (int): 1, 2 + fleet (int, str): 1, 2, 'boss' Returns: bool: If accessible. """ if fleet is None: return grid.is_accessible + if isinstance(fleet, str) and fleet.isdigit(): + fleet = int(fleet) + if fleet == 'boss': + fleet = self.fleet_boss_index + if fleet == self.fleet_current_index: return grid.is_accessible else: