mirror of
https://github.com/sui-feng-cb/AzurLaneAutoScript1.git
synced 2026-07-13 02:54:25 +08:00
Add: submarine call timing
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
from module.base.base import ModuleBase
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import color_similar, crop, get_color, image_color_count
|
||||
from module.combat.assets import *
|
||||
from module.logger import logger
|
||||
|
||||
# BOSS detection areas
|
||||
# Classic UI: BOSS avatar frame right border
|
||||
BOSS_AVATAR_FRAME_RIGHT = (301, 13, 303, 89)
|
||||
BOSS_AVATAR_FRAME_COLOR = (24, 28, 24)
|
||||
# New UI: BOSS HP bar bottom border, middle-left portion
|
||||
# Color targets deep blue themes; need adjustment for other color schemes
|
||||
BOSS_HP_BAR_BORDER = (420, 48, 620, 50)
|
||||
BOSS_HP_BAR_COLOR = (31, 39, 61)
|
||||
|
||||
|
||||
class SubmarineCall(ModuleBase):
|
||||
submarine_call_flag = False
|
||||
@@ -16,6 +26,20 @@ class SubmarineCall(ModuleBase):
|
||||
self.submarine_call_timer.reset()
|
||||
self.submarine_call_flag = False
|
||||
|
||||
def boss_appeared(self):
|
||||
"""
|
||||
Detect whether BOSS has appeared by checking stable BOSS UI elements.
|
||||
"""
|
||||
# New UI: BOSS HP bar bottom border
|
||||
avg = get_color(self.device.image, BOSS_HP_BAR_BORDER)
|
||||
if color_similar(avg, BOSS_HP_BAR_COLOR, threshold=40):
|
||||
return True
|
||||
# Classic UI: BOSS avatar frame right border
|
||||
frame = crop(self.device.image, BOSS_AVATAR_FRAME_RIGHT, copy=False)
|
||||
if image_color_count(frame, color=BOSS_AVATAR_FRAME_COLOR, count=55):
|
||||
return True
|
||||
return False
|
||||
|
||||
def handle_submarine_call(self, call_mode='do_not_use', is_boss=False):
|
||||
"""
|
||||
Args:
|
||||
@@ -31,6 +55,10 @@ class SubmarineCall(ModuleBase):
|
||||
self.submarine_call_flag = True
|
||||
return False
|
||||
|
||||
if self.config.Submarine_Timing == 'wait_for_boss' and is_boss:
|
||||
if not self.boss_appeared():
|
||||
self.submarine_call_timer.reset()
|
||||
return False
|
||||
if self.submarine_call_timer.reached():
|
||||
logger.info('Submarine call timer reached')
|
||||
self.submarine_call_flag = True
|
||||
|
||||
@@ -921,6 +921,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -1323,6 +1331,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -1725,6 +1741,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -2225,6 +2249,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -2641,6 +2673,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -3059,6 +3099,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -4470,6 +4518,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -4906,6 +4962,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -5342,6 +5406,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -5778,6 +5850,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -6214,6 +6294,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
@@ -6641,6 +6729,14 @@
|
||||
"every_combat"
|
||||
]
|
||||
},
|
||||
"Timing": {
|
||||
"type": "select",
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"wait_for_boss"
|
||||
]
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"type": "select",
|
||||
"value": "2_grid_to_boss",
|
||||
|
||||
@@ -222,6 +222,9 @@ Submarine:
|
||||
CallMode:
|
||||
value: do_not_use
|
||||
option: [ do_not_use, boss_only, every_combat ]
|
||||
Timing:
|
||||
value: default
|
||||
option: [ default, wait_for_boss ]
|
||||
DistanceToBoss:
|
||||
value: '2_grid_to_boss'
|
||||
option: [ to_boss_position, 1_grid_to_boss, 2_grid_to_boss, use_open_ocean_support ]
|
||||
|
||||
@@ -115,6 +115,7 @@ class GeneratedConfig:
|
||||
Submarine_AutoSearchMode = 'sub_standby' # sub_standby, sub_auto_call
|
||||
Submarine_HuntMode = 'do_not_use' # do_not_use, hunt
|
||||
Submarine_CallMode = 'do_not_use' # do_not_use, boss_only, every_combat
|
||||
Submarine_Timing = 'default' # default, wait_for_boss
|
||||
Submarine_DistanceToBoss = '2_grid_to_boss' # to_boss_position, 1_grid_to_boss, 2_grid_to_boss, use_open_ocean_support
|
||||
|
||||
# Group `Emotion`
|
||||
|
||||
@@ -1064,6 +1064,12 @@
|
||||
"boss_only": "BOSS Only",
|
||||
"every_combat": "Every Combat"
|
||||
},
|
||||
"Timing": {
|
||||
"name": "BOSS Battle Call Timing (Experimental)",
|
||||
"help": "Note: 'Wait For BOSS' currently only supports: Classic UI, and new UI with solid deep blue HP bar borders! Using unsupported UIs will prevent submarines from being called!",
|
||||
"default": "Default (call immediately after entering combat)",
|
||||
"wait_for_boss": "Wait For BOSS"
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"name": "Before BOSS battle move the submarine near BOSS",
|
||||
"help": "Effective only if \"Call Submarine\" is \"BOSS Only\"\nSelecting \"X Grids To BOSS\" needs to ensure that the submarine hunting range can cover the BOSS. Distance is calculated using the Manhattan Distance. Selecting \"Use Open Ocean Support\" requires submarine with aforementioned skill",
|
||||
|
||||
@@ -1064,6 +1064,12 @@
|
||||
"boss_only": "BOSS戦のみ",
|
||||
"every_combat": "毎戦"
|
||||
},
|
||||
"Timing": {
|
||||
"name": "BOSS戦召喚タイミング(テスト中)",
|
||||
"help": "注意:'BOSS出現待機'現在のみ:クラシックUI、HPバー枠が深青一色の新型UIのみサポート!認識できないUIを使用すると潜水艦が出撃しません!",
|
||||
"default": "デフォルト(戦闘開始直後に召喚を試みる)",
|
||||
"wait_for_boss": "BOSS出現待機"
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"name": "BOSS戦前に潜水艦をBOSS付近に移動",
|
||||
"help": "\"潜水艦出撃設定\"が\"BOSS戦のみ\"の場合のみ有効\n\"BOSSまでXマス\"を選択する場合、潜水艦の狩猟範囲がBOSSまで届くことを確認してください。距離はマンハッタン距離で計算されます。\"遠洋支援を使用\"を選択する場合はU522/ダ・ヴィンチなどの遠洋支援スキルを持つ艦娘が必要です",
|
||||
|
||||
@@ -1064,6 +1064,12 @@
|
||||
"boss_only": "仅BOSS战",
|
||||
"every_combat": "每场战斗"
|
||||
},
|
||||
"Timing": {
|
||||
"name": "BOSS战召唤时机(测试中)",
|
||||
"help": "注意:'等待BOSS出现'当前仅支持:经典UI、血条边框为深蓝纯色的新型UI!若使用无法识别的UI将导致潜艇不出击!",
|
||||
"default": "默认(进战立即尝试召唤)",
|
||||
"wait_for_boss": "等待boss出现"
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"name": "BOSS战前将潜艇移动到BOSS附近",
|
||||
"help": "仅在\"潜艇出击方案\"为\"仅BOSS战\"时生效\n选择\"距离BOSS X格\"需要保证潜艇狩猎范围能覆盖到BOSS,距离使用曼哈顿距离计算;选择\"使用远洋支援\"需要潜艇队伍里有具备远洋支援技能的舰娘,如U522、达芬奇等",
|
||||
|
||||
@@ -1064,6 +1064,12 @@
|
||||
"boss_only": "僅BOSS戰",
|
||||
"every_combat": "每場戰鬥"
|
||||
},
|
||||
"Timing": {
|
||||
"name": "BOSS戰召喚時機(測試中)",
|
||||
"help": "注意:'等待BOSS出現'目前僅支援:經典UI、血條邊框為深藍純色的新型UI!若使用無法識別的UI將導致潛艇不出擊!",
|
||||
"default": "預設(進戰立即嘗試召喚)",
|
||||
"wait_for_boss": "等待BOSS出現"
|
||||
},
|
||||
"DistanceToBoss": {
|
||||
"name": "BOSS戰前將潛艇移動到BOSS附近",
|
||||
"help": "僅在\"潛艇出擊方案\"為\"僅BOSS戰\"時生效\n選擇\"距離BOSS X格\"需要保證潛艇狩獵範圍能覆蓋到BOSS,距離使用曼哈頓距離計算,選擇\"使用遠洋支援\"需要潛艇隊伍裡有U522或是達芬奇",
|
||||
|
||||
Reference in New Issue
Block a user