Fix: Handle empty HP when using emergency repair (#2925)

This commit is contained in:
LmeSzinc 2023-07-25 12:48:47 +08:00
parent 881007979a
commit f948fd502f
2 changed files with 6 additions and 1 deletions

View File

@ -203,7 +203,9 @@ class Combat(Level, HPBalancer, Retirement, SubmarineCall, CombatAuto, CombatMan
logger.info('EMERGENCY_REPAIR_AVAILABLE')
if not len(self.hp):
return False
if np.min(np.array(self.hp)[np.array(self.hp) > 0.001]) < self.config.HpControl_RepairUseSingleThreshold \
hp = np.array(self.hp)
hp = hp[hp > 0.001]
if (len(hp) and np.min(hp) < self.config.HpControl_RepairUseSingleThreshold) \
or np.max(self.hp[:3]) < self.config.HpControl_RepairUseMultiThreshold \
or np.max(self.hp[3:]) < self.config.HpControl_RepairUseMultiThreshold:
logger.info('Use emergency repair')

View File

@ -332,6 +332,9 @@ class Fleet(Camera, AmbushHandler):
if self.catch_camera_repositioning(self.map[location]):
self.handle_boss_appear_refocus()
if sum(self.hp) < 0.01:
logger.warning('Empty HP on all slots, trying hp_get again')
self.hp_get()
if self.config.MAP_FOCUS_ENEMY_AFTER_BATTLE:
self.camera = location
self.update()