Add: 支持在战斗中召唤潜艇

This commit is contained in:
LmeSzinc 2020-04-10 12:05:16 +08:00
parent 17d37d3048
commit 677757ecfc
8 changed files with 51 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -21,3 +21,7 @@ GET_MISSION = Button(area=(553, 482, 727, 539), color=(93, 142, 203), button=(55
GET_SHIP = Button(area=(1104, 610, 1110, 630), color=(255, 255, 255), button=(1000, 631, 1055, 689), file='./assets/combat/GET_SHIP.png')
LOADING_BAR = Button(area=(33, 676, 1247, 680), color=(172, 205, 232), button=(33, 676, 1247, 680), file='./assets/combat/LOADING_BAR.png')
PAUSE = Button(area=(1236, 37, 1244, 59), color=(247, 243, 247), button=(1162, 34, 1246, 61), file='./assets/combat/PAUSE.png')
SUBMARINE_AVAILABLE_CHECK_1 = Button(area=(707, 660, 712, 665), color=(255, 255, 255), button=(707, 660, 712, 665), file='./assets/combat/SUBMARINE_AVAILABLE_CHECK_1.png')
SUBMARINE_AVAILABLE_CHECK_2 = Button(area=(790, 631, 795, 641), color=(255, 255, 255), button=(790, 631, 795, 641), file='./assets/combat/SUBMARINE_AVAILABLE_CHECK_2.png')
SUBMARINE_CALLED = Button(area=(737, 608, 750, 626), color=(132, 134, 132), button=(737, 608, 750, 626), file='./assets/combat/SUBMARINE_CALLED.png')
SUBMARINE_READY = Button(area=(737, 608, 752, 625), color=(255, 251, 255), button=(737, 608, 752, 625), file='./assets/combat/SUBMARINE_READY.png')

View File

@ -3,6 +3,7 @@ from module.base.utils import color_bar_percentage
from module.combat.assets import *
from module.combat.emotion import Emotion
from module.combat.hp_balancer import HPBalancer
from module.combat.submarine import SubmarineCall
from module.handler.enemy_searching import EnemySearchingHandler
from module.handler.urgent_commission import UrgentCommissionHandler
from module.logger import logger
@ -12,7 +13,7 @@ from module.retire.retirement import Retirement
from module.ui.assets import BACK_ARROW
class Combat(HPBalancer, UrgentCommissionHandler, EnemySearchingHandler, Retirement):
class Combat(HPBalancer, UrgentCommissionHandler, EnemySearchingHandler, Retirement, SubmarineCall):
_automation_set_timer = Timer(1)
_emotion: Emotion
@ -163,6 +164,7 @@ class Combat(HPBalancer, UrgentCommissionHandler, EnemySearchingHandler, Retirem
save_get_items (bool)
"""
logger.info('Combat execute')
self.submarine_call_reset()
confirm_timer = Timer(10)
confirm_timer.start()
@ -174,6 +176,9 @@ class Combat(HPBalancer, UrgentCommissionHandler, EnemySearchingHandler, Retirem
if call_submarine_at_boss:
pass
else:
if self.handle_submarine_call():
continue
# End
# if self.appear_then_click(BATTLE_STATUS):

View File

@ -0,0 +1,40 @@
from module.base.base import ModuleBase
from module.combat.assets import *
from module.base.timer import Timer
from module.logger import logger
class SubmarineCall(ModuleBase):
submarine_call_flag = False
submarine_call_timer = Timer(5)
def submarine_call_reset(self):
"""
Call this method after in battle_execute.
"""
self.submarine_call_timer.reset()
self.submarine_call_flag = False
def handle_submarine_call(self):
"""
Returns:
bool: If call.
"""
if not self.config.SUBMARINE or self.config.SUBMARINE_MODE in ['do_not_use', 'hunt_only']:
return False
if self.submarine_call_flag:
return False
if self.submarine_call_timer.reached():
logger.info('Submarine call timer reached')
self.submarine_call_flag = True
return False
if not self.appear(SUBMARINE_AVAILABLE_CHECK_1) or not self.appear(SUBMARINE_AVAILABLE_CHECK_2):
return False
if self.appear(SUBMARINE_CALLED):
logger.info('Submarine called')
self.submarine_call_flag = True
return False
if self.appear_then_click(SUBMARINE_READY, interval=1):
logger.info('Call submarine')
return True

View File

@ -109,7 +109,7 @@ def main(ini_name=''):
f3.add_argument('--舰队阵型3', default=default('--舰队阵型3'), choices=['单纵阵', '复纵阵', '轮形阵'])
# 潜艇设置
submarine = setting_parser.add_argument_group('潜艇设置', '暂不支持潜艇, 最好避免潜艇进图')
submarine = setting_parser.add_argument_group('潜艇设置', '仅支持: 不使用, 仅狩猎, 每战出击')
submarine.add_argument('--舰队编号4', default=default('--舰队编号4'), choices=['不使用', '1', '2'])
submarine.add_argument('--潜艇出击方案', default=default('--潜艇出击方案'), choices=['不使用', '仅狩猎', '每战出击', '空弹出击', 'BOSS战出击', 'BOSS战BOSS出现后召唤'])