feat(campaign): SP图、活动图3还有WalkStep

- 添加了SP图的配置文件
- 添加了活动图3的配置文件
- 修改了舰队行走错误处理逻辑
This commit is contained in:
POLAR me 2024-12-24 22:10:34 +08:00
parent 9c3bad0473
commit dcb7912e93
15 changed files with 696 additions and 5 deletions

View File

@ -451,7 +451,10 @@ class AzurLaneAutoScript:
from module.campaign.run import CampaignRun
CampaignRun(config=self.config, device=self.device).run(
name=self.config.Campaign_Name, folder=self.config.Campaign_Event, mode=self.config.Campaign_Mode)
def event3(self):
from module.campaign.run import CampaignRun
CampaignRun(config=self.config, device=self.device).run(
name=self.config.Campaign_Name, folder=self.config.Campaign_Event, mode=self.config.Campaign_Mode)
def raid(self):
from module.raid.run import RaidRun
RaidRun(config=self.config, device=self.device).run()

View File

@ -0,0 +1,119 @@
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('SP')
MAP.shape = 'I9'
MAP.camera_data = ['D2', 'D6', 'D7', 'F2', 'F6', 'F7']
MAP.camera_data_spawn_point = ['F6']
MAP.map_data = """
++ -- ME ++ ++ ++ ME -- ++
-- ME -- -- MB -- -- -- ME
-- -- -- -- -- -- ME -- ++
++ ME ++ ++ ++ ++ ++ -- --
++ -- ++ ++ ++ ++ ++ ME --
-- -- ++ ++ ++ SP SP -- --
ME -- -- -- -- __ __ -- MS
-- ME -- ++ ME -- ME MS --
++ -- ME ++ -- MS ++ -- ++
"""
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, 'siren': 2},
{'battle': 1, 'enemy': 1},
{'battle': 2, 'enemy': 2, 'siren': 1},
{'battle': 3, 'enemy': 1},
{'battle': 4, 'enemy': 2},
{'battle': 5, 'enemy': 1},
{'battle': 6},
{'battle': 7, '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:
# ===== Start of generated config =====
MAP_SIREN_TEMPLATE = []
MOVABLE_ENEMY_TURN = (2,)
MAP_HAS_SIREN = True
MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_MAP_STORY = False
MAP_HAS_FLEET_STEP = True
MAP_HAS_AMBUSH = False
MAP_HAS_MYSTERY = False
STAR_REQUIRE_1 = 0
STAR_REQUIRE_2 = 0
STAR_REQUIRE_3 = 0
# ===== End of generated config =====
STAGE_ENTRANCE = ['half', '20240725']
MAP_CHAPTER_SWITCH_20241219 = True
# MAP_HAS_MODE_SWITCH = True
MAP_HAS_MOVABLE_NORMAL_ENEMY = True
MAP_SIREN_HAS_BOSS_ICON_SMALL = True
MAP_ENSURE_EDGE_INSIGHT_CORNER = 'top'
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 75
EDGE_LINES_HOUGHLINES_THRESHOLD = 75
DETECTION_BACKEND = 'perspective'
MOVABLE_NORMAL_ENEMY_TURN = (2,)
MAP_SIREN_MOVE_WAIT = 0.7
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (80, 255 - 20),
'width': (0.9, 10),
'prominence': 10,
'distance': 35,
}
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 20, 255),
'prominence': 10,
'distance': 50,
# 'width': (0, 7),
'wlen': 1000
}
MAP_SWIPE_MULTIPLY = (1.087, 1.107)
MAP_SWIPE_MULTIPLY_MINITOUCH = (1.051, 1.070)
MAP_SWIPE_MULTIPLY_MAATOUCH = (1.020, 1.039)
class Campaign(CampaignBase):
MAP = MAP
ENEMY_FILTER = '1L > 1M > 1E > 1C > 2L > 2M > 2E > 2C > 3L > 3M > 3E > 3C'
def battle_0(self):
if self.clear_siren():
return True
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=2):
return True
return self.battle_default()
def battle_5(self):
if self.clear_siren():
return True
if self.clear_filter_enemy(self.ENEMY_FILTER, preserve=0):
return True
return self.battle_default()
def battle_7(self):
return self.fleet_boss.clear_boss()

View File

@ -578,6 +578,80 @@
"Storage": {}
}
},
"Event3": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "Event3",
"SuccessInterval": 0,
"FailureInterval": 120,
"ServerUpdate": "00:00"
},
"Campaign": {
"Name": "D3",
"Event": "campaign_main",
"Mode": "normal",
"UseClearMode": true,
"UseFleetLock": true,
"UseAutoSearch": true,
"Use2xBook": false,
"AmbushEvade": true
},
"StopCondition": {
"OilLimit": 1000,
"RunCount": 0,
"MapAchievement": "non_stop",
"StageIncrease": false,
"GetNewShip": false,
"ReachLevel": 0
},
"Fleet": {
"Fleet1": 1,
"Fleet1Formation": "double_line",
"Fleet1Mode": "combat_auto",
"Fleet1Step": 3,
"Fleet2": 2,
"Fleet2Formation": "double_line",
"Fleet2Mode": "combat_auto",
"Fleet2Step": 2,
"FleetOrder": "fleet1_mob_fleet2_boss"
},
"Submarine": {
"Fleet": 0,
"Mode": "do_not_use",
"AutoSearchMode": "sub_standby",
"DistanceToBoss": "2_grid_to_boss"
},
"Emotion": {
"Mode": "calculate",
"Fleet1Value": 119,
"Fleet1Record": "2020-01-01 00:00:00",
"Fleet1Control": "prevent_yellow_face",
"Fleet1Recover": "not_in_dormitory",
"Fleet1Oath": false,
"Fleet2Value": 119,
"Fleet2Record": "2020-01-01 00:00:00",
"Fleet2Control": "prevent_yellow_face",
"Fleet2Recover": "not_in_dormitory",
"Fleet2Oath": false
},
"HpControl": {
"UseHpBalance": false,
"UseEmergencyRepair": false,
"UseLowHpRetreat": false,
"HpBalanceThreshold": 0.2,
"HpBalanceWeight": "1000, 1000, 1000",
"RepairUseSingleThreshold": 0.3,
"RepairUseMultiThreshold": 0.6,
"LowHpRetreatThreshold": 0.3
},
"EnemyPriority": {
"EnemyScaleBalanceWeight": "default_mode"
},
"Storage": {
"Storage": {}
}
},
"Raid": {
"Scheduler": {
"Enable": false,

View File

@ -103,6 +103,7 @@ class CampaignEvent(CampaignStatus):
tasks = [
'Event',
'Event2',
'Event3',
'Raid',
'GemsFarming',
]

View File

@ -171,6 +171,7 @@ class CampaignStatus(UI):
tasks = [
'Event',
'Event2',
'Event3',
'Raid',
'Coalition',
'GemsFarming',

View File

@ -3069,6 +3069,463 @@
}
}
},
"Event3": {
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false,
"option": [
true,
false
]
},
"NextRun": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime"
},
"Command": {
"type": "input",
"value": "Event3",
"display": "hide"
},
"SuccessInterval": {
"type": "input",
"value": 0,
"display": "hide"
},
"FailureInterval": {
"type": "input",
"value": 120,
"display": "hide"
},
"ServerUpdate": {
"type": "input",
"value": "00:00",
"display": "hide"
}
},
"Campaign": {
"Name": {
"type": "input",
"value": "12-4"
},
"Event": {
"type": "state",
"value": "campaign_main",
"option": [
"event_20200227_cn",
"event_20200312_cn",
"event_20200326_cn",
"event_20200423_cn",
"event_20200507_cn",
"event_20200521_cn",
"event_20200521_en",
"event_20200603_cn",
"event_20200603_en",
"event_20200611_en",
"event_20200716_en",
"event_20200723_cn",
"event_20200806_cn",
"event_20200820_cn",
"event_20200903_en",
"event_20200917_cn",
"event_20201002_en",
"event_20201012_cn",
"event_20201029_cn",
"event_20201126_cn",
"event_20201229_cn",
"event_20210121_cn",
"event_20210225_cn",
"event_20210225_tw",
"event_20210325_cn",
"event_20210415_tw",
"event_20210422_cn",
"event_20210429_tw",
"event_20210527_cn",
"event_20210527_tw",
"event_20210610_tw",
"event_20210624_cn",
"event_20210624_tw",
"event_20210722_cn",
"event_20210819_cn",
"event_20210916_cn",
"event_20211028_cn",
"event_20211028_tw",
"event_20211111_cn",
"event_20211125_cn",
"event_20211229_cn",
"event_20220210_cn",
"event_20220224_cn",
"event_20220310_tw",
"event_20220324_cn",
"event_20220407_tw",
"event_20220414_cn",
"event_20220428_cn",
"event_20220526_cn",
"event_20220728_cn",
"event_20220818_cn",
"event_20220915_cn",
"event_20221124_cn",
"event_20221222_cn",
"event_20230223_cn",
"event_20230525_cn",
"event_20230803_cn",
"event_20230817_cn",
"event_20230914_cn",
"event_20231026_cn",
"event_20231123_cn",
"event_20231221_cn",
"event_20240229_cn",
"event_20240425_cn",
"event_20240521_cn",
"event_20240725_cn",
"event_20240815_cn",
"event_20240829_cn",
"event_20240912_cn",
"event_20241024_cn",
"event_20241121_cn",
"event_20241219_cn"
],
"option_bold": [
"event_20231221_cn",
"event_20241219_cn"
],
"cn": "event_20241219_cn",
"en": "event_20241219_cn",
"jp": "event_20241219_cn",
"tw": "event_20231221_cn"
},
"Mode": {
"type": "select",
"value": "normal",
"option": [
"normal",
"hard"
],
"display": "hide"
},
"UseClearMode": {
"type": "checkbox",
"value": true
},
"UseFleetLock": {
"type": "checkbox",
"value": true
},
"UseAutoSearch": {
"type": "checkbox",
"value": true
},
"Use2xBook": {
"type": "checkbox",
"value": false
},
"AmbushEvade": {
"type": "checkbox",
"value": true,
"display": "hide"
}
},
"StopCondition": {
"OilLimit": {
"type": "input",
"value": 1000
},
"RunCount": {
"type": "input",
"value": 0
},
"MapAchievement": {
"type": "select",
"value": "non_stop",
"option": [
"non_stop",
"100_percent_clear",
"map_3_stars",
"threat_safe",
"threat_safe_without_3_stars"
]
},
"StageIncrease": {
"type": "checkbox",
"value": false
},
"GetNewShip": {
"type": "checkbox",
"value": false
},
"ReachLevel": {
"type": "input",
"value": 0
}
},
"Fleet": {
"Fleet1": {
"type": "select",
"value": 1,
"option": [
1,
2,
3,
4,
5,
6
]
},
"Fleet1Formation": {
"type": "select",
"value": "double_line",
"option": [
"line_ahead",
"double_line",
"diamond"
]
},
"Fleet1Mode": {
"type": "select",
"value": "combat_auto",
"option": [
"combat_auto",
"combat_manual",
"stand_still_in_the_middle",
"hide_in_bottom_left"
]
},
"Fleet1Step": {
"type": "select",
"value": 3,
"option": [
2,
3,
4,
5
]
},
"Fleet2": {
"type": "select",
"value": 2,
"option": [
0,
1,
2,
3,
4,
5,
6
]
},
"Fleet2Formation": {
"type": "select",
"value": "double_line",
"option": [
"line_ahead",
"double_line",
"diamond"
]
},
"Fleet2Mode": {
"type": "select",
"value": "combat_auto",
"option": [
"combat_auto",
"combat_manual",
"stand_still_in_the_middle",
"hide_in_bottom_left"
]
},
"Fleet2Step": {
"type": "select",
"value": 2,
"option": [
2,
3,
4,
5
]
},
"FleetOrder": {
"type": "select",
"value": "fleet1_mob_fleet2_boss",
"option": [
"fleet1_mob_fleet2_boss",
"fleet1_boss_fleet2_mob",
"fleet1_all_fleet2_standby",
"fleet1_standby_fleet2_all"
]
}
},
"Submarine": {
"Fleet": {
"type": "select",
"value": 0,
"option": [
0,
1,
2
]
},
"Mode": {
"type": "select",
"value": "do_not_use",
"option": [
"do_not_use",
"hunt_only",
"boss_only",
"hunt_and_boss",
"every_combat"
]
},
"AutoSearchMode": {
"type": "select",
"value": "sub_standby",
"option": [
"sub_standby",
"sub_auto_call"
]
},
"DistanceToBoss": {
"type": "select",
"value": "2_grid_to_boss",
"option": [
"to_boss_position",
"1_grid_to_boss",
"2_grid_to_boss",
"use_open_ocean_support"
]
}
},
"Emotion": {
"Mode": {
"type": "select",
"value": "calculate",
"option": [
"calculate",
"ignore",
"calculate_ignore"
]
},
"Fleet1Value": {
"type": "input",
"value": 119
},
"Fleet1Record": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime",
"display": "disabled"
},
"Fleet1Control": {
"type": "select",
"value": "prevent_yellow_face",
"option": [
"keep_exp_bonus",
"prevent_green_face",
"prevent_yellow_face",
"prevent_red_face"
]
},
"Fleet1Recover": {
"type": "select",
"value": "not_in_dormitory",
"option": [
"not_in_dormitory",
"dormitory_floor_1",
"dormitory_floor_2"
]
},
"Fleet1Oath": {
"type": "checkbox",
"value": false
},
"Fleet2Value": {
"type": "input",
"value": 119
},
"Fleet2Record": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime",
"display": "disabled"
},
"Fleet2Control": {
"type": "select",
"value": "prevent_yellow_face",
"option": [
"keep_exp_bonus",
"prevent_green_face",
"prevent_yellow_face",
"prevent_red_face"
]
},
"Fleet2Recover": {
"type": "select",
"value": "not_in_dormitory",
"option": [
"not_in_dormitory",
"dormitory_floor_1",
"dormitory_floor_2"
]
},
"Fleet2Oath": {
"type": "checkbox",
"value": false
}
},
"HpControl": {
"UseHpBalance": {
"type": "checkbox",
"value": false
},
"UseEmergencyRepair": {
"type": "checkbox",
"value": false
},
"UseLowHpRetreat": {
"type": "checkbox",
"value": false
},
"HpBalanceThreshold": {
"type": "input",
"value": 0.2
},
"HpBalanceWeight": {
"type": "input",
"value": "1000, 1000, 1000"
},
"RepairUseSingleThreshold": {
"type": "input",
"value": 0.3
},
"RepairUseMultiThreshold": {
"type": "input",
"value": 0.6
},
"LowHpRetreatThreshold": {
"type": "input",
"value": 0.3
}
},
"EnemyPriority": {
"EnemyScaleBalanceWeight": {
"type": "select",
"value": "default_mode",
"option": [
"default_mode",
"S3_enemy_first",
"S1_enemy_first"
]
}
},
"Storage": {
"Storage": {
"type": "storage",
"value": {},
"valuetype": "ignore",
"display": "disabled"
}
}
},
"Raid": {
"Scheduler": {
"Enable": {

View File

@ -25,6 +25,7 @@
"EventGeneral",
"Event",
"Event2",
"Event3",
"Raid",
"Coalition",
"MaritimeEscort",

View File

@ -61,6 +61,12 @@ Event2:
Event:
type: state
AmbushEvade: true
Event3:
Campaign:
Mode: normal
Event:
type: state
AmbushEvade: true
EventA:
Scheduler:
SuccessInterval: 30

View File

@ -90,6 +90,15 @@ Event:
- Emotion
- HpControl
- EnemyPriority
Event3:
- Scheduler
- Campaign
- StopCondition
- Fleet
- Submarine
- Emotion
- HpControl
- EnemyPriority
Raid:
- Scheduler
- Raid

View File

@ -23,7 +23,7 @@ class ManualConfig:
> Daily > Hard > OpsiAshBeacon > OpsiAshAssist > OpsiMonthBoss
> Sos > EventSp > EventA > EventB > EventC > EventD
> RaidDaily > CoalitionSp > WarArchives > MaritimeEscort
> Event > Event2 > Raid > Coalition > Main > Main2 > Main3
> Event > Event2 > Event3 > Raid > Coalition > Main > Main2 > Main3
> OpsiMeowfficerFarming
> GemsFarming
> OpsiHazard1Leveling

View File

@ -30,7 +30,7 @@ ARCHIVES_PREFIX = {
'tw': '檔案 '
}
MAINS = ['Main', 'Main2', 'Main3']
EVENTS = ['Event', 'Event2', 'EventA', 'EventB', 'EventC', 'EventD', 'EventSp']
EVENTS = ['Event', 'Event2', 'Event3', 'EventA', 'EventB', 'EventC', 'EventD', 'EventSp']
GEMS_FARMINGS = ['GemsFarming']
RAIDS = ['Raid', 'RaidDaily']
WAR_ARCHIVES = ['WarArchives']

View File

@ -74,6 +74,10 @@
"name": "Event-2",
"help": ""
},
"Event3": {
"name": "Event-3",
"help": ""
},
"Raid": {
"name": "Raid",
"help": ""

View File

@ -74,6 +74,10 @@
"name": "イベント海域-2",
"help": ""
},
"Event3": {
"name": "イベント海域-3",
"help": ""
},
"Raid": {
"name": "Raid",
"help": ""

View File

@ -74,6 +74,10 @@
"name": "活动图-2",
"help": ""
},
"Event3": {
"name": "活动图-3",
"help": ""
},
"Raid": {
"name": "共斗活动",
"help": ""

View File

@ -20,7 +20,7 @@ class Fleet(Camera, AmbushHandler):
siren_count = 0
fleet_ammo = 5
ammo_count = 3
walk_error_count = 0
@property
def fleet_1(self):
if self.fleet_current_index != 1:
@ -376,7 +376,15 @@ class Fleet(Camera, AmbushHandler):
continue
if self.handle_walk_out_of_step():
raise MapWalkError('walk_out_of_step')
logger.warning('handle_walk_out_of_step')
self.walk_error_count += 1
if self.walk_error_count >=5:
self.walk_error_count = 0
raise MapWalkError('walk_out_of_step')
else:
logger.warning(f'handle_walk_out_of_step: retry{self.walk_error_count}')
continue
# raise MapWalkError('walk_out_of_step')
# Arrive
arrive_predict = ''