Fix: 修复跳过猫攻击的动画

This commit is contained in:
LmeSzinc 2020-05-01 17:54:24 +08:00
parent bde6f5fe58
commit 90e07b033d
3 changed files with 10 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -15,7 +15,7 @@ FLEET_2_IN_USE = Button(area=(390, 291, 473, 374), color=(74, 66, 66), button=(3
FLEET_PREPARATION = Button(area=(981, 575, 1180, 636), color=(235, 185, 114), button=(981, 575, 1180, 636), file='./assets/map/FLEET_PREPARATION.png')
FLEET_PREPARATION_HARD_1 = Button(area=(200, 260, 1004, 261), color=(247, 215, 0), button=(200, 260, 1004, 261), file='./assets/map/FLEET_PREPARATION_HARD_1.png')
FLEET_PREPARATION_HARD_2 = Button(area=(201, 393, 1001, 394), color=(255, 219, 0), button=(201, 393, 1001, 394), file='./assets/map/FLEET_PREPARATION_HARD_2.png')
MAP_CAT_ATTACK = Button(area=(1241, 106, 1271, 115), color=(255, 231, 123), button=(1148, 653, 1262, 705), file='./assets/map/MAP_CAT_ATTACK.png')
MAP_CAT_ATTACK = Button(area=(1237, 103, 1252, 153), color=(43, 45, 52), button=(1148, 653, 1262, 705), file='./assets/map/MAP_CAT_ATTACK.png')
MAP_OFFENSIVE = Button(area=(1148, 653, 1262, 705), color=(234, 180, 108), button=(1148, 653, 1262, 705), file='./assets/map/MAP_OFFENSIVE.png')
MAP_PREPARATION = Button(area=(854, 488, 1052, 548), color=(236, 186, 115), button=(854, 488, 1052, 548), file='./assets/map/MAP_PREPARATION.png')
MAP_PREPARATION_CANCEL = Button(area=(234, 12, 278, 47), color=(45, 46, 69), button=(234, 12, 278, 47), file='./assets/map/MAP_PREPARATION_CANCEL.png')

View File

@ -1,4 +1,7 @@
import numpy as np
from module.base.timer import Timer
from module.base.utils import color_similarity_2d
from module.exception import CampaignEnd
from module.exception import ScriptEnd
from module.handler.fast_forward import FastForwardHandler
@ -13,6 +16,8 @@ from module.retire.retirement import Retirement
class MapOperation(UrgentCommissionHandler, MysteryHandler, FleetPreparation, Retirement, FastForwardHandler,
LowEmotionHandler):
map_cat_attack_timer = Timer(2)
def fleet_switch_click(self):
"""
Switch fleet.
@ -137,8 +142,11 @@ class MapOperation(UrgentCommissionHandler, MysteryHandler, FleetPreparation, Re
"""
Click to skip the animation when cat attacks.
"""
if self.appear_then_click(MAP_CAT_ATTACK, genre='cat_attack', interval=2):
if not self.map_cat_attack_timer.reached():
return False
if np.sum(color_similarity_2d(self.image_area(MAP_CAT_ATTACK), (255, 231, 123)) > 221) > 100:
logger.info('Skip map cat attack')
self.map_cat_attack_timer.reset()
return True
return False