自动战斗适配被进怪时采取策略

This commit is contained in:
Elaina 2024-11-04 18:59:19 +08:00
parent f5e33aff05
commit 2369a0c078
4 changed files with 18 additions and 0 deletions

BIN
mower/resources/fight/breach.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -1,4 +1,5 @@
from mower.solvers.navigation import NavigationSolver
from mower.utils import config
from mower.utils.graph import SceneGraphSolver
from mower.utils.log import logger
from mower.utils.scene import Scene
@ -44,11 +45,23 @@ class AutoFight(SceneGraphSolver, FightMixin):
"获取击杀数"
return super().kills(((800, 30), (950, 60)))
def breach_solver(self):
if (strategy := config.conf.work.enemy_breach_strategy) == "give_up":
self.scene_graph_navigation(Scene.OPERATOR_FAILED)
elif strategy == "restart_game":
config.device.exit()
self.success = False
return True
return False
def transition(self):
if (scene := self.scene()) == Scene.OPERATOR_FIGHT:
if self.loading:
self.fight_init()
return
if self.find("fight/breach"):
if self.breach_solver():
return True
self.travel_watching_skills()
self.execute_action()

View file

@ -38,6 +38,7 @@ color = {
"double_confirm/voice": (745, 435),
"drone": (274, 437),
"factory_collect": (1542, 886),
"fight/breach": (1246, 23),
"fight/collection": (1088, 25),
"fight/collection_on": (1084, 22),
"fight/give_up": (1352, 838),

View file

@ -160,6 +160,7 @@ Res = Literal[
"factory_accelerate",
"factory_collect",
"fight/attack",
"fight/breach",
"fight/c",
"fight/c_mask",
"fight/choose",