mirror of
https://github.com/sui-feng-cb/AzurLaneAutoScript1.git
synced 2026-07-23 14:07:05 +08:00
Add: asset for Akashi grid overlap avoidance
This commit is contained in:
@@ -16,16 +16,12 @@ from module.os.fleet import OSFleet, BossFleet
|
||||
from module.os.globe_camera import GlobeCamera
|
||||
from module.os.globe_operation import RewardUncollectedError
|
||||
from module.os_handler.assets import AUTO_SEARCH_OS_MAP_OPTION_OFF, AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED, \
|
||||
AUTO_SEARCH_OS_MAP_OPTION_ON, AUTO_SEARCH_REWARD
|
||||
AUTO_SEARCH_OS_MAP_OPTION_ON, AUTO_SEARCH_REWARD, MAP_OPTIONS_AREA
|
||||
from module.os_handler.storage import StorageHandler
|
||||
from module.os_handler.strategic import StrategicSearchHandler
|
||||
from module.ui.assets import GOTO_MAIN
|
||||
from module.ui.page import page_os
|
||||
|
||||
# UI button area where clicking may trigger UI buttons instead of fleet movement
|
||||
# To be replaced with an asset in the future
|
||||
OS_UI_BUTTON_AREA = (1170, 455, 1280, 720)
|
||||
|
||||
|
||||
class OSMap(OSFleet, Map, GlobeCamera, StorageHandler, StrategicSearchHandler):
|
||||
def os_init(self):
|
||||
@@ -1021,7 +1017,7 @@ class OSMap(OSFleet, Map, GlobeCamera, StorageHandler, StrategicSearchHandler):
|
||||
|
||||
Args:
|
||||
drop:
|
||||
_ui_avoid_count (int): Internal counter for UI button area avoidance attempts
|
||||
_ui_avoid_count (int): Internal counter for map options area avoidance attempts
|
||||
|
||||
Returns:
|
||||
bool: If solved a map random event
|
||||
@@ -1043,9 +1039,9 @@ class OSMap(OSFleet, Map, GlobeCamera, StorageHandler, StrategicSearchHandler):
|
||||
logger.info(f'Found Akashi on {grid}')
|
||||
fleet = self.convert_radar_to_local((0, 0))
|
||||
if fleet.distance_to(grid) > 1:
|
||||
# Avoid clicking grid that overlaps with UI button area
|
||||
if _ui_avoid_count < 3 and area_cross_area(grid.button, OS_UI_BUTTON_AREA, threshold=0):
|
||||
logger.info(f'Akashi grid {grid} overlaps with UI button area, swipe camera to avoid')
|
||||
# Avoid clicking grid that overlaps with map options area
|
||||
if _ui_avoid_count < 3 and area_cross_area(grid.button, MAP_OPTIONS_AREA.area, threshold=0):
|
||||
logger.info(f'Akashi grid {grid} overlaps with map options area, swipe camera to avoid')
|
||||
vector = np.array(grid.location) - np.array(fleet.location)
|
||||
vector = tuple((vector // 2).astype(int))
|
||||
self.map_swipe(vector)
|
||||
|
||||
Reference in New Issue
Block a user