Skip to content

Commit

Permalink
Fix: check_reduce in GemsFarming
Browse files Browse the repository at this point in the history
  • Loading branch information
guoh064 committed Sep 15, 2024
1 parent d0e7200 commit aa08764
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions module/campaign/gems_farming.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ def check_reduce(self, battle):
Raise:
CampaignEnd: Pause current task to prevent emotion control in the future.
"""

try:
super().check_reduce(battle)
except ScriptEnd:
if not self.is_calculate:
return

recovered, delay = self._check_reduce(battle)
if delay:
self.config.GEMS_EMOTION_TRIGGERED = True
self.config.task_delay(minute=0) # to undo emotion delay
logger.info('Detect low emotion, pause current task')
raise CampaignEnd('Emotion control')

def wait(self, fleet_index):
Expand Down
2 changes: 1 addition & 1 deletion module/combat/emotion.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _check_reduce(self, battle):
self.record()
self.show()
recovered = max([f.get_recovered(b) for f, b in zip(self.fleets, battle)])
delay = recover_count > datetime.now()
delay = recovered > datetime.now()
return recovered, delay

def check_reduce(self, battle):
Expand Down

0 comments on commit aa08764

Please sign in to comment.