1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 06:39:25 +08:00

Add: Raid Scuttle function

This commit is contained in:
guoh064
2026-02-19 23:09:49 +08:00
committed by 0O0o0oOoO00
parent f5172b27f1
commit 9b98060c4d
19 changed files with 958 additions and 3 deletions

View File

@@ -931,6 +931,11 @@ class AzurLaneAutoScript(AzurLaneAutoScript):
from module.shop_event.shop_event import EventShop
EventShop(config=self.config, device=self.device).run()
@disable_all_crack
def raid_scuttle(self):
from module.raid.scuttle import RaidScuttleRun
RaidScuttleRun(config=self.config, device=self.device).run()
def hook_op(self):
op = self.config.full_config.HookOp_HookOp_Operation
if op == "detect":

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -1288,6 +1288,74 @@
"Storage": {}
}
},
"RaidScuttle": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "RaidScuttle",
"SuccessInterval": 0,
"FailureInterval": 120,
"ServerUpdate": "00:00"
},
"RaidScuttle": {
"Sacrifice": "vanguard"
},
"Raid": {
"Mode": "hard",
"UseTicket": false
},
"Campaign": {
"Name": "dynamic",
"Event": "campaign_main",
"Mode": "normal",
"UseClearMode": true,
"UseFleetLock": true,
"UseAutoSearch": false,
"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_manual",
"Fleet1Step": 3,
"Fleet2": 2,
"Fleet2Formation": "double_line",
"Fleet2Mode": "combat_auto",
"Fleet2Step": 3,
"FleetOrder": "fleet1_all_fleet2_standby"
},
"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
},
"Storage": {
"Storage": {}
}
},
"Hospital": {
"Scheduler": {
"Enable": false,

View File

@@ -8884,6 +8884,450 @@
}
}
},
"RaidScuttle": {
"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": "RaidScuttle",
"display": "hide"
},
"SuccessInterval": {
"type": "input",
"value": 0,
"display": "hide"
},
"FailureInterval": {
"type": "input",
"value": 120,
"display": "hide"
},
"ServerUpdate": {
"type": "input",
"value": "00:00",
"display": "hide"
}
},
"RaidScuttle": {
"Sacrifice": {
"type": "select",
"value": "vanguard",
"option": [
"vanguard",
"flagship"
]
}
},
"Raid": {
"Mode": {
"type": "select",
"value": "hard",
"option": [
"easy",
"normal",
"hard",
"ex"
]
},
"UseTicket": {
"type": "checkbox",
"value": false
}
},
"Campaign": {
"Name": {
"type": "input",
"value": "dynamic",
"display": "hide"
},
"Event": {
"type": "state",
"value": "campaign_main",
"option": [
"raid_20200624",
"raid_20210708",
"raid_20220127",
"raid_20220630",
"raid_20221027",
"raid_20230118",
"raid_20230629",
"raid_20240130",
"raid_20240328",
"raid_20250116",
"raid_20260212"
],
"option_cn": [
"raid_20260212",
"raid_20240328",
"raid_20250116",
"raid_20240130",
"raid_20230629",
"raid_20230118",
"raid_20221027",
"raid_20220630",
"raid_20220127",
"raid_20210708",
"raid_20200624"
],
"option_en": [
"raid_20260212",
"raid_20240328",
"raid_20250116",
"raid_20240130",
"raid_20230629",
"raid_20230118",
"raid_20221027",
"raid_20220630",
"raid_20220127",
"raid_20210708",
"raid_20200624"
],
"option_jp": [
"raid_20260212",
"raid_20240328",
"raid_20250116",
"raid_20240130",
"raid_20230629",
"raid_20230118",
"raid_20221027",
"raid_20220630",
"raid_20220127",
"raid_20210708",
"raid_20200624"
],
"option_tw": [
"raid_20260212",
"raid_20250116",
"raid_20240130",
"raid_20240328",
"raid_20230629",
"raid_20230118",
"raid_20221027",
"raid_20220630",
"raid_20220127",
"raid_20210708",
"raid_20200624"
]
},
"Mode": {
"type": "select",
"value": "normal",
"option": [
"normal",
"hard"
],
"display": "hide"
},
"UseClearMode": {
"type": "checkbox",
"value": true,
"display": "hide"
},
"UseFleetLock": {
"type": "checkbox",
"value": true,
"display": "hide"
},
"UseAutoSearch": {
"type": "checkbox",
"value": false,
"display": "hide"
},
"Use2xBook": {
"type": "checkbox",
"value": false,
"display": "hide"
},
"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"
],
"display": "hide"
},
"StageIncrease": {
"type": "checkbox",
"value": false,
"display": "hide"
},
"GetNewShip": {
"type": "checkbox",
"value": false,
"display": "hide"
},
"ReachLevel": {
"type": "input",
"value": 0,
"display": "hide"
}
},
"Fleet": {
"Fleet1": {
"type": "select",
"value": 1,
"option": [
1,
2,
3,
4,
5,
6
],
"display": "hide"
},
"Fleet1Formation": {
"type": "select",
"value": "double_line",
"option": [
"line_ahead",
"double_line",
"diamond"
],
"display": "hide"
},
"Fleet1Mode": {
"type": "select",
"value": "combat_manual",
"option": [
"combat_manual",
"stand_still_in_the_middle",
"hide_in_bottom_left",
"hide_in_upper_left"
],
"display": "display"
},
"Fleet1Step": {
"type": "select",
"value": 3,
"option": [
2,
3,
4,
5
],
"display": "hide"
},
"Fleet2": {
"type": "select",
"value": 2,
"option": [
0,
1,
2,
3,
4,
5,
6
],
"display": "hide"
},
"Fleet2Formation": {
"type": "select",
"value": "double_line",
"option": [
"line_ahead",
"double_line",
"diamond"
],
"display": "hide"
},
"Fleet2Mode": {
"type": "select",
"value": "combat_auto",
"option": [
"combat_auto",
"combat_manual",
"stand_still_in_the_middle",
"hide_in_bottom_left"
],
"display": "hide"
},
"Fleet2Step": {
"type": "select",
"value": 3,
"option": [
2,
3,
4,
5
],
"display": "hide"
},
"FleetOrder": {
"type": "select",
"value": "fleet1_all_fleet2_standby",
"option": [
"fleet1_mob_fleet2_boss",
"fleet1_boss_fleet2_mob",
"fleet1_all_fleet2_standby",
"fleet1_standby_fleet2_all"
],
"display": "hide"
}
},
"Submarine": {
"Fleet": {
"type": "select",
"value": 0,
"option": [
0,
1,
2
]
},
"Mode": {
"type": "select",
"value": "do_not_use",
"option": [
"do_not_use",
"every_combat"
],
"display": "display"
},
"AutoSearchMode": {
"type": "select",
"value": "sub_standby",
"option": [
"sub_standby",
"sub_auto_call"
],
"display": "hide"
},
"DistanceToBoss": {
"type": "select",
"value": "2_grid_to_boss",
"option": [
"to_boss_position",
"1_grid_to_boss",
"2_grid_to_boss",
"use_open_ocean_support"
],
"display": "hide"
}
},
"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"
],
"display": "hide"
},
"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,
"display": "hide"
},
"Fleet2Record": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime",
"display": "hide"
},
"Fleet2Control": {
"type": "select",
"value": "prevent_yellow_face",
"option": [
"keep_exp_bonus",
"prevent_green_face",
"prevent_yellow_face",
"prevent_red_face"
],
"display": "hide"
},
"Fleet2Recover": {
"type": "select",
"value": "not_in_dormitory",
"option": [
"not_in_dormitory",
"dormitory_floor_1",
"dormitory_floor_2"
],
"display": "hide"
},
"Fleet2Oath": {
"type": "checkbox",
"value": false,
"display": "hide"
}
},
"Storage": {
"Storage": {
"type": "storage",
"value": {},
"valuetype": "ignore",
"display": "disabled"
}
}
},
"Hospital": {
"Scheduler": {
"Enable": {

View File

@@ -1051,4 +1051,11 @@ EventShop:
> DR > PR
> AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1
> CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4
> ShipSSR
> ShipSSR
# ==================== RaidScuttle ======================
RaidScuttle:
Sacrifice:
value: vanguard
option: [ vanguard, flagship ]

View File

@@ -42,6 +42,7 @@
"Event5",
"Event6",
"Raid",
"RaidScuttle",
"Hospital",
"Coalition",
"MaritimeEscort",

View File

@@ -483,4 +483,50 @@ EventShop:
Scheduler:
SuccessInterval: 30
FailureInterval: 30
ServerUpdate: 00:00
ServerUpdate: 00:00
# ==================== RaidScuttle ======================
RaidScuttle:
Campaign:
Name: dynamic
Event:
type: state
Mode: normal
UseClearMode: true
UseFleetLock: true
UseAutoSearch: false
Use2xBook: false
AmbushEvade: true
StopCondition:
MapAchievement: non_stop
StageIncrease: false
GetNewShip: false
ReachLevel: 0
Fleet:
Fleet1: 1
Fleet1Formation: double_line
Fleet1Mode:
display: display
value: combat_manual
option: [ combat_manual, stand_still_in_the_middle, hide_in_bottom_left, hide_in_upper_left ]
Fleet1Step: 3
Fleet2: 2
Fleet2Formation: double_line
Fleet2Mode: combat_auto
Fleet2Step: 3
FleetOrder: fleet1_all_fleet2_standby
Submarine:
Mode:
display: display
value: do_not_use
option: [ do_not_use, every_combat ]
AutoSearchMode: sub_standby
DistanceToBoss: 2_grid_to_boss
Emotion:
Fleet1Control: prevent_yellow_face
Fleet2Value: 119
Fleet2Record: 2020-01-01 00:00:00
Fleet2Control: prevent_yellow_face
Fleet2Recover: not_in_dormitory
Fleet2Oath: false

View File

@@ -183,6 +183,15 @@ Event:
- Campaign
- StopCondition
- Emotion
RaidScuttle:
- Scheduler
- RaidScuttle
- Raid
- Campaign
- StopCondition
- Fleet
- Submarine
- Emotion
Hospital:
- Scheduler
- Hospital

View File

@@ -669,5 +669,8 @@ class GeneratedConfig:
EventShop_PresetFilter = 'all' # all, custom
EventShop_CustomFilter = 'EquipUR > EquipSSR > Cube > GachaTicket\n> Array > Chip > CatT3 \n> Meta > SkinBox\n> Oil > Coin > Medal > ExpBookT1 > FoodT1\n> DR > PR\n> AugmentCore > AugmentEnhanceT2 > AugmentChangeT2 > AugmentChangeT1\n> CatT2 > CatT1 > PlateGeneralT3 > PlateT3 > BoxT4\n> ShipSSR'
# Group `RaidScuttle`
RaidScuttle_Sacrifice = 'vanguard' # vanguard, flagship
# Group `Storage`
Storage_Storage = {}

View File

@@ -399,7 +399,7 @@ class ManualConfig(ManualConfig):
> Sos > EventSp > EventA > EventB > EventC > EventD
> RaidDaily > CoalitionSp > WarArchives > MaritimeEscort
> Event > Event2 > Event3 > Event4 > Event5 > Event6
> Raid > Hospital > Coalition
> Raid > RaidScuttle > Hospital > Coalition
> Main > Main2 > Main3 > Main4 > Main5 > Main6
> OpsiMeowfficerFarming
> GemsFarming

View File

@@ -898,6 +898,7 @@ class FullGeneratedConfig:
MAINS += ['Main4', 'Main5', 'Main6']
EVENTS += ['Event3', 'Event4', 'Event5', 'Event6']
RAIDS += ['RaidScuttle']
class ConfigGenerator(ConfigGenerator):

View File

@@ -964,6 +964,56 @@ class FullGeneratedConfig:
Raid_Emotion_Fleet2Oath = None
Raid_Storage_Storage = None
# Task `RaidScuttle`
RaidScuttle_Scheduler_Enable = None
RaidScuttle_Scheduler_NextRun = None
RaidScuttle_Scheduler_Command = None
RaidScuttle_Scheduler_SuccessInterval = None
RaidScuttle_Scheduler_FailureInterval = None
RaidScuttle_Scheduler_ServerUpdate = None
RaidScuttle_RaidScuttle_Sacrifice = None
RaidScuttle_Raid_Mode = None
RaidScuttle_Raid_UseTicket = None
RaidScuttle_Campaign_Name = None
RaidScuttle_Campaign_Event = None
RaidScuttle_Campaign_Mode = None
RaidScuttle_Campaign_UseClearMode = None
RaidScuttle_Campaign_UseFleetLock = None
RaidScuttle_Campaign_UseAutoSearch = None
RaidScuttle_Campaign_Use2xBook = None
RaidScuttle_Campaign_AmbushEvade = None
RaidScuttle_StopCondition_OilLimit = None
RaidScuttle_StopCondition_RunCount = None
RaidScuttle_StopCondition_MapAchievement = None
RaidScuttle_StopCondition_StageIncrease = None
RaidScuttle_StopCondition_GetNewShip = None
RaidScuttle_StopCondition_ReachLevel = None
RaidScuttle_Fleet_Fleet1 = None
RaidScuttle_Fleet_Fleet1Formation = None
RaidScuttle_Fleet_Fleet1Mode = None
RaidScuttle_Fleet_Fleet1Step = None
RaidScuttle_Fleet_Fleet2 = None
RaidScuttle_Fleet_Fleet2Formation = None
RaidScuttle_Fleet_Fleet2Mode = None
RaidScuttle_Fleet_Fleet2Step = None
RaidScuttle_Fleet_FleetOrder = None
RaidScuttle_Submarine_Fleet = None
RaidScuttle_Submarine_Mode = None
RaidScuttle_Submarine_AutoSearchMode = None
RaidScuttle_Submarine_DistanceToBoss = None
RaidScuttle_Emotion_Mode = None
RaidScuttle_Emotion_Fleet1Value = None
RaidScuttle_Emotion_Fleet1Record = None
RaidScuttle_Emotion_Fleet1Control = None
RaidScuttle_Emotion_Fleet1Recover = None
RaidScuttle_Emotion_Fleet1Oath = None
RaidScuttle_Emotion_Fleet2Value = None
RaidScuttle_Emotion_Fleet2Record = None
RaidScuttle_Emotion_Fleet2Control = None
RaidScuttle_Emotion_Fleet2Recover = None
RaidScuttle_Emotion_Fleet2Oath = None
RaidScuttle_Storage_Storage = None
# Task `Hospital`
Hospital_Scheduler_Enable = None
Hospital_Scheduler_NextRun = None

View File

@@ -122,6 +122,10 @@
"name": "Raid",
"help": ""
},
"RaidScuttle": {
"name": "Task.RaidScuttle.name",
"help": "Task.RaidScuttle.help"
},
"Hospital": {
"name": "Valley Hospital",
"help": ""
@@ -3602,6 +3606,18 @@
"help": "To use your own filter, set \"Event Shop Filter\" to \"Custom\". All options have been defined at <https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/filter_string_en>"
}
},
"RaidScuttle": {
"_info": {
"name": "RaidScuttle._info.name",
"help": "RaidScuttle._info.help"
},
"Sacrifice": {
"name": "RaidScuttle.Sacrifice.name",
"help": "RaidScuttle.Sacrifice.help",
"vanguard": "vanguard",
"flagship": "flagship"
}
},
"Storage": {
"_info": {
"name": "Task status",

View File

@@ -122,6 +122,10 @@
"name": "Raid",
"help": ""
},
"RaidScuttle": {
"name": "Task.RaidScuttle.name",
"help": "Task.RaidScuttle.help"
},
"Hospital": {
"name": "病院探訪",
"help": ""
@@ -3602,6 +3606,18 @@
"help": "EventShop.CustomFilter.help"
}
},
"RaidScuttle": {
"_info": {
"name": "RaidScuttle._info.name",
"help": "RaidScuttle._info.help"
},
"Sacrifice": {
"name": "RaidScuttle.Sacrifice.name",
"help": "RaidScuttle.Sacrifice.help",
"vanguard": "vanguard",
"flagship": "flagship"
}
},
"Storage": {
"_info": {
"name": "Storage._info.name",

View File

@@ -122,6 +122,10 @@
"name": "共斗活动",
"help": ""
},
"RaidScuttle": {
"name": "共斗沉船",
"help": ""
},
"Hospital": {
"name": "深谷来信",
"help": ""
@@ -3602,6 +3606,18 @@
"help": "使用自定义过滤器需将“活动商店过滤器”设置为“自定义”,并阅读 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/filter_string_cn"
}
},
"RaidScuttle": {
"_info": {
"name": "共斗沉船",
"help": ""
},
"Sacrifice": {
"name": "牺牲船位置",
"help": "",
"vanguard": "前排",
"flagship": "旗舰"
}
},
"Storage": {
"_info": {
"name": "任务状态",

View File

@@ -122,6 +122,10 @@
"name": "共鬥活動",
"help": ""
},
"RaidScuttle": {
"name": "Task.RaidScuttle.name",
"help": "Task.RaidScuttle.help"
},
"Hospital": {
"name": "深谷来信",
"help": ""
@@ -3602,6 +3606,18 @@
"help": "使用自定義過濾器需將 \"活動商店過濾器\" 設定為 \"自定義過濾器\",並閱讀 https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/filter_string_cn"
}
},
"RaidScuttle": {
"_info": {
"name": "RaidScuttle._info.name",
"help": "RaidScuttle._info.help"
},
"Sacrifice": {
"name": "RaidScuttle.Sacrifice.name",
"help": "RaidScuttle.Sacrifice.help",
"vanguard": "vanguard",
"flagship": "flagship"
}
},
"Storage": {
"_info": {
"name": "任務狀態",

8
module/raid/my_assets.py Normal file
View File

@@ -0,0 +1,8 @@
from module.base.button import Button
from module.base.template import Template
# This file was automatically generated by dev_tools/button_extract.py.
# Don't modify it manually.
my_RAID_FLEET_FLAGSHIP = Button(area={'cn': (402, 168, 462, 228), 'en': (402, 168, 462, 228), 'jp': (402, 168, 462, 228), 'tw': (402, 168, 462, 228)}, color={'cn': (73, 61, 55), 'en': (73, 61, 55), 'jp': (73, 61, 55), 'tw': (73, 61, 55)}, button={'cn': (402, 168, 462, 228), 'en': (402, 168, 462, 228), 'jp': (402, 168, 462, 228), 'tw': (402, 168, 462, 228)}, file={'cn': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png', 'en': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png', 'jp': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png', 'tw': './assets/cn/raid/my_RAID_FLEET_FLAGSHIP.png'})
my_RAID_FLEET_VANGUARD = Button(area={'cn': (718, 168, 778, 228), 'en': (718, 168, 778, 228), 'jp': (718, 168, 778, 228), 'tw': (718, 168, 778, 228)}, color={'cn': (51, 50, 54), 'en': (51, 50, 54), 'jp': (51, 50, 54), 'tw': (51, 50, 54)}, button={'cn': (718, 168, 778, 228), 'en': (718, 168, 778, 228), 'jp': (718, 168, 778, 228), 'tw': (718, 168, 778, 228)}, file={'cn': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png', 'en': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png', 'jp': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png', 'tw': './assets/cn/raid/my_RAID_FLEET_VANGUARD.png'})

249
module/raid/scuttle.py Normal file
View File

@@ -0,0 +1,249 @@
from module.combat.assets import OPTS_INFO_D, BATTLE_STATUS_D, EXP_INFO_D, BATTLE_STATUS_C, EXP_INFO_C
from module.exception import ScriptError, CampaignEnd
from module.logger import logger
from module.raid.assets import RAID_FLEET_PREPARATION
from module.raid.my_assets import *
from module.raid.combat import RaidCombat
from module.raid.raid import raid_entrance
from module.raid.run import RaidRun
from module.retire.assets import DOCK_CHECK
from module.retire.dock import Dock
from module.retire.scanner import ShipScanner
from module.ui.page import page_raid, page_rpg_stage
class RaidScuttleCombat(RaidCombat):
triggered_normal_end = False
def handle_battle_status(self, drop=None):
"""
Args:
drop (DropImage):
Returns:
bool:
"""
if self.is_combat_executing():
return False
if self.appear(BATTLE_STATUS_D, interval=self.battle_status_click_interval):
if drop:
drop.handle_add(self)
else:
self.device.sleep((0.25, 0.5))
self.device.click(BATTLE_STATUS_D)
return True
if self.appear(OPTS_INFO_D, interval=self.battle_status_click_interval):
if drop:
drop.handle_add(self)
else:
self.device.sleep((0.25, 0.5))
self.device.click(OPTS_INFO_D)
return True
if super().handle_battle_status(drop=drop):
logger.warning("Triggered normal end")
self.triggered_normal_end = True
return True
return False
def handle_exp_info(self):
"""
Returns:
bool:
"""
if self.is_combat_executing():
return False
if self.appear_then_click(EXP_INFO_D):
self.device.sleep((0.25, 0.5))
return True
if super().handle_exp_info():
return True
return False
def handle_combat_weapon_release(self):
return False
class RaidScuttleRun(RaidRun, RaidScuttleCombat, Dock):
@property
def manual_mode(self):
return self.config.Fleet_Fleet1Mode
@property
def change_vanguard(self):
return 'vanguard' in self.config.RaidScuttle_Sacrifice
@property
def change_flagship(self):
return 'flagship' in self.config.RaidScuttle_Sacrifice
def triggered_stop_condition(self, oil_check=False, pt_check=False, coin_check=False):
if self.triggered_normal_end:
return True
if super().triggered_stop_condition(oil_check, pt_check, coin_check):
return True
return False
def raid_enter_preparation(self, mode, raid, skip_first_screenshot=True):
"""
Args:
mode:
raid:
skip_first_screenshot:
Pages:
in: page_raid
out: BATTLE_PREPARATION
"""
# UI ensure
self.device.stuck_record_clear()
self.device.click_record_clear()
if not self.is_raid_rpg():
self.ui_ensure(page_raid)
else:
self.ui_ensure(page_rpg_stage)
self.raid_rpg_swipe()
entrance = raid_entrance(raid=raid, mode=mode)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
if self.appear(entrance, offset=(10, 10), interval=5):
self.device.click(entrance)
continue
# End
if self.appear_then_click(RAID_FLEET_PREPARATION, offset=(20, 20), interval=5):
break
def combat_auto_reset(self):
pass
def raid_execute_once(self, mode, raid):
"""
Args:
mode:
raid:
Returns:
in: page_raid
out: page_raid
"""
logger.hr('Raid Execute')
self.config.override(
Campaign_Name=f'{raid}_{mode}',
Campaign_UseAutoSearch=False,
Fleet_FleetOrder='fleet1_all_fleet2_standby'
)
if mode == 'ex':
backup = self.config.temporary(
Submarine_Fleet=1,
Submarine_Mode='every_combat'
)
self.emotion.check_reduce(1)
self.raid_enter(mode=mode, raid=raid)
self.combat(balance_hp=False, auto_mode=self.manual_mode, expected_end=self.raid_expected_end)
if mode == 'ex':
backup.recover()
logger.hr('Raid End')
def get_common_rarity_ship(self, index='all'):
self.dock_favourite_set(False, wait_loading=False)
self.dock_sort_method_dsc_set(False, wait_loading=False)
self.dock_filter_set(
index=index, rarity='common', extra='enhanceable', sort='total'
)
logger.hr('FINDING SHIP')
scanner = ShipScanner(level=(1, 31), fleet=0, status='free')
scanner.disable('rarity')
return scanner.scan(self.device.image)
def vanguard_change(self):
logger.hr('Change vanguard', level=2)
for _ in self.loop():
if self.appear(DOCK_CHECK, offset=(20, 20)):
break
if self.appear(RAID_FLEET_PREPARATION, offset=(20, 20)):
self.device.click(my_RAID_FLEET_VANGUARD)
continue
ship = self.get_common_rarity_ship(index='vanguard')
if ship:
self._ship_change_confirm(min(ship, key=lambda s: (s.level, -s.emotion)).button)
logger.info('Change vanguard success')
return True
else:
logger.info('Change vanguard failed, no vanguard in common rarity.')
self._dock_reset()
self.ui_back(check_button=RAID_FLEET_PREPARATION)
return False
def flagship_change(self):
logger.hr('Change flagship', level=2)
for _ in self.loop():
if self.appear(DOCK_CHECK, offset=(20, 20)):
break
if self.appear(RAID_FLEET_PREPARATION, offset=(20, 20)):
self.device.click(my_RAID_FLEET_FLAGSHIP)
continue
ship = self.get_common_rarity_ship(index='main')
if ship:
self._ship_change_confirm(min(ship, key=lambda s: (s.level, -s.emotion)).button)
logger.info('Change flagship success')
return True
else:
logger.info('Change flagship failed, no flagship in common rarity.')
self._dock_reset()
self.ui_back(check_button=RAID_FLEET_PREPARATION)
return False
def run(self, name='', mode='', total=0):
"""
Args:
name (str): Raid name, such as 'raid_20200624'
mode (str): Raid mode, such as 'hard', 'normal', 'easy'
total (int): Total run count
"""
name = name if name else self.config.Campaign_Event
mode = mode if mode else self.config.Raid_Mode
if not name or not mode:
raise ScriptError(f'RaidRun arguments unfilled. name={name}, mode={mode}')
while 1:
super().run(name=name, mode=mode, total=total)
# End
if self.triggered_normal_end:
self.raid_enter_preparation(mode=mode, raid=name, skip_first_screenshot=False)
success = True
if self.change_vanguard:
success = self.vanguard_change()
if self.change_flagship:
success = success and self.flagship_change()
self.enter_map_cancel(skip_first_screenshot=False)
self.triggered_normal_end = False
# Scheduler
if self.config.task_switched():
self.campaign.ensure_auto_search_exit()
self.config.task_stop()
elif not success:
self.campaign.ensure_auto_search_exit()
self.config.task_delay(minute=30)
self.config.task_stop()
else:
break