Fix: Override mode in CoalitionSp

This commit is contained in:
LmeSzinc 2024-06-28 01:54:38 +08:00
parent a8f8432842
commit 9bdfdb6447
4 changed files with 13 additions and 9 deletions

View File

@ -114,14 +114,14 @@ class Coalition(CoalitionCombat, CampaignEvent):
return event, stage return event, stage
def run(self, event='', stage='', fleet='', total=0): def run(self, event='', mode='', fleet='', total=0):
event = event if event else self.config.Campaign_Event event = event if event else self.config.Campaign_Event
stage = stage if stage else self.config.Coalition_Mode mode = mode if mode else self.config.Coalition_Mode
fleet = fleet if fleet else self.config.Coalition_Fleet fleet = fleet if fleet else self.config.Coalition_Fleet
if not event or not stage or not fleet: if not event or not mode or not fleet:
raise ScriptError(f'RaidRun arguments unfilled. name={event}, stage={stage}, fleet={fleet}') raise ScriptError(f'Coalition arguments unfilled. name={event}, mode={mode}, fleet={fleet}')
event, stage = self.handle_stage_name(event, stage) event, mode = self.handle_stage_name(event, mode)
self.run_count = 0 self.run_count = 0
self.run_limit = self.config.StopCondition_RunCount self.run_limit = self.config.StopCondition_RunCount
while 1: while 1:
@ -132,7 +132,7 @@ class Coalition(CoalitionCombat, CampaignEvent):
self.config.task_stop() self.config.task_stop()
# Log # Log
logger.hr(f'{event}_{stage}', level=2) logger.hr(f'{event}_{mode}', level=2)
if self.config.StopCondition_RunCount > 0: if self.config.StopCondition_RunCount > 0:
logger.info(f'Count remain: {self.config.StopCondition_RunCount}') logger.info(f'Count remain: {self.config.StopCondition_RunCount}')
else: else:
@ -152,7 +152,7 @@ class Coalition(CoalitionCombat, CampaignEvent):
self.device.stuck_record_clear() self.device.stuck_record_clear()
self.device.click_record_clear() self.device.click_record_clear()
try: try:
self.coalition_execute_once(event=event, stage=stage, fleet=fleet) self.coalition_execute_once(event=event, stage=mode, fleet=fleet)
except ScriptEnd as e: except ScriptEnd as e:
logger.hr('Script end') logger.hr('Script end')
logger.info(str(e)) logger.info(str(e))

View File

@ -5,7 +5,7 @@ from module.config.config import TaskEnd
class CoalitionSP(Coalition): class CoalitionSP(Coalition):
def run(self, *args, **kwargs): def run(self, *args, **kwargs):
try: try:
super().run(stage='sp', total=1) super().run(mode='sp', total=1)
except TaskEnd: except TaskEnd:
# Catch task switch # Catch task switch
pass pass

View File

@ -6439,7 +6439,8 @@
"normal", "normal",
"hard", "hard",
"ex" "ex"
] ],
"display": "hide"
}, },
"Fleet": { "Fleet": {
"type": "select", "type": "select",

View File

@ -248,6 +248,9 @@ CoalitionSp:
UseAutoSearch: false UseAutoSearch: false
Use2xBook: false Use2xBook: false
AmbushEvade: true AmbushEvade: true
Coalition:
# CoalitionSp hard-codes Mode='sp'
Mode: hard
StopCondition: StopCondition:
MapAchievement: non_stop MapAchievement: non_stop
StageIncrease: false StageIncrease: false