mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-30 17:53:29 +08:00
Merge pull request #7 from nEEtdo0d/enhance_adjustments
Enhance adjustments
This commit is contained in:
157
alas.bat
157
alas.bat
@@ -29,12 +29,55 @@ set ALAS_ENV_GITEE=https://gitee.com/lmeszinc/alas-env.git
|
|||||||
set GITEE_URL=https://gitee.com/lmeszinc/AzurLaneAutoScript.git
|
set GITEE_URL=https://gitee.com/lmeszinc/AzurLaneAutoScript.git
|
||||||
set ADB_P=%ALAS_PATH%config\adb_port.ini
|
set ADB_P=%ALAS_PATH%config\adb_port.ini
|
||||||
set CURL=%ALAS_PATH%toolkit\Git\mingw64\bin\curl.exe
|
set CURL=%ALAS_PATH%toolkit\Git\mingw64\bin\curl.exe
|
||||||
set API_JSON=%ALAS_PATH%log\API_GIT.json
|
set API_JSON=%ALAS_PATH%log\api_git.json
|
||||||
set config=%~dp0config\alas.ini
|
set config=%~dp0config\alas.ini
|
||||||
set configtemp=%~dp0config\alastemp.ini
|
set configtemp=%~dp0config\alastemp.ini
|
||||||
set template=%~dp0config\template.ini
|
set template=%~dp0config\template.ini
|
||||||
set git_log="%GIT% log --pretty=format:%%H%%n%%aI -1"
|
set git_log="%GIT% log --pretty=format:%%H%%n%%aI -1"
|
||||||
:: -----------------------------------------------------------------------------
|
:: -----------------------------------------------------------------------------
|
||||||
|
set using_git=
|
||||||
|
if exist ".git\" set using_git=1
|
||||||
|
if defined using_git (
|
||||||
|
call :is_using_git
|
||||||
|
) else (
|
||||||
|
call :not_using_git
|
||||||
|
)
|
||||||
|
:: -----------------------------------------------------------------------------
|
||||||
|
:is_using_git
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
for /f "delims=" %%a in (!config!) do (
|
||||||
|
set line=%%a
|
||||||
|
if "x!line:~0,15!"=="xgithub_token = " (
|
||||||
|
set github_token=!line:~15!
|
||||||
|
|
||||||
|
)
|
||||||
|
)
|
||||||
|
%CURL% -s https://api.github.com/repos/lmeszinc/AzurLaneAutoScript/git/refs/heads/master?access_token=!github_token! > %~dp0log\API_GIT.json
|
||||||
|
endlocal
|
||||||
|
FOR /f "skip=5 tokens=2 delims=:," %%I IN (%API_JSON%) DO IF NOT DEFINED sha SET "sha=%%I"
|
||||||
|
set sha=%sha:"=%
|
||||||
|
set sha=%sha: =%
|
||||||
|
FOR /F "delims=" %%i IN ('%GIT% log -1 "--pretty=%%H"') DO set LAST_LOCAL_GIT=%%i
|
||||||
|
:: -----------------------------------------------------------------------------
|
||||||
|
REM echo %sha%
|
||||||
|
REM echo %LAST_LOCAL_GIT%
|
||||||
|
REM echo Parse Ok
|
||||||
|
REM pause
|
||||||
|
:: -----------------------------------------------------------------------------
|
||||||
|
if %LAST_LOCAL_GIT% EQU %sha% (
|
||||||
|
set found_updates=
|
||||||
|
echo your ALAS is updated
|
||||||
|
timeout /t 2
|
||||||
|
call :adb_kill
|
||||||
|
) else (
|
||||||
|
set found_updates=1
|
||||||
|
start /wait popup.exe
|
||||||
|
choice /t 10 /c yn /d n /m "There is an update for ALAS. Download now?"
|
||||||
|
if errorlevel 2 call :alas
|
||||||
|
if errorlevel 1 call :choose_update_mode
|
||||||
|
)
|
||||||
|
:: -----------------------------------------------------------------------------
|
||||||
|
:not_using_git
|
||||||
set TOOLKIT_GIT=%~dp0toolkit\.git
|
set TOOLKIT_GIT=%~dp0toolkit\.git
|
||||||
if not exist %TOOLKIT_GIT% (
|
if not exist %TOOLKIT_GIT% (
|
||||||
echo You may need to update your dependencies
|
echo You may need to update your dependencies
|
||||||
@@ -146,14 +189,6 @@ REM echo connecting at %ADB_PORT%
|
|||||||
REM call %ADB% connect %ADB_PORT%
|
REM call %ADB% connect %ADB_PORT%
|
||||||
:: -----------------------------------------------------------------------------
|
:: -----------------------------------------------------------------------------
|
||||||
:init
|
:init
|
||||||
setlocal enabledelayedexpansion
|
|
||||||
for /f "delims=" %%a in (!config!) do (
|
|
||||||
set line=%%a
|
|
||||||
if "x!line:~0,15!"=="xgithub_token = " (
|
|
||||||
set github_token=!line:~15!
|
|
||||||
endlocal
|
|
||||||
)
|
|
||||||
)
|
|
||||||
echo initializing uiautomator2
|
echo initializing uiautomator2
|
||||||
call %PYTHON% -m uiautomator2 init
|
call %PYTHON% -m uiautomator2 init
|
||||||
REM timeout /t 1
|
REM timeout /t 1
|
||||||
@@ -162,6 +197,7 @@ REM pause
|
|||||||
:: timout
|
:: timout
|
||||||
call :alas
|
call :alas
|
||||||
:: -----------------------------------------------------------------------------
|
:: -----------------------------------------------------------------------------
|
||||||
|
|
||||||
:alas
|
:alas
|
||||||
cls
|
cls
|
||||||
echo.
|
echo.
|
||||||
@@ -196,35 +232,6 @@ call :alas
|
|||||||
)
|
)
|
||||||
:: -----------------------------------------------------------------------------
|
:: -----------------------------------------------------------------------------
|
||||||
:en
|
:en
|
||||||
if exist .git\ (
|
|
||||||
%CURL% -s https://api.github.com/repos/lmeszinc/AzurLaneAutoScript/git/refs/heads/master?access_token=%github_token% > %~dp0log\API_GIT.json
|
|
||||||
setlocal enableDelayedExpansion
|
|
||||||
FOR /f "skip=5 tokens=2 delims=:," %%I IN (!API_JSON!) DO IF NOT DEFINED sha SET "sha=%%I"
|
|
||||||
set sha=%sha:"=%
|
|
||||||
set sha=%sha: =%
|
|
||||||
FOR /F "delims=" %%i IN ('%GIT% log -1 "--pretty=%%H"') DO set LAST_LOCAL_GIT=%%i
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
REM echo !sha!
|
|
||||||
REM echo !LAST_LOCAL_GIT!
|
|
||||||
REM echo Parse Ok
|
|
||||||
REM pause
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
if !LAST_LOCAL_GIT! EQU !sha! (
|
|
||||||
echo your ALAS is updated
|
|
||||||
timeout /t 2
|
|
||||||
call :run_en
|
|
||||||
) else (
|
|
||||||
start /wait popup.exe
|
|
||||||
choice /t 10 /c yn /d n /m "There is an update for ALAS. Download now?"
|
|
||||||
if errorlevel 2 call :run_en
|
|
||||||
if errorlevel 1 call :choose_update_mode
|
|
||||||
)
|
|
||||||
endlocal
|
|
||||||
) else (
|
|
||||||
call :run_en
|
|
||||||
)
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
:run_en
|
|
||||||
call %PYTHON% --version >nul
|
call %PYTHON% --version >nul
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
echo Python Found in %PYTHON% Proceeding..
|
echo Python Found in %PYTHON% Proceeding..
|
||||||
@@ -242,35 +249,6 @@ endlocal
|
|||||||
)
|
)
|
||||||
:: -----------------------------------------------------------------------------
|
:: -----------------------------------------------------------------------------
|
||||||
:cn
|
:cn
|
||||||
if exist .git\ (
|
|
||||||
%CURL% -s https://api.github.com/repos/lmeszinc/AzurLaneAutoScript/git/refs/heads/master?access_token=%github_token% > %~dp0log\API_GIT.json
|
|
||||||
setlocal enableDelayedExpansion
|
|
||||||
FOR /f "skip=5 tokens=2 delims=:," %%I IN (!API_JSON!) DO IF NOT DEFINED sha SET "sha=%%I"
|
|
||||||
set sha=%sha:"=%
|
|
||||||
set sha=%sha: =%
|
|
||||||
FOR /F "delims=" %%i IN ('%GIT% log -1 "--pretty=%%H"') DO set LAST_LOCAL_GIT=%%i
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
REM echo !sha!
|
|
||||||
REM echo !LAST_LOCAL_GIT!
|
|
||||||
REM echo Parse Ok
|
|
||||||
REM pause
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
if !LAST_LOCAL_GIT! EQU !sha! (
|
|
||||||
echo your ALAS is updated
|
|
||||||
timeout /t 2
|
|
||||||
call :run_en
|
|
||||||
) else (
|
|
||||||
start /wait popup.exe
|
|
||||||
choice /t 10 /c yn /d n /m "There is an update for ALAS. Download now?"
|
|
||||||
if errorlevel 2 call :run_cn
|
|
||||||
if errorlevel 1 call :choose_update_mode
|
|
||||||
)
|
|
||||||
endlocal
|
|
||||||
) else (
|
|
||||||
call :run_cn
|
|
||||||
)
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
:run_cn
|
|
||||||
call %PYTHON% --version >nul
|
call %PYTHON% --version >nul
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
echo Python Found in %PYTHON% Proceeding..
|
echo Python Found in %PYTHON% Proceeding..
|
||||||
@@ -288,35 +266,6 @@ endlocal
|
|||||||
)
|
)
|
||||||
:: -----------------------------------------------------------------------------
|
:: -----------------------------------------------------------------------------
|
||||||
:jp
|
:jp
|
||||||
if exist .git\ (
|
|
||||||
%CURL% -s https://api.github.com/repos/lmeszinc/AzurLaneAutoScript/git/refs/heads/master?access_token=%github_token% > %~dp0log\API_GIT.json
|
|
||||||
setlocal enableDelayedExpansion
|
|
||||||
FOR /f "skip=5 tokens=2 delims=:," %%I IN (!API_JSON!) DO IF NOT DEFINED sha SET "sha=%%I"
|
|
||||||
set sha=%sha:"=%
|
|
||||||
set sha=%sha: =%
|
|
||||||
FOR /F "delims=" %%i IN ('%GIT% log -1 "--pretty=%%H"') DO set LAST_LOCAL_GIT=%%i
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
REM echo !sha!
|
|
||||||
REM echo !LAST_LOCAL_GIT!
|
|
||||||
REM echo Parse Ok
|
|
||||||
REM pause
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
if !LAST_LOCAL_GIT! EQU !sha! (
|
|
||||||
echo your ALAS is updated
|
|
||||||
timeout /t 2
|
|
||||||
call :run_en
|
|
||||||
) else (
|
|
||||||
start /wait popup.exe
|
|
||||||
choice /t 10 /c yn /d n /m "There is an update for ALAS. Download now?"
|
|
||||||
if errorlevel 2 call :run_jp
|
|
||||||
if errorlevel 1 call :choose_update_mode
|
|
||||||
)
|
|
||||||
endlocal
|
|
||||||
) else (
|
|
||||||
call :run_jp
|
|
||||||
)
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
:run_jp
|
|
||||||
call %PYTHON% --version >nul
|
call %PYTHON% --version >nul
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
echo Python Found in %PYTHON% Proceeding..
|
echo Python Found in %PYTHON% Proceeding..
|
||||||
@@ -766,6 +715,22 @@ rem Keep local changes
|
|||||||
pause > NUL
|
pause > NUL
|
||||||
call :alas
|
call :alas
|
||||||
)
|
)
|
||||||
|
:: -----------------------------------------------------------------------------
|
||||||
|
:git_update_checker
|
||||||
|
%CURL% -s https://api.github.com/repos/lmeszinc/AzurLaneAutoScript/git/refs/heads/master?access_token=%github_token% > %~dp0log\API_GIT.json
|
||||||
|
FOR /f "skip=5 tokens=2 delims=:," %%I IN (%API_JSON%) DO IF NOT DEFINED sha SET "sha=%%I"
|
||||||
|
set sha=%sha:"=%
|
||||||
|
set sha=%sha: =%
|
||||||
|
FOR /F "delims=" %%i IN ('%GIT% log -1 "--pretty=%%H"') DO set LAST_LOCAL_GIT=%%i
|
||||||
|
:: -----------------------------------------------------------------------------
|
||||||
|
echo %sha%
|
||||||
|
echo %LAST_LOCAL_GIT%
|
||||||
|
echo Parse Ok
|
||||||
|
pause
|
||||||
|
:: -----------------------------------------------------------------------------
|
||||||
|
if %LAST_LOCAL_GIT% EQU %sha% SET run_update=1
|
||||||
|
call :alas
|
||||||
|
|
||||||
:: -----------------------------------------------------------------------------
|
:: -----------------------------------------------------------------------------
|
||||||
::Add paths
|
::Add paths
|
||||||
rem call :AddPath %ALAS_PATH%
|
rem call :AddPath %ALAS_PATH%
|
||||||
|
|||||||
@@ -5,17 +5,18 @@ from module.logger import logger
|
|||||||
|
|
||||||
MAP = CampaignMap('8-1')
|
MAP = CampaignMap('8-1')
|
||||||
MAP.shape = 'I3'
|
MAP.shape = 'I3'
|
||||||
|
MAP.camera_data = ['D1', 'F1']
|
||||||
|
MAP.camera_data_spawn_point = ['D1', 'F1']
|
||||||
MAP.map_data = '''
|
MAP.map_data = '''
|
||||||
SP -- ++ ++ ME -- ME MB ++
|
SP -- ++ ++ ME -- ME MB ++
|
||||||
SP -- ++ ++ ME -- ME -- ME
|
SP -- ++ ++ ME -- ME -- ME
|
||||||
-- ME ME -- ME ++ ME ME MB
|
-- ME ME -- ME ++ ME ME MB
|
||||||
'''
|
'''
|
||||||
MAP.weight_data = '''
|
MAP.weight_data = '''
|
||||||
50 50 50 50 50 50 20 20 20
|
50 50 50 50 50 50 21 30 50
|
||||||
50 50 50 50 25 25 20 20 10
|
50 50 50 50 25 24 20 12 11
|
||||||
50 50 50 45 30 50 20 10 20
|
50 45 40 31 30 50 22 10 20
|
||||||
'''
|
'''
|
||||||
# MAP.camera_data = ['D3']
|
|
||||||
MAP.spawn_data = [
|
MAP.spawn_data = [
|
||||||
{'battle': 0, 'enemy': 3},
|
{'battle': 0, 'enemy': 3},
|
||||||
{'battle': 1, 'enemy': 2},
|
{'battle': 1, 'enemy': 2},
|
||||||
@@ -23,21 +24,18 @@ MAP.spawn_data = [
|
|||||||
{'battle': 3, 'enemy': 1},
|
{'battle': 3, 'enemy': 1},
|
||||||
{'battle': 4, 'boss': 1},
|
{'battle': 4, 'boss': 1},
|
||||||
]
|
]
|
||||||
|
|
||||||
A1, B1, C1, D1, E1, F1, G1, H1, I1, \
|
A1, B1, C1, D1, E1, F1, G1, H1, I1, \
|
||||||
A2, B2, C2, D2, E2, F2, G2, H2, I2, \
|
A2, B2, C2, D2, E2, F2, G2, H2, I2, \
|
||||||
A3, B3, C3, D3, E3, F3, G3, H3, I3, \
|
A3, B3, C3, D3, E3, F3, G3, H3, I3, \
|
||||||
= MAP.flatten()
|
= MAP.flatten()
|
||||||
|
|
||||||
road_main = RoadGrids([B3, C3, E3, E2,[G1, G2], [H3, I2]])
|
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 35
|
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 35
|
||||||
EDGE_LINES_HOUGHLINES_THRESHOLD = 35
|
EDGE_LINES_HOUGHLINES_THRESHOLD = 35
|
||||||
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.3
|
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.3
|
||||||
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
||||||
'height': (150, 255 - 24),
|
'height': (80, 255 - 24),
|
||||||
'width': (0.9, 10),
|
'width': (0.9, 10),
|
||||||
'prominence': 10,
|
'prominence': 10,
|
||||||
'distance': 35,
|
'distance': 35,
|
||||||
@@ -49,7 +47,7 @@ class Config:
|
|||||||
'width': (0, 10),
|
'width': (0, 10),
|
||||||
'wlen': 1000,
|
'wlen': 1000,
|
||||||
}
|
}
|
||||||
|
MAP_SWIPE_MULTIPLY = 1.722
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
@@ -58,18 +56,7 @@ class Campaign(CampaignBase):
|
|||||||
def battle_0(self):
|
def battle_0(self):
|
||||||
self.fleet_2_push_forward()
|
self.fleet_2_push_forward()
|
||||||
|
|
||||||
if self.clear_roadblocks([road_main]):
|
|
||||||
return True
|
|
||||||
if self.clear_potential_roadblocks([road_main]):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.battle_default()
|
return self.battle_default()
|
||||||
|
|
||||||
def battle_4(self):
|
def battle_4(self):
|
||||||
boss = self.map.select(is_boss=True)
|
return self.brute_clear_boss()
|
||||||
if boss:
|
|
||||||
if not self.check_accessibility(boss[0], fleet=2):
|
|
||||||
if self.clear_roadblocks([road_main]):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.fleet_2.clear_boss()
|
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ from module.campaign.campaign_base import CampaignBase
|
|||||||
from module.map.map_base import CampaignMap
|
from module.map.map_base import CampaignMap
|
||||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
|
from .campaign_8_1 import Config as ConfigBase
|
||||||
|
|
||||||
MAP = CampaignMap('8-3')
|
MAP = CampaignMap('8-3')
|
||||||
MAP.shape = 'H5'
|
MAP.shape = 'H5'
|
||||||
|
MAP.camera_data = ['D3', 'E3']
|
||||||
|
MAP.camera_data_spawn_point = ['D3', 'E3']
|
||||||
MAP.map_data = '''
|
MAP.map_data = '''
|
||||||
MB ME -- ++ ++ ME -- MB
|
MB ME -- ++ ++ ME -- MB
|
||||||
ME ME ME -- ++ ME ME --
|
ME ME ME -- ++ ME ME --
|
||||||
@@ -13,14 +16,13 @@ MAP.map_data = '''
|
|||||||
MM ++ ++ ME ME SP -- SP
|
MM ++ ++ ME ME SP -- SP
|
||||||
'''
|
'''
|
||||||
MAP.weight_data = '''
|
MAP.weight_data = '''
|
||||||
90 05 90 90 90 90 90 90
|
50 35 20 90 90 40 50 50
|
||||||
05 90 90 90 90 90 90 90
|
30 40 25 90 90 25 30 50
|
||||||
10 15 20 25 30 35 40 45
|
20 20 20 10 10 20 20 35
|
||||||
90 90 90 90 90 90 90 50
|
50 90 90 60 60 90 90 90
|
||||||
90 90 90 90 90 90 90 90
|
90 90 90 70 80 90 90 90
|
||||||
|
|
||||||
'''
|
'''
|
||||||
# MAP.camera_data = ['D3']
|
|
||||||
MAP.spawn_data = [
|
MAP.spawn_data = [
|
||||||
{'battle': 0, 'enemy': 3},
|
{'battle': 0, 'enemy': 3},
|
||||||
{'battle': 1, 'enemy': 2, 'mystery': 1},
|
{'battle': 1, 'enemy': 2, 'mystery': 1},
|
||||||
@@ -28,7 +30,6 @@ MAP.spawn_data = [
|
|||||||
{'battle': 3, 'enemy': 1},
|
{'battle': 3, 'enemy': 1},
|
||||||
{'battle': 4, 'enemy': 1, 'boss': 1},
|
{'battle': 4, 'enemy': 1, 'boss': 1},
|
||||||
]
|
]
|
||||||
|
|
||||||
A1, B1, C1, D1, E1, F1, G1, H1, \
|
A1, B1, C1, D1, E1, F1, G1, H1, \
|
||||||
A2, B2, C2, D2, E2, F2, G2, H2, \
|
A2, B2, C2, D2, E2, F2, G2, H2, \
|
||||||
A3, B3, C3, D3, E3, F3, G3, H3, \
|
A3, B3, C3, D3, E3, F3, G3, H3, \
|
||||||
@@ -36,47 +37,37 @@ A4, B4, C4, D4, E4, F4, G4, H4, \
|
|||||||
A5, B5, C5, D5, E5, F5, G5, H5, \
|
A5, B5, C5, D5, E5, F5, G5, H5, \
|
||||||
= MAP.flatten()
|
= MAP.flatten()
|
||||||
|
|
||||||
road_main = RoadGrids([A2, B3, D3, E3, G3, H3, H4])
|
road_A1 = RoadGrids([[A2, B1], [B1, B2, B3], [A2, B2, C2], [B3, C2], D3])
|
||||||
|
road_H1 = RoadGrids([[F1, G2, H3], [F1, G2, G3], [F2, G2, H3], [F2, G3], E3])
|
||||||
|
road_MY = RoadGrids([A4, [A2, B3]])
|
||||||
|
road_middle = RoadGrids([E5, [D5, E4], D3]) \
|
||||||
|
.combine(RoadGrids([H4, H3, [F1, G2, G3], [F2, G3], E3]))
|
||||||
|
step_on = SelectedGrids([D3, E3])
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config(ConfigBase):
|
||||||
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 35
|
pass
|
||||||
EDGE_LINES_HOUGHLINES_THRESHOLD = 35
|
|
||||||
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.3
|
|
||||||
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
|
||||||
'height': (150, 255 - 24),
|
|
||||||
'width': (0.9, 10),
|
|
||||||
'prominence': 10,
|
|
||||||
'distance': 35,
|
|
||||||
}
|
|
||||||
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
|
|
||||||
'height': (255 - 24, 255),
|
|
||||||
'prominence': 10,
|
|
||||||
'distance': 50,
|
|
||||||
'width': (0, 10),
|
|
||||||
'wlen': 1000,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
MAP = MAP
|
MAP = MAP
|
||||||
|
|
||||||
def battle_0(self):
|
def battle_0(self):
|
||||||
self.fleet_2_push_forward()
|
if self.fleet_2_step_on(step_on, roadblocks=[road_middle]):
|
||||||
|
|
||||||
if self.clear_roadblocks([road_main]):
|
|
||||||
return True
|
return True
|
||||||
if self.clear_potential_roadblocks([road_main]):
|
|
||||||
|
self.clear_all_mystery()
|
||||||
|
|
||||||
|
if self.clear_roadblocks([road_A1, road_H1]):
|
||||||
|
return True
|
||||||
|
if self.mystery_count < 1 and self.clear_roadblocks([road_MY]):
|
||||||
|
return True
|
||||||
|
if self.clear_potential_roadblocks([road_A1, road_H1]):
|
||||||
|
return True
|
||||||
|
if self.clear_first_roadblocks([road_A1, road_H1]):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return self.battle_default()
|
return self.battle_default()
|
||||||
|
|
||||||
def battle_4(self):
|
def battle_4(self):
|
||||||
boss = self.map.select(is_boss=True)
|
return self.brute_clear_boss()
|
||||||
if boss:
|
|
||||||
if not self.check_accessibility(boss[0], fleet=2):
|
|
||||||
if self.clear_roadblocks([road_main]):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.fleet_2.clear_boss()
|
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ from module.campaign.campaign_base import CampaignBase
|
|||||||
from module.map.map_base import CampaignMap
|
from module.map.map_base import CampaignMap
|
||||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
|
from .campaign_8_1 import Config as ConfigBase
|
||||||
|
|
||||||
MAP = CampaignMap('8-3')
|
MAP = CampaignMap('8-3')
|
||||||
MAP.shape = 'H6'
|
MAP.shape = 'H6'
|
||||||
|
MAP.camera_data = ['D3', 'D4', 'E3', 'E4']
|
||||||
MAP.map_data = '''
|
MAP.map_data = '''
|
||||||
MB -- ME ME ME ME -- MB
|
MB -- ME ME ME ME -- MB
|
||||||
-- ME MM ++ ++ __ ME --
|
-- ME MM ++ ++ __ ME --
|
||||||
@@ -14,15 +16,13 @@ MAP.map_data = '''
|
|||||||
MB -- ME ME ME ME -- MB
|
MB -- ME ME ME ME -- MB
|
||||||
'''
|
'''
|
||||||
MAP.weight_data = '''
|
MAP.weight_data = '''
|
||||||
90 90 90 90 90 90 90 90
|
50 50 40 90 90 30 50 50
|
||||||
90 90 90 90 90 90 90 05
|
50 50 50 90 90 20 40 50
|
||||||
20 90 90 90 90 90 90 90
|
40 90 90 10 10 10 20 20
|
||||||
25 90 90 90 90 90 90 90
|
30 90 90 10 10 90 40 30
|
||||||
30 35 40 45 90 90 90 90
|
20 20 20 10 90 90 40 50
|
||||||
90 90 90 90 90 90 90 90
|
50 30 30 80 80 80 50 50
|
||||||
|
|
||||||
'''
|
'''
|
||||||
# MAP.camera_data = ['D3']
|
|
||||||
MAP.spawn_data = [
|
MAP.spawn_data = [
|
||||||
{'battle': 0, 'enemy': 3},
|
{'battle': 0, 'enemy': 3},
|
||||||
{'battle': 1, 'enemy': 2, 'mystery': 1},
|
{'battle': 1, 'enemy': 2, 'mystery': 1},
|
||||||
@@ -30,7 +30,6 @@ MAP.spawn_data = [
|
|||||||
{'battle': 3, 'enemy': 1},
|
{'battle': 3, 'enemy': 1},
|
||||||
{'battle': 4, 'enemy': 1, 'boss': 1},
|
{'battle': 4, 'enemy': 1, 'boss': 1},
|
||||||
]
|
]
|
||||||
|
|
||||||
A1, B1, C1, D1, E1, F1, G1, H1, \
|
A1, B1, C1, D1, E1, F1, G1, H1, \
|
||||||
A2, B2, C2, D2, E2, F2, G2, H2, \
|
A2, B2, C2, D2, E2, F2, G2, H2, \
|
||||||
A3, B3, C3, D3, E3, F3, G3, H3, \
|
A3, B3, C3, D3, E3, F3, G3, H3, \
|
||||||
@@ -39,47 +38,42 @@ A5, B5, C5, D5, E5, F5, G5, H5, \
|
|||||||
A6, B6, C6, D6, E6, F6, G6, H6, \
|
A6, B6, C6, D6, E6, F6, G6, H6, \
|
||||||
= MAP.flatten()
|
= MAP.flatten()
|
||||||
|
|
||||||
road_main = RoadGrids([D5, B5, A4, A3, H3, H4])
|
road_middle = RoadGrids([D5, F3])
|
||||||
|
step_on = SelectedGrids([D5, F3])
|
||||||
|
# There's one enemy spawn along with boss, so have to make sure there are multiple roads are cleared.
|
||||||
|
# Here use separate roads instead of RoadGrids.combine().
|
||||||
|
road_H1 = RoadGrids([F3, [F1, G2, H3]])
|
||||||
|
road_A6 = RoadGrids([D5, [B5, C6]])
|
||||||
|
road_A1_left = RoadGrids([A4, A3])
|
||||||
|
road_A1_upper = RoadGrids([F1, E1, D1, C1])
|
||||||
|
road_H6_bottom = RoadGrids([D6, E6, F6])
|
||||||
|
road_H6_right = RoadGrids([[H3, G4], [G4, H4], [H4, G5]])
|
||||||
|
road_MY = RoadGrids([[B2, C1]])
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config(ConfigBase):
|
||||||
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 35
|
pass
|
||||||
EDGE_LINES_HOUGHLINES_THRESHOLD = 35
|
|
||||||
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.3
|
|
||||||
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
|
||||||
'height': (150, 255 - 24),
|
|
||||||
'width': (0.9, 10),
|
|
||||||
'prominence': 10,
|
|
||||||
'distance': 35,
|
|
||||||
}
|
|
||||||
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
|
|
||||||
'height': (255 - 24, 255),
|
|
||||||
'prominence': 10,
|
|
||||||
'distance': 50,
|
|
||||||
'width': (0, 10),
|
|
||||||
'wlen': 1000,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
MAP = MAP
|
MAP = MAP
|
||||||
|
|
||||||
def battle_0(self):
|
def battle_0(self):
|
||||||
self.fleet_2_push_forward()
|
if self.fleet_2_step_on(step_on, roadblocks=[road_middle]):
|
||||||
|
|
||||||
if self.clear_roadblocks([road_main]):
|
|
||||||
return True
|
return True
|
||||||
if self.clear_potential_roadblocks([road_main]):
|
|
||||||
|
self.clear_all_mystery()
|
||||||
|
|
||||||
|
if self.clear_roadblocks([road_A6, road_H1, road_A1_left, road_A1_upper, road_H6_bottom, road_H6_right]):
|
||||||
|
return True
|
||||||
|
if self.clear_potential_roadblocks([road_A6, road_H1, road_A1_left, road_A1_upper, road_H6_bottom, road_H6_right]):
|
||||||
|
return True
|
||||||
|
if self.clear_roadblocks([road_MY]):
|
||||||
|
return True
|
||||||
|
if self.clear_first_roadblocks([road_A6, road_H1, road_A1_left, road_A1_upper, road_H6_bottom, road_H6_right]):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return self.battle_default()
|
return self.battle_default()
|
||||||
|
|
||||||
def battle_4(self):
|
def battle_4(self):
|
||||||
boss = self.map.select(is_boss=True)
|
return self.brute_clear_boss()
|
||||||
if boss:
|
|
||||||
if not self.check_accessibility(boss[0], fleet=2):
|
|
||||||
if self.clear_roadblocks([road_main]):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.fleet_2.clear_boss()
|
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ from module.campaign.campaign_base import CampaignBase
|
|||||||
from module.map.map_base import CampaignMap
|
from module.map.map_base import CampaignMap
|
||||||
from module.map.map_grids import SelectedGrids, RoadGrids
|
from module.map.map_grids import SelectedGrids, RoadGrids
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
|
from .campaign_8_1 import Config as ConfigBase
|
||||||
|
|
||||||
MAP = CampaignMap('8-4')
|
MAP = CampaignMap('8-4')
|
||||||
MAP.shape = 'H7'
|
MAP.shape = 'H7'
|
||||||
|
MAP.camera_data = ['D3', 'E3', 'D5', 'E5']
|
||||||
|
MAP.camera_data_spawn_point = ['C1']
|
||||||
MAP.map_data = '''
|
MAP.map_data = '''
|
||||||
++ SP -- -- ME -- ME --
|
++ SP -- -- ME -- ME --
|
||||||
SP -- -- ME -- ++ ++ --
|
SP -- -- ME -- ++ ++ --
|
||||||
@@ -15,15 +18,14 @@ MAP.map_data = '''
|
|||||||
-- ME ME MM ME -- ME MB
|
-- ME ME MM ME -- ME MB
|
||||||
'''
|
'''
|
||||||
MAP.weight_data = '''
|
MAP.weight_data = '''
|
||||||
90 90 90 90 90 90 90 90
|
50 50 50 90 90 90 90 90
|
||||||
90 90 90 90 90 90 90 90
|
50 50 50 90 90 90 90 90
|
||||||
90 90 85 90 90 90 90 90
|
50 50 45 90 90 50 50 90
|
||||||
90 90 80 90 90 90 90 90
|
90 90 40 90 90 30 31 90
|
||||||
90 90 75 70 90 90 90 90
|
50 90 30 30 20 14 12 90
|
||||||
90 90 90 65 90 90 45 10
|
30 27 35 25 90 90 20 11
|
||||||
90 90 90 60 55 50 10 90
|
30 28 26 20 13 15 10 50
|
||||||
'''
|
'''
|
||||||
# MAP.camera_data = ['D3']
|
|
||||||
MAP.spawn_data = [
|
MAP.spawn_data = [
|
||||||
{'battle': 0, 'enemy': 3},
|
{'battle': 0, 'enemy': 3},
|
||||||
{'battle': 1, 'enemy': 2},
|
{'battle': 1, 'enemy': 2},
|
||||||
@@ -31,7 +33,6 @@ MAP.spawn_data = [
|
|||||||
{'battle': 3, 'enemy': 1, 'mystery': 1},
|
{'battle': 3, 'enemy': 1, 'mystery': 1},
|
||||||
{'battle': 4, 'enemy': 2, 'boss': 1},
|
{'battle': 4, 'enemy': 2, 'boss': 1},
|
||||||
]
|
]
|
||||||
|
|
||||||
A1, B1, C1, D1, E1, F1, G1, H1, \
|
A1, B1, C1, D1, E1, F1, G1, H1, \
|
||||||
A2, B2, C2, D2, E2, F2, G2, H2, \
|
A2, B2, C2, D2, E2, F2, G2, H2, \
|
||||||
A3, B3, C3, D3, E3, F3, G3, H3, \
|
A3, B3, C3, D3, E3, F3, G3, H3, \
|
||||||
@@ -41,47 +42,35 @@ A6, B6, C6, D6, E6, F6, G6, H6, \
|
|||||||
A7, B7, C7, D7, E7, F7, G7, H7, \
|
A7, B7, C7, D7, E7, F7, G7, H7, \
|
||||||
= MAP.flatten()
|
= MAP.flatten()
|
||||||
|
|
||||||
road_main = RoadGrids([C5, C3, D6, E7, [G7, H6]])
|
road_D7 = RoadGrids([G7, E7]).combine(RoadGrids([G5, E5, [C5, D6], [D6, C7]]))
|
||||||
|
road_F3 = RoadGrids([G5, [F4, G4], [F4, G3]])
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config(ConfigBase):
|
||||||
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 35
|
pass
|
||||||
EDGE_LINES_HOUGHLINES_THRESHOLD = 35
|
|
||||||
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.3
|
|
||||||
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
|
||||||
'height': (150, 255 - 24),
|
|
||||||
'width': (0.9, 10),
|
|
||||||
'prominence': 10,
|
|
||||||
'distance': 35,
|
|
||||||
}
|
|
||||||
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
|
|
||||||
'height': (255 - 24, 255),
|
|
||||||
'prominence': 10,
|
|
||||||
'distance': 50,
|
|
||||||
'width': (0, 10),
|
|
||||||
'wlen': 1000,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
MAP = MAP
|
MAP = MAP
|
||||||
|
# Need to increase this threshold a little bit, because of mis-detection on dark background
|
||||||
|
MAP_AMBUSH_OVERLAY_TRANSPARENCY_THRESHOLD = 0.45
|
||||||
|
MAP_AIR_RAID_OVERLAY_TRANSPARENCY_THRESHOLD = 0.45 # Usually (0.50, 0.53)
|
||||||
|
|
||||||
def battle_0(self):
|
def battle_0(self):
|
||||||
self.fleet_2_push_forward()
|
self.fleet_2_push_forward()
|
||||||
|
|
||||||
if self.clear_roadblocks([road_main]):
|
self.clear_all_mystery()
|
||||||
|
|
||||||
|
if self.clear_roadblocks([road_D7, road_F3]):
|
||||||
return True
|
return True
|
||||||
if self.clear_potential_roadblocks([road_main]):
|
if self.clear_potential_roadblocks([road_D7, road_F3]):
|
||||||
|
return True
|
||||||
|
if self.clear_first_roadblocks([road_D7, road_F3]):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return self.battle_default()
|
return self.battle_default()
|
||||||
|
|
||||||
def battle_4(self):
|
def battle_4(self):
|
||||||
boss = self.map.select(is_boss=True)
|
self.clear_all_mystery()
|
||||||
if boss:
|
|
||||||
if not self.check_accessibility(boss[0], fleet=2):
|
|
||||||
if self.clear_roadblocks([road_main]):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.fleet_2.clear_boss()
|
return self.brute_clear_boss()
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ class Equipment(UI):
|
|||||||
Returns:
|
Returns:
|
||||||
bool: if changed.
|
bool: if changed.
|
||||||
"""
|
"""
|
||||||
|
if index <= 0 or index > 5:
|
||||||
|
logger.warning(f'Sidebar index cannot be clicked, {index}, limit to 1 through 5 only')
|
||||||
|
return False
|
||||||
|
|
||||||
current = 0
|
current = 0
|
||||||
total = 0
|
total = 0
|
||||||
|
|
||||||
@@ -96,6 +100,7 @@ class Equipment(UI):
|
|||||||
current = 6 - current
|
current = 6 - current
|
||||||
else:
|
else:
|
||||||
logger.warning('Ship details sidebar total count error.')
|
logger.warning('Ship details sidebar total count error.')
|
||||||
|
return True
|
||||||
|
|
||||||
logger.attr('Detail_sidebar', f'{current}/{total}')
|
logger.attr('Detail_sidebar', f'{current}/{total}')
|
||||||
if current == index:
|
if current == index:
|
||||||
@@ -113,7 +118,17 @@ class Equipment(UI):
|
|||||||
3 for limit break.
|
3 for limit break.
|
||||||
2 for gem / equipment.
|
2 for gem / equipment.
|
||||||
1 for detail.
|
1 for detail.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: whether sidebar could be ensured
|
||||||
|
at most 3 attempts are made before
|
||||||
|
return False otherwise True
|
||||||
"""
|
"""
|
||||||
|
if index <= 0 or index > 5:
|
||||||
|
logger.warning(f'Sidebar index cannot be ensured, {index}, limit 1 through 5 only')
|
||||||
|
return False
|
||||||
|
|
||||||
|
counter = 0
|
||||||
while 1:
|
while 1:
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
skip_first_screenshot = False
|
skip_first_screenshot = False
|
||||||
@@ -121,10 +136,14 @@ class Equipment(UI):
|
|||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
|
|
||||||
if self._equip_sidebar_click(index):
|
if self._equip_sidebar_click(index):
|
||||||
|
if counter > 2:
|
||||||
|
logger.warning('Sidebar could not be ensured')
|
||||||
|
return False
|
||||||
|
counter += 1
|
||||||
self.device.sleep((0.3, 0.5))
|
self.device.sleep((0.3, 0.5))
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
return True
|
||||||
|
|
||||||
def _equip_take_off_one(self):
|
def _equip_take_off_one(self):
|
||||||
bar_timer = Timer(5)
|
bar_timer = Timer(5)
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ class Map(Fleet):
|
|||||||
Returns:
|
Returns:
|
||||||
bool: False, because didn't clear any enemy.
|
bool: False, because didn't clear any enemy.
|
||||||
"""
|
"""
|
||||||
|
kwargs['sort'] = ('cost',)
|
||||||
while 1:
|
while 1:
|
||||||
grids = self.map.select(is_mystery=True)
|
grids = self.map.select(is_mystery=True)
|
||||||
grids = self.select_grids(grids, **kwargs)
|
grids = self.select_grids(grids, **kwargs)
|
||||||
@@ -207,6 +208,29 @@ class Map(Fleet):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def clear_first_roadblocks(self, roads, **kwargs):
|
||||||
|
"""Ensure every roadblocks have one grid with is_cleared=True.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
roads(list[RoadGrids]):
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if clear an enemy.
|
||||||
|
"""
|
||||||
|
grids = SelectedGrids([])
|
||||||
|
for road in roads:
|
||||||
|
grids = grids.add(road.first_roadblocks())
|
||||||
|
|
||||||
|
grids = self.select_grids(grids, **kwargs)
|
||||||
|
|
||||||
|
if grids:
|
||||||
|
logger.hr('Clear first roadblock')
|
||||||
|
self.show_select_grids(grids, **kwargs)
|
||||||
|
self.clear_chosen_enemy(grids[0])
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def clear_grids_for_faster(self, grids, **kwargs):
|
def clear_grids_for_faster(self, grids, **kwargs):
|
||||||
"""Clear some grids to walk a shorter distance.
|
"""Clear some grids to walk a shorter distance.
|
||||||
|
|
||||||
@@ -285,20 +309,32 @@ class Map(Fleet):
|
|||||||
Method to step on all boss spawn point when boss not detected.
|
Method to step on all boss spawn point when boss not detected.
|
||||||
"""
|
"""
|
||||||
grids = self.map.select(may_boss=True, is_accessible=True)
|
grids = self.map.select(may_boss=True, is_accessible=True)
|
||||||
logger.info('May boss: %s' % self.map.select(may_boss=True))
|
logger.info('May boss: %s' % grids)
|
||||||
battle_count = self.battle_count
|
battle_count = self.battle_count
|
||||||
|
|
||||||
for grid in grids:
|
for grid in grids:
|
||||||
logger.hr('Clear potential BOSS')
|
logger.hr('Clear potential BOSS')
|
||||||
grids = grids.sort('weight', 'cost')
|
grids = grids.sort('weight', 'cost')
|
||||||
logger.info('Grid: %s' % str(grid))
|
logger.info('Grid: %s' % str(grid))
|
||||||
self.clear_chosen_enemy(grid)
|
self.fleet_boss.clear_chosen_enemy(grid)
|
||||||
if self.battle_count > battle_count:
|
if self.battle_count > battle_count:
|
||||||
logger.info('Boss guessing correct.')
|
logger.info('Boss guessing correct.')
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
logger.info('Boss guessing incorrect.')
|
logger.info('Boss guessing incorrect.')
|
||||||
|
|
||||||
|
grids = self.map.select(may_boss=True, is_accessible=False)
|
||||||
|
logger.info('May boss: %s' % grids)
|
||||||
|
|
||||||
|
for grid in grids:
|
||||||
|
logger.hr('Clear potential BOSS roadblocks')
|
||||||
|
fleet = 2 if self.config.FLEET_BOSS == 2 and self.config.FLEET_2 else 1
|
||||||
|
roadblocks = self.brute_find_roadblocks(grid, fleet=fleet)
|
||||||
|
roadblocks = roadblocks.sort('weight', 'cost')
|
||||||
|
logger.info('Grids: %s' % str(roadblocks))
|
||||||
|
self.fleet_1.clear_chosen_enemy(roadblocks[0])
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def brute_clear_boss(self):
|
def brute_clear_boss(self):
|
||||||
@@ -383,13 +419,14 @@ class Map(Fleet):
|
|||||||
for grid in grids:
|
for grid in grids:
|
||||||
if self.fleet_at(grid=grid, fleet=2):
|
if self.fleet_at(grid=grid, fleet=2):
|
||||||
return False
|
return False
|
||||||
if grids.count == len([grid for grid in grids if grid.is_enemy or grid.is_cleared]):
|
# if grids.count == len([grid for grid in grids if grid.is_enemy or grid.is_cleared]):
|
||||||
logger.info('Fleet 2 step on, no need')
|
# logger.info('Fleet 2 step on, no need')
|
||||||
return False
|
# return False
|
||||||
|
all_cleared = grids.select(is_cleared=True).count == grids.count
|
||||||
|
|
||||||
logger.info('Fleet 2 step on')
|
logger.info('Fleet 2 step on')
|
||||||
for grid in grids:
|
for grid in grids:
|
||||||
if grid.is_enemy or grid.is_cleared:
|
if grid.is_enemy or (not all_cleared and grid.is_cleared):
|
||||||
continue
|
continue
|
||||||
if self.check_accessibility(grid=grid, fleet=2):
|
if self.check_accessibility(grid=grid, fleet=2):
|
||||||
logger.info('Fleet_2 step on %s' % grid)
|
logger.info('Fleet_2 step on %s' % grid)
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class RoadGrids:
|
|||||||
grids += block.select(is_enemy=True).grids
|
grids += block.select(is_enemy=True).grids
|
||||||
return SelectedGrids(grids)
|
return SelectedGrids(grids)
|
||||||
|
|
||||||
def first_roadblock(self):
|
def first_roadblocks(self):
|
||||||
"""
|
"""
|
||||||
Returns:
|
Returns:
|
||||||
SelectedGrids:
|
SelectedGrids:
|
||||||
@@ -197,7 +197,7 @@ class RoadGrids:
|
|||||||
continue
|
continue
|
||||||
if np.any([grid.is_cleared for grid in block]):
|
if np.any([grid.is_cleared for grid in block]):
|
||||||
continue
|
continue
|
||||||
if block.select(is_enemy=True).count == 1:
|
if block.select(is_enemy=True).count >= 1:
|
||||||
grids += block.select(is_enemy=True).grids
|
grids += block.select(is_enemy=True).grids
|
||||||
return SelectedGrids(grids)
|
return SelectedGrids(grids)
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,12 @@ class GridInfo:
|
|||||||
Returns:
|
Returns:
|
||||||
bool: If success.
|
bool: If success.
|
||||||
"""
|
"""
|
||||||
|
if info.is_caught_by_siren:
|
||||||
|
if self.is_sea:
|
||||||
|
self.is_fleet = True
|
||||||
|
self.is_caught_by_siren = True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
if info.is_fleet:
|
if info.is_fleet:
|
||||||
if self.is_sea:
|
if self.is_sea:
|
||||||
self.is_fleet = True
|
self.is_fleet = True
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class GridPredictor:
|
|||||||
self.is_fleet = self.predict_fleet()
|
self.is_fleet = self.predict_fleet()
|
||||||
self.is_mystery = self.predict_mystery()
|
self.is_mystery = self.predict_mystery()
|
||||||
self.is_current_fleet = self.predict_current_fleet()
|
self.is_current_fleet = self.predict_current_fleet()
|
||||||
|
# self.is_caught_by_siren = self.predict_caught_by_siren()
|
||||||
|
|
||||||
if self.enemy_genre:
|
if self.enemy_genre:
|
||||||
self.is_enemy = True
|
self.is_enemy = True
|
||||||
@@ -182,6 +183,10 @@ class GridPredictor:
|
|||||||
image = color_similarity_2d(image, color=(255, 255, 255))
|
image = color_similarity_2d(image, color=(255, 255, 255))
|
||||||
return TEMPLATE_FLEET_AMMO.match(image)
|
return TEMPLATE_FLEET_AMMO.match(image)
|
||||||
|
|
||||||
|
def predict_caught_by_siren(self):
|
||||||
|
image = self.relative_crop((-1, -1.5, 1, 0.5), shape=(120, 120))
|
||||||
|
return TEMPLATE_CAUGHT_BY_SIREN.match(image, similarity=0.6)
|
||||||
|
|
||||||
def predict_mystery(self):
|
def predict_mystery(self):
|
||||||
"""
|
"""
|
||||||
Returns:
|
Returns:
|
||||||
|
|||||||
@@ -152,7 +152,16 @@ class ResearchProject:
|
|||||||
"""
|
"""
|
||||||
name1 = self.name.rstrip('MIRFUL-')
|
name1 = self.name.rstrip('MIRFUL-')
|
||||||
name2 = name.rstrip('MIRFUL-')
|
name2 = name.rstrip('MIRFUL-')
|
||||||
return name1 == name2
|
if name1 == name2:
|
||||||
|
return True
|
||||||
|
elif self.name.startswith('D'):
|
||||||
|
# Letter 'C' may recognized as 'D', because project card is shining.
|
||||||
|
name1 = 'C' + self.name[1:]
|
||||||
|
if name1 == name:
|
||||||
|
self.name = name1
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class ResearchSelector(UI):
|
class ResearchSelector(UI):
|
||||||
|
|||||||
@@ -21,52 +21,52 @@ filter_index_all.add_status('on', check_button=FILTER_INDEX_ALL_ON)
|
|||||||
filter_index_all.add_status('off', check_button=FILTER_INDEX_ALL_OFF)
|
filter_index_all.add_status('off', check_button=FILTER_INDEX_ALL_OFF)
|
||||||
|
|
||||||
filter_index_clear = Switch('Filter_index_clear')
|
filter_index_clear = Switch('Filter_index_clear')
|
||||||
filter_index_clear.add_status('on', check_button=FILTER_INDEX_CLEAR_ON)
|
filter_index_clear.add_status('on', check_button=FILTER_INDEX_CLEAR_ON, offset=(30, 30))
|
||||||
filter_index_clear.add_status('off', check_button=FILTER_INDEX_CLEAR_OFF)
|
filter_index_clear.add_status('off', check_button=FILTER_INDEX_CLEAR_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_dd = Switch('Filter_index_dd')
|
filter_index_dd = Switch('Filter_index_dd')
|
||||||
filter_index_dd.add_status('on', check_button=FILTER_INDEX_DD_ON)
|
filter_index_dd.add_status('on', check_button=FILTER_INDEX_DD_ON, offset=(30, 30))
|
||||||
filter_index_dd.add_status('off', check_button=FILTER_INDEX_DD_OFF)
|
filter_index_dd.add_status('off', check_button=FILTER_INDEX_DD_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_cl = Switch('Filter_index_cl')
|
filter_index_cl = Switch('Filter_index_cl')
|
||||||
filter_index_cl.add_status('on', check_button=FILTER_INDEX_CL_ON)
|
filter_index_cl.add_status('on', check_button=FILTER_INDEX_CL_ON, offset=(30, 30))
|
||||||
filter_index_cl.add_status('off', check_button=FILTER_INDEX_CL_OFF)
|
filter_index_cl.add_status('off', check_button=FILTER_INDEX_CL_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_ca = Switch('Filter_index_ca')
|
filter_index_ca = Switch('Filter_index_ca')
|
||||||
filter_index_ca.add_status('on', check_button=FILTER_INDEX_CA_ON)
|
filter_index_ca.add_status('on', check_button=FILTER_INDEX_CA_ON, offset=(30, 30))
|
||||||
filter_index_ca.add_status('off', check_button=FILTER_INDEX_CA_OFF)
|
filter_index_ca.add_status('off', check_button=FILTER_INDEX_CA_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_bb = Switch('Filter_index_bb')
|
filter_index_bb = Switch('Filter_index_bb')
|
||||||
filter_index_bb.add_status('on', check_button=FILTER_INDEX_BB_ON)
|
filter_index_bb.add_status('on', check_button=FILTER_INDEX_BB_ON, offset=(30, 30))
|
||||||
filter_index_bb.add_status('off', check_button=FILTER_INDEX_BB_OFF)
|
filter_index_bb.add_status('off', check_button=FILTER_INDEX_BB_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_cv = Switch('Filter_index_cv')
|
filter_index_cv = Switch('Filter_index_cv')
|
||||||
filter_index_cv.add_status('on', check_button=FILTER_INDEX_CV_ON)
|
filter_index_cv.add_status('on', check_button=FILTER_INDEX_CV_ON, offset=(30, 30))
|
||||||
filter_index_cv.add_status('off', check_button=FILTER_INDEX_CV_OFF)
|
filter_index_cv.add_status('off', check_button=FILTER_INDEX_CV_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_repair = Switch('Filter_index_repair')
|
filter_index_repair = Switch('Filter_index_repair')
|
||||||
filter_index_repair.add_status('on', check_button=FILTER_INDEX_REPAIR_ON)
|
filter_index_repair.add_status('on', check_button=FILTER_INDEX_REPAIR_ON, offset=(30, 30))
|
||||||
filter_index_repair.add_status('off', check_button=FILTER_INDEX_REPAIR_OFF)
|
filter_index_repair.add_status('off', check_button=FILTER_INDEX_REPAIR_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_ss = Switch('Filter_index_ss')
|
filter_index_ss = Switch('Filter_index_ss')
|
||||||
filter_index_ss.add_status('on', check_button=FILTER_INDEX_SS_ON)
|
filter_index_ss.add_status('on', check_button=FILTER_INDEX_SS_ON, offset=(30, 30))
|
||||||
filter_index_ss.add_status('off', check_button=FILTER_INDEX_SS_OFF)
|
filter_index_ss.add_status('off', check_button=FILTER_INDEX_SS_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_index_others = Switch('Filter_index_others')
|
filter_index_others = Switch('Filter_index_others')
|
||||||
filter_index_others.add_status('on', check_button=FILTER_INDEX_OTHERS_ON)
|
filter_index_others.add_status('on', check_button=FILTER_INDEX_OTHERS_ON, offset=(30, 30))
|
||||||
filter_index_others.add_status('off', check_button=FILTER_INDEX_OTHERS_OFF)
|
filter_index_others.add_status('off', check_button=FILTER_INDEX_OTHERS_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_sort_lvl = Switch('Filter_sort_lvl')
|
filter_sort_lvl = Switch('Filter_sort_lvl')
|
||||||
filter_sort_lvl.add_status('on', check_button=FILTER_SORT_LVL_ON)
|
filter_sort_lvl.add_status('on', check_button=FILTER_SORT_LVL_ON, offset=(30, 30))
|
||||||
filter_sort_lvl.add_status('off', check_button=FILTER_SORT_LVL_OFF)
|
filter_sort_lvl.add_status('off', check_button=FILTER_SORT_LVL_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_rarity_all = Switch('Filter_rarity_all')
|
filter_rarity_all = Switch('Filter_rarity_all')
|
||||||
filter_rarity_all.add_status('on', check_button=FILTER_RARITY_ALL_ON)
|
filter_rarity_all.add_status('on', check_button=FILTER_RARITY_ALL_ON, offset=(30, 30))
|
||||||
filter_rarity_all.add_status('off', check_button=FILTER_RARITY_ALL_OFF)
|
filter_rarity_all.add_status('off', check_button=FILTER_RARITY_ALL_OFF, offset=(30, 30))
|
||||||
|
|
||||||
filter_faction_all = Switch('Filter_faction_all')
|
filter_faction_all = Switch('Filter_faction_all')
|
||||||
filter_faction_all.add_status('on', check_button=FILTER_FACTION_ALL_ON)
|
filter_faction_all.add_status('on', check_button=FILTER_FACTION_ALL_ON, offset=(30, 30))
|
||||||
filter_faction_all.add_status('off', check_button=FILTER_FACTION_ALL_OFF)
|
filter_faction_all.add_status('off', check_button=FILTER_FACTION_ALL_OFF, offset=(30, 30))
|
||||||
|
|
||||||
CARD_GRIDS = ButtonGrid(
|
CARD_GRIDS = ButtonGrid(
|
||||||
origin=(93, 76), delta=(164 + 2 / 3, 227), button_shape=(138, 204), grid_shape=(7, 2), name='CARD')
|
origin=(93, 76), delta=(164 + 2 / 3, 227), button_shape=(138, 204), grid_shape=(7, 2), name='CARD')
|
||||||
|
|||||||
@@ -108,8 +108,11 @@ class Enhancement(Dock):
|
|||||||
if not end_activate_timer.reached_and_reset():
|
if not end_activate_timer.reached_and_reset():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.equip_sidebar_ensure(index=4)
|
ensured = self.equip_sidebar_ensure(index=4)
|
||||||
self.wait_until_appear(ENHANCE_RECOMMEND, offset=(5, 5), skip_first_screenshot=True)
|
if ensured:
|
||||||
|
self.wait_until_appear(ENHANCE_RECOMMEND, offset=(5, 5), skip_first_screenshot=True)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
status = color_bar_percentage(self.device.image, area=ENHANCE_RELOAD.area, prev_color=(231, 178, 74))
|
status = color_bar_percentage(self.device.image, area=ENHANCE_RELOAD.area, prev_color=(231, 178, 74))
|
||||||
logger.attr('Reload_enhanced', f'{int(status * 100)}%')
|
logger.attr('Reload_enhanced', f'{int(status * 100)}%')
|
||||||
@@ -165,8 +168,11 @@ class Enhancement(Dock):
|
|||||||
if not end_activate_timer.reached_and_reset():
|
if not end_activate_timer.reached_and_reset():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.equip_sidebar_ensure(index=4)
|
ensured = self.equip_sidebar_ensure(index=4)
|
||||||
self.wait_until_appear(ENHANCE_RECOMMEND, offset=(5, 5), skip_first_screenshot=True)
|
if ensured:
|
||||||
|
self.wait_until_appear(ENHANCE_RECOMMEND, offset=(5, 5), skip_first_screenshot=True)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
if self.info_bar_count():
|
if self.info_bar_count():
|
||||||
if attempt_count >= 1:
|
if attempt_count >= 1:
|
||||||
@@ -176,10 +182,9 @@ class Enhancement(Dock):
|
|||||||
if not swiped or next_count >= 3:
|
if not swiped or next_count >= 3:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
attempt_count = 0
|
attempt_count = -1
|
||||||
logger.info(f'Try next ship: {3 - next_count}/3 remaining until give up')
|
logger.info(f'Try next ship: {3 - next_count}/3 remaining until give up')
|
||||||
next_count += 1
|
next_count += 1
|
||||||
continue
|
|
||||||
attempt_count += 1
|
attempt_count += 1
|
||||||
|
|
||||||
if self.appear_then_click(ENHANCE_RECOMMEND, offset=(5, 5), interval=2):
|
if self.appear_then_click(ENHANCE_RECOMMEND, offset=(5, 5), interval=2):
|
||||||
|
|||||||
Reference in New Issue
Block a user