mirror of
https://github.com/sui-feng-cb/AzurLaneAutoScript1.git
synced 2026-08-13 19:14:29 +08:00
tmp: oil consumption check
This commit is contained in:
@@ -121,6 +121,36 @@ class AutoSearchCombat(MapOperation, Combat, CampaignStatus):
|
||||
|
||||
return checked
|
||||
|
||||
def check_oil_threshold(self, oil):
|
||||
"""
|
||||
Check abnormal oil consumption between battles.
|
||||
Returns:
|
||||
bool: True to interrupt auto search.
|
||||
"""
|
||||
oil_threshold = self.config.InterceptiveCheck_OilThreshold
|
||||
if not oil_threshold:
|
||||
return False
|
||||
logger.attr('Oil Threshold', oil_threshold)
|
||||
if oil_threshold <= 3:
|
||||
logger.warning('Oil Threshold must be at least 4. Reset to default')
|
||||
self.config.InterceptiveCheck_OilThreshold = 0
|
||||
return False
|
||||
|
||||
checked = False
|
||||
self._prev_oil = self._prev_oil or oil
|
||||
diff = abs(self._prev_oil - oil) if self._prev_oil else 0
|
||||
if diff > 0:
|
||||
logger.attr('Oil Consumption', diff)
|
||||
if diff >= 500:
|
||||
logger.warning(f"Wrong oil consumption {diff}, assumed to be an ocr error")
|
||||
self._prev_oil = 0
|
||||
return False
|
||||
if diff >= oil_threshold:
|
||||
logger.warning("Abnormal oil consumption detected, withdrawing")
|
||||
checked = True
|
||||
self._prev_oil = oil
|
||||
return checked
|
||||
|
||||
def _check_oil(self, oil):
|
||||
"""
|
||||
Check oil threshold and set auto_search_oil_limit_triggered.
|
||||
@@ -502,6 +532,9 @@ class AutoSearchCombat(MapOperation, Combat, CampaignStatus):
|
||||
"""
|
||||
emotion_reduce = emotion_reduce if emotion_reduce is not None else self.emotion.is_calculate
|
||||
|
||||
if self._interrupt:
|
||||
self.interrupt_auto_search(emotion_reduce, fleet_index)
|
||||
|
||||
self.auto_search_combat_execute(emotion_reduce=emotion_reduce, fleet_index=fleet_index, battle=battle)
|
||||
self.auto_search_combat_status(emotion_reduce=emotion_reduce, fleet_index=fleet_index)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user