Fix: Misuse emergency_repair after retirement

This commit is contained in:
LmeSzinc 2020-05-26 23:35:51 +08:00
parent 1989ea9716
commit 6d6f686e0f

View File

@ -96,7 +96,6 @@ class Combat(HPBalancer, EnemySearchingHandler, Retirement, SubmarineCall, Comba
self.emotion.wait(fleet=fleet_index)
if balance_hp:
self.hp_balance()
# logger.info('start combat')
while 1:
self.device.screenshot()
@ -105,7 +104,12 @@ class Combat(HPBalancer, EnemySearchingHandler, Retirement, SubmarineCall, Comba
if self.handle_combat_automation_set(auto=auto):
continue
if self.handle_retirement():
continue
if self.config.ENABLE_HP_BALANCE:
self.wait_until_appear(BATTLE_PREPARATION)
# When re-entering battle_preparation page, the emergency icon is active by default, even if
# nothing to use. After a short animation, everything shows as usual.
self.device.sleep(0.5) # Wait animation.
continue
if self.handle_combat_low_emotion():
continue
if self.handle_emergency_repair_use():
@ -157,6 +161,8 @@ class Combat(HPBalancer, EnemySearchingHandler, Retirement, SubmarineCall, Comba
return False
def handle_emergency_repair_use(self):
if not self.config.ENABLE_HP_BALANCE:
return False
if self.appear_then_click(EMERGENCY_REPAIR_CONFIRM, offset=True):
self.device.sleep(0.5) # Animation: hp increase and emergency_repair amount decrease.
return True