切换副手追加已在位置的干员进入黑名单

This commit is contained in:
Elaina 2024-10-25 16:22:37 +08:00
parent 6818d15017
commit bae8ad5dd0

View file

@ -7,6 +7,8 @@ from mower.solvers.fight.battle_choose.battle_fill_choose import BattleFillChoos
from mower.solvers.infra.base_mixin import BaseMixin
from mower.utils import config
from mower.utils import typealias as tp
from mower.utils.character_recognize import match_portrait
from mower.utils.email import send_message
from mower.utils.graph import SceneGraphSolver
from mower.utils.image import cropimg, thres2
from mower.utils.log import logger
@ -20,18 +22,32 @@ trust_number_scope = [
((950, 950), (1030, 980)),
]
portrait_scope = [
((542, 250), (729, 380)),
((183, 713), (370, 823)),
((423, 713), (610, 823)),
((663, 713), (850, 823)),
((903, 713), (1090, 823)),
]
class SwitchAssistantsSolver(SceneGraphSolver, BaseMixin):
def run(self) -> None:
logger.info("Start:切换高信赖基建副手")
self.start_time = datetime.now()
self.limit = config.conf.trust_limit # 设置的信赖值阈值
self.black_list = [] # 记录选择过的干员
self.black_list = list(
self.current_operators.keys()
) # 记录已在位置和选择过的干员
super().run()
def timeout(self) -> bool:
return datetime.now() > self.start_time + timedelta(seconds=180)
@property
def current_operators(self) -> tp.Dict[str, tp.Scope]:
return dict(match_portrait(config.recog.gray, segment=portrait_scope))
def number(self, scope: tp.Scope, height: int, thres: int) -> int:
"数字识别"
img = cropimg(config.recog.gray, scope)
@ -64,7 +80,8 @@ class SwitchAssistantsSolver(SceneGraphSolver, BaseMixin):
def transition(self) -> bool:
if self.timeout():
logger.error("切换高信赖基建副手超时,请检查干员和设置的阈值")
logger.error("切换高信赖基建副手超时,请检查干员信赖和设置的阈值")
send_message("切换高信赖基建副手超时,请检查干员信赖和设置的阈值")
self.scene_graph_navigation(Scene.INFRA_MAIN)
return True
if (scene := self.scene()) == Scene.RIIC_REPORT: