From 8b0964ebfd3d75be0105790f54fdb01b599eae3f Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 28 Dec 2022 18:09:55 +0800 Subject: [PATCH] Fix: CampaignEnd error when battle function exhausted --- module/campaign/campaign_base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/campaign/campaign_base.py b/module/campaign/campaign_base.py index 89ef87855..15ebf4783 100644 --- a/module/campaign/campaign_base.py +++ b/module/campaign/campaign_base.py @@ -110,8 +110,8 @@ class CampaignBase(CampaignUI, Map, AutoSearchCombat): logger.warning('ScriptError, No combat executed.') if self.config.Error_HandleError: logger.warning('ScriptError, No combat executed, Withdrawing') - else: self.withdraw() + else: raise ScriptError('No combat executed.') return result @@ -149,7 +149,10 @@ class CampaignBase(CampaignUI, Map, AutoSearchCombat): logger.warning('Battle function exhausted.') if self.config.Error_HandleError: logger.warning('ScriptError, Battle function exhausted, Withdrawing') - self.withdraw() + try: + self.withdraw() + except CampaignEnd: + pass else: raise ScriptError('Battle function exhausted.')