mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-24 01:21:25 +00:00
8ce405f28a
- 增加处理踩问号是会刷物资船的情况 - 增加对物资船的缺失预测 - 收完菜后出击, 会重新检查舰队 因为离开出击界面后, 出击舰队会重置为游戏默认的 - 修复了部分偏红的过场图, 会被认作索敌的问题
51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
from module.base.timer import Timer
|
|
from module.base.utils import area_in_area
|
|
from module.handler.assets import *
|
|
from module.handler.enemy_searching import EnemySearchingHandler
|
|
from module.handler.strategy import StrategyHandler
|
|
from module.logger import logger
|
|
|
|
|
|
class MysteryHandler(StrategyHandler, EnemySearchingHandler):
|
|
_get_ammo_log_timer = Timer(3)
|
|
carrier_count = 0
|
|
|
|
def handle_mystery(self, button=None):
|
|
"""
|
|
Args:
|
|
button (optional): Button to click when get_items.
|
|
Can be destination grid which makes the bot more like human.
|
|
"""
|
|
if button is None or area_in_area(button.button, MYSTERY_ITEM.area, threshold=20):
|
|
button = GET_ITEMS_1
|
|
|
|
if self.appear(GET_ITEMS_1):
|
|
logger.attr('Mystery', 'Get item')
|
|
self._save_mystery_image()
|
|
self.device.click(button)
|
|
self.device.sleep(0.5)
|
|
self.device.screenshot()
|
|
self.handle_opened_strategy_bar()
|
|
return 'get_item'
|
|
|
|
if self.info_bar_count():
|
|
if self._get_ammo_log_timer.reached() and self.appear(GET_AMMO):
|
|
logger.attr('Mystery', 'Get ammo')
|
|
self._get_ammo_log_timer.reset()
|
|
self._save_mystery_image()
|
|
return 'get_ammo'
|
|
|
|
if self.config.MAP_MYSTERY_HAS_CARRIER:
|
|
if self.is_in_map() and self.enemy_searching_appear():
|
|
logger.attr('Mystery', 'Get carrier')
|
|
self.carrier_count += 1
|
|
self._save_mystery_image()
|
|
self.handle_in_map_with_enemy_searching()
|
|
return 'get_carrier'
|
|
|
|
return False
|
|
|
|
def _save_mystery_image(self):
|
|
if self.config.ENABLE_SAVE_GET_ITEMS:
|
|
self.device.save_screenshot('mystery')
|