mower-ng/mower/solvers/navigation/__init__.py

692 lines
25 KiB
Python

import re
from typing import Literal
import cv2
from mower.solvers.navigation.utils import generate_name
from mower.utils import config
from mower.utils.graph import SceneGraphSolver
from mower.utils.image import thres2
from mower.utils.log import logger
from mower.utils.scene import Scene
from mower.utils.vector import va, vs
from .activity import ActivityNavigation
from .last_stage import LastStageNavigation
location = {
1: {
"1-1": [(0, 0), "light"],
"1-2": [(428, -1), "light"],
"1-3": [(700, 157), "light"],
"1-4": [(1138, 158), "light"],
"1-5": [(1600, 158), "dark"],
"1-6": [(2360, -1), "light"],
"1-7": [(3073, -180), "light"],
"1-8": [(3535, -181), "dark"],
"1-9": [(4288, -1), "light"],
"1-10": [(4635, 167), "light"],
"1-11": [(4965, -9), "light"],
"1-12": [(5436, -10), "dark"],
},
2: {
"2-1": [(0, 0), "light"],
"2-2": [(758, -135), "light"],
"2-3": [(2384, 0), "dark"],
"2-4": [(3008, -143), "light"],
"2-5": [(4799, 0), "dark"],
"2-6": [(5263, 0), "light"],
"2-7": [(5830, 0), "light"],
"2-8": [(7053, -175), "dark"],
"2-9": [(7507, -175), "light"],
"2-10": [(8974, 2), "dark"],
"S2-1": [(428, 0), "light"],
"S2-2": [(1190, -135), "light"],
"S2-3": [(1637, -135), "light"],
"S2-4": [(1921, 0), "light"],
"S2-5": [(3440, -144), "light"],
"S2-6": [(3740, 2), "light"],
"S2-7": [(4183, 2), "light"],
"S2-8": [(6277, 2), "light"],
"S2-9": [(6727, 0), "light"],
"S2-10": [(7856, -345), "light"],
"S2-11": [(8200, -175), "light"],
"S2-12": [(8521, 2), "light"],
},
3: {
"3-1": [(0, 0), "light"],
"3-2": [(450, -12), "light"],
"3-3": [(873, -18), "light"],
"S3-1": [(1747, 290), "light"],
"S3-2": [(2218, 290), "light"],
"3-4": [(2647, 114), "dark"],
"3-5": [(3097, 114), "light"],
"3-6": [(3547, 114), "light"],
"3-7": [(3871, -49), "light"],
"3-8": [(4456, -181), "dark"],
"S3-3": [(4306, 113), "light"],
"S3-4": [(4732, 113), "light"],
"S3-5": [(5163, 113), "light"],
"S3-6": [(5589, 113), "light"],
"S3-7": [(6016, 108), "light"],
},
4: {
"4-1": [(0, 0), "light"],
"4-2": [(309, 163), "light"],
"4-3": [(591, -1), "light"],
"S4-1": [(890, 163), "light"],
"S4-2": [(1199, 287), "light"],
"S4-3": [(1506, 163), "light"],
"4-4": [(1834, 1), "dark"],
"4-5": [(2167, -135), "light"],
"4-6": [(2502, -1), "light"],
"4-7": [(3931, 0), "dark"],
"S4-4": [(2774, 134), "light"],
"S4-5": [(3194, 134), "light"],
"S4-6": [(3617, 134), "light"],
"4-8": [(4258, -137), "light"],
"4-9": [(4566, -2), "light"],
"S4-7": [(4864, -281), "light"],
"S4-8": [(5194, -146), "light"],
"S4-9": [(5596, -146), "light"],
"4-10": [(6378, -2), "dark"],
"S4-10": [(5987, -146), "light"],
},
5: {
"5-1": [(0, 0), "light"],
"5-2": [(472, -128), "light"],
"5-3": [(1558, -128), "dark"],
"S5-1": [(720, 59), "light"],
"S5-2": [(1198, 59), "light"],
"5-4": [(2014, -22), "light"],
"5-5": [(2473, -127), "light"],
"5-6": [(2921, -230), "light"],
"S5-3": [(3262, -61), "light"],
"5-7": [(4046, -229), "dark"],
"5-8": [(4406, -71), "light"],
"5-9": [(4874, -71), "light"],
"S5-4": [(3703, -61), "light"],
"S5-5": [(5255, 91), "light"],
"S5-6": [(5681, 91), "light"],
"S5-7": [(6108, 91), "light"],
"S5-8": [(6528, 91), "light"],
"5-10": [(6833, -91), "dark"],
"S5-9": [(6952, 91), "light"],
"H5-1": [(7517, 60), "dark"],
"H5-2": [(7786, -271), "dark"],
"H5-3": [(8087, 49), "dark"],
},
6: {
"6-1": [(0, 0), "light"],
"6-2": [(413, 0), "light"],
"6-3": [(765, 123), "light"],
"6-4": [(1052, 243), "light"],
"6-5": [(1365, 120), "dark"],
"6-6": [(1768, 120), "light"],
"6-7": [(2110, 240), "dark"],
"6-8": [(2453, -69), "light"],
"6-9": [(3290, 241), "light"],
"6-10": [(3713, 241), "light"],
"6-11": [(4705, 223), "dark"],
"6-12": [(5032, 90), "light"],
"S6-1": [(3963, 103), "light"],
"S6-2": [(4387, 103), "light"],
"6-13": [(5336, -53), "light"],
"6-14": [(5687, 70), "light"],
"6-15": [(6130, 70), "light"],
"S6-3": [(6454, 226), "light"],
"6-16": [(7250, 70), "dark"],
"6-17": [(7976, 72), "dark"],
"S6-4": [(6880, 226), "light"],
"6-18": [(8423, 72), "light"],
"H6-1": [(8909, -81), "dark"],
"H6-2": [(9041, 199), "dark"],
"H6-3": [(9473, -81), "dark"],
"H6-4": [(9596, 199), "dark"],
},
7: {
"7-1": [(0, 0), "light"],
"7-2": [(415, -1), "light"],
"7-3": [(718, -172), "light"],
"7-4": [(913, 165), "light"],
"7-5": [(1353, 165), "light"],
"7-6": [(1854, 39), "light"],
"7-7": [(2200, 204), "light"],
"7-8": [(2550, 39), "light"],
"7-9": [(2865, -136), "dark"],
"7-10": [(3309, -136), "light"],
"7-11": [(3649, 28), "light"],
"7-12": [(3976, 185), "dark"],
"7-13": [(4263, 14), "light"],
"7-14": [(4556, 192), "light"],
"7-15": [(4875, 21), "light"],
"7-16": [(5211, -150), "dark"],
"S7-1": [(5486, 185), "light"],
"S7-2": [(5926, 185), "light"],
"7-17": [(6138, -9), "light"],
"7-18": [(6998, -6), "dark"],
"7-19": [(7805, -10), "light"],
"H7-1": [(8098, -245), "dark"],
"H7-2": [(8327, 219), "dark"],
"H7-3": [(8605, -246), "dark"],
"H7-4": [(8822, 220), "dark"],
"7-20": [(9722, -6), "light"],
},
8: {
"R8-1": [(0, 0), "light"],
"R8-2": [(471, 0), "light"],
"R8-3": [(864, 0), "light"],
"R8-4": [(1259, 0), "light"],
"R8-5": [(1651, -4), "light"],
"R8-6": [(2045, -4), "light"],
"R8-7": [(2228, -124), "light"],
"R8-8": [(2437, -4), "dark"],
"R8-9": [(2951, -4), "light"],
"R8-10": [(3284, -4), "light"],
"R8-11": [(3617, -4), "dark"],
"M8-1": [(6, 339), "light"],
"M8-2": [(865, 339), "light"],
"M8-3": [(1259, 339), "light"],
"M8-4": [(1651, 339), "light"],
"M8-5": [(2045, 339), "light"],
"M8-6": [(2439, 340), "light"],
"M8-7": [(2952, 340), "light"],
"M8-8": [(3617, 339), "dark"],
"JT8-1": [(4092, 171), "light"],
"JT8-2": [(4545, 171), "dark"],
"JT8-3": [(5022, 171), "dark"],
"H8-1": [(5556, -24), "dark"],
"H8-2": [(5759, 354), "dark"],
"H8-3": [(5999, -24), "dark"],
"H8-4": [(6192, 354), "dark"],
},
9: {
"9-1": [(0, 0), "light"],
"9-2": [(358, 162), "light"],
"9-3": [(687, 21), "light"],
"9-4": [(1048, -120), "light"],
"9-5": [(1528, -120), "light"],
"9-6": [(1859, 105), "dark"],
"9-7": [(2954, 57), "light"],
"9-8": [(3394, -18), "light"],
"9-9": [(3799, -168), "light"],
"9-10": [(4155, 21), "dark"],
"9-11": [(4530, 141), "light"],
"9-12": [(4890, -78), "light"],
"9-13": [(5303, 42), "light"],
"9-14": [(6140, 177), "dark"],
"S9-1": [(5747, 42), "light"],
"S9-2": [(6065, -138), "light"],
"9-15": [(6487, -31), "light"],
"9-16": [(6914, 102), "light"],
"9-17": [(7336, -18), "light"],
"9-18": [(7764, -138), "dark"],
"9-19": [(8282, 42), "dark"],
"9-20": [(8904, 42), "light"],
"H9-1": [(8460, -243), "dark"],
"H9-2": [(9000, -243), "dark"],
"H9-3": [(9536, -243), "dark"],
"H9-4": [(8777, 327), "dark"],
"H9-5": [(9294, 327), "dark"],
"H9-6": [(9813, 327), "dark"],
"9-21": [(11144, 42), "light"],
},
10: {
"10-1": [(0, 0), "light"],
"10-2": [(164, 171), "light"],
"10-3": [(364, 0), "light"],
"10-4": [(861, 0), "light"],
"10-5": [(1255, 0), "light"],
"10-6": [(1647, 0), "light"],
"10-7": [(1809, -161), "dark"],
"10-8": [(2007, 0), "light"],
"10-9": [(2178, 171), "light"],
"10-10": [(2399, -4), "light"],
"10-11": [(2539, -138), "dark"],
"10-12": [(2851, 171), "light"],
"10-13": [(3031, -73), "light"],
"10-14": [(3393, -73), "light"],
"10-15": [(3393, 89), "dark"],
"10-16": [(3531, 266), "light"],
"10-17": [(3931, 264), "dark"],
"10-18": [(3931, 89), "light"],
"10-19": [(5013, 96), "light"],
"H10-1": [(3520, -273), "dark"],
"H10-2": [(4152, -273), "dark"],
"H10-3": [(4392, -73), "dark"],
},
11: {
"11-1": [(0, 0), "light"],
"11-2": [(277, 206), "light"],
"11-3": [(584, -1), "dark"],
"11-4": [(942, 0), "light"],
"11-5": [(1086, 207), "light"],
"11-6": [(1544, -1), "light"],
"11-7": [(2110, 136), "light"],
"11-8": [(2378, -1), "dark"],
"11-9": [(2625, 212), "light"],
"11-10": [(2805, -156), "light"],
"11-11": [(3029, 0), "light"],
"11-12": [(3422, -1), "dark"],
"11-13": [(3611, 212), "light"],
"11-14": [(3860, -155), "light"],
"11-15": [(4034, 0), "dark"],
"11-16": [(4385, 166), "light"],
"11-17": [(4385, -155), "dark"],
"11-18": [(4837, -156), "light"],
"11-19": [(4837, -1), "dark"],
"11-20": [(4837, 166), "dark"],
"H11-1": [(5422, -163), "dark"],
"H11-2": [(5915, -164), "dark"],
"H11-3": [(5566, 163), "dark"],
"H11-4": [(6066, 164), "dark"],
"11-21": [(6407, -1), "light"],
},
12: {
"12-1": [(0, 0), "light"],
"12-2": [(342, 292), "light"],
"12-3": [(701, 292), "light"],
"12-4": [(894, 121), "light"],
"12-5": [(1122, 292), "light"],
"12-6": [(1364, 121), "light"],
"12-7": [(1515, 292), "dark"],
"12-8": [(2109, 290), "light"],
"12-9": [(2468, 290), "light"],
"12-10": [(2670, 125), "light"],
"12-11": [(2980, 422), "light"],
"12-12": [(3218, 125), "light"],
"12-13": [(3456, 294), "dark"],
"12-14": [(3694, 123), "light"],
"12-15": [(4020, 123), "light"],
"12-16": [(4348, -14), "light"],
"12-17": [(4673, -14), "light"],
"12-18": [(4673, 210), "light"],
"12-19": [(5175, 210), "dark"],
"12-20": [(5700, 210), "dark"],
"12-21": [(6377, 210), "light"],
},
13: {
"13-1": [(0, 0), "light"],
"13-2": [(411, -107), "light"],
"13-3": [(615, 77), "light"],
"13-4": [(939, -177), "light"],
"13-5": [(1223, -30), "dark"],
"13-6": [(1606, -137), "light"],
"13-7": [(2647, -268), "light"],
"13-8": [(2796, 37), "light"],
"13-9": [(3182, -91), "light"],
"13-10": [(3564, -31), "light"],
"13-11": [(3843, -151), "dark"],
"13-12": [(3981, 54), "light"],
"13-13": [(4282, -220), "light"],
"13-14": [(4680, -139), "light"],
"13-15": [(5062, -275), "dark"],
"13-16": [(5216, -40), "light"],
"13-17": [(5474, -210), "light"],
"13-18": [(5694, 46), "dark"],
"13-19": [(6150, 46), "light"],
"13-20": [(6579, 46), "light"],
"13-21": [(6797, -149), "dark"],
"13-22": [(7763, -149), "light"],
"H13-1": [(7235, -391), "dark"],
"H13-2": [(7878, -391), "dark"],
"H13-3": [(7262, 67), "dark"],
"H13-4": [(7870, 67), "dark"],
},
14: {
"14-1": [(0, 0), "light"],
"14-2": [(408, -1), "light"],
"14-3": [(942, -25), "light"],
"14-4": [(1186, 114), "light"],
"14-5": [(1481, 36), "light"],
"14-6": [(1951, 22), "light"],
"14-7": [(2267, -116), "light"],
"14-8": [(2409, 194), "light"],
"14-9": [(2813, 194), "dark"],
"14-10": [(3090, 285), "dark"],
"14-11": [(3365, 19), "light"],
"14-12": [(3567, 188), "light"],
"14-13": [(3848, 384), "light"],
"14-14": [(4113, 228), "light"],
"14-15": [(4497, 291), "light"],
"14-16": [(4791, 120), "light"],
"14-17": [(4976, -12), "dark"],
"14-18": [(5231, 266), "dark"],
"14-19": [(5870, 270), "light"],
"14-20": [(6035, 113), "dark"],
"14-21": [(6035, -124), "dark"],
"14-22": [(6447, 3), "dark"],
"H14-1": [(7267, -210), "dark"],
"H14-2": [(7891, -211), "dark"],
"H14-3": [(7272, 261), "dark"],
"H14-4": [(7890, 262), "dark"],
"14-23": [(8368, -1), "light"],
},
"OF": {
"OF-1": [(0, 0), "light"],
"OF-2": [(738, 144), "light"],
"OF-3": [(1122, 299), "light"],
"OF-4": [(1475, 135), "light"],
"OF-5": [(2288, -45), "light"],
"OF-6": [(2737, -45), "light"],
"OF-7": [(3550, 135), "light"],
"OF-8": [(3899, 299), "light"],
},
"AP": {
"AP-1": [(0, 0), "light"],
"AP-2": [(416, -74), "light"],
"AP-3": [(716, -247), "light"],
"AP-4": [(964, -417), "light"],
"AP-5": [(1116, -589), "dark"],
},
"LS": {
"LS-1": [(0, 0), "light"],
"LS-2": [(385, -34), "light"],
"LS-3": [(710, -130), "light"],
"LS-4": [(970, -257), "light"],
"LS-5": [(1138, -421), "dark"],
"LS-6": [(1213, -600), "dark"],
},
"CA": {
"CA-1": [(0, 0), "light"],
"CA-2": [(416, -73), "light"],
"CA-3": [(716, -246), "light"],
"CA-4": [(964, -417), "light"],
"CA-5": [(1116, -589), "dark"],
},
"CE": {
"CE-1": [(0, 0), "light"],
"CE-2": [(382, -33), "light"],
"CE-3": [(709, -128), "light"],
"CE-4": [(970, -259), "light"],
"CE-5": [(1136, -420), "dark"],
"CE-6": [(1210, -597), "dark"],
},
"SK": {
"SK-1": [(0, 0), "light"],
"SK-2": [(416, -73), "light"],
"SK-3": [(716, -246), "light"],
"SK-4": [(965, -417), "light"],
"SK-5": [(1116, -589), "dark"],
},
"PR-A": {"PR-A-1": [(0, 0), "light"], "PR-A-2": [(604, -283), "light"]},
"PR-B": {"PR-B-1": [(0, 0), "light"], "PR-B-2": [(684, -296), "light"]},
"PR-C": {"PR-C-1": [(0, 0), "light"], "PR-C-2": [(667, -231), "light"]},
"PR-D": {"PR-D-1": [(0, 0), "light"], "PR-D-2": [(639, -260), "light"]},
}
collection_prefixs = [
"AP",
"LS",
"CA",
"CE",
"PR",
"SK",
]
difficulty_str = [
"normal",
"hard",
]
class NavigationSolver(SceneGraphSolver):
solver_name = "关卡导航"
def run(self, name: str, mode: Literal["auto", "copy"] = "auto") -> bool:
"""
Args:
name: 关卡名,以"#"结尾时表示打突袭模式
mode: 刷理智为auto,抄作业为copy
Returns:
返回当前关卡能不能刷。
例如:
- 活动关卡开放时返回True,活动结束后返回False;
- 剿灭没满时返回True,刷满后返回False。
"""
self.switch_to_ex = False
self.name = name
if self.name.endswith("#"):
self.name = self.name[:-1]
self.switch_to_ex = True
if LastStageNavigation().run(self.name, mode, self.switch_to_ex):
# 剿灭导航,LastStageNavigation.run一定返回False
return True
if (
self.name in ActivityNavigation.location["normal"]
or self.name in ActivityNavigation.location["ex"]
):
ActivityNavigation().run(self.name, mode, self.switch_to_ex)
return True
self.success = False
self.act = None
self.mode = mode
prefix = self.name.split("-")[0]
pr_prefix = ""
if prefix == "PR":
pr_prefix = self.name.split("-")[1]
self.prefix = prefix
self.pr_prefix = pr_prefix
self.now_difficulty = None
self.change_to = None
self.patten = r"^(R|JT|H|M|S)(\d{1,2})$"
if self.name == "Annihilation":
logger.info("剿灭导航")
elif prefix.isdigit() or re.match(self.patten, prefix):
if match := re.search(self.patten, prefix):
prefix = match.group(2)
prefix = int(prefix)
self.prefix = prefix
if prefix in location and self.name in location[prefix]:
logger.info(f"主线关卡导航:{name}")
if prefix < 4:
act = 0
elif prefix < 9:
act = 1
else:
act = 2
self.act = act
else:
logger.error(f"暂不支持{name}")
return False
elif prefix in ["OF"]:
logger.info(f'别传关卡导航:"{name}"')
elif prefix in ["AP", "LS", "CA", "CE", "SK"]:
logger.info(f'资源收集关卡导航:"{name}"')
elif prefix.split("-")[0] in ["PR"]:
logger.info(f'芯片关卡导航:"{name}"')
else:
logger.error(f"暂不支持{name}")
return False
super().run()
return self.success
def transition(self):
if (scene := self.scene()) == Scene.TERMINAL_MAIN:
if self.name == "Annihilation":
if pos := self.find("terminal_eliminate"):
self.tap(pos)
else:
logger.info("本周剿灭已完成")
return True
elif isinstance(self.prefix, int):
self.tap_terminal_button("main_theme")
elif self.prefix in ["OF"]:
self.tap_terminal_button("biography")
elif self.prefix in collection_prefixs:
self.tap_terminal_button("collection")
elif scene == Scene.OPERATOR_ELIMINATE:
if self.name != "Annihilation":
self.back()
return
self.success = True
return True
elif scene == Scene.TERMINAL_MAIN_THEME:
if not isinstance(self.prefix, int):
self.back()
return
act_scope = ((300, 315), (400, 370))
if self.find(f"navigation/act/{self.act}", scope=act_scope):
if pos := self.find(f"navigation/main/{self.prefix}"):
self.tap(pos)
else:
self.swipe_ext([(932, 554), (1425, 554)], [300], 500, 0.5)
else:
self.ctap((230, 175), 3)
elif scene == Scene.TERMINAL_BIOGRAPHY:
if self.prefix not in ["OF"]:
self.back()
return
if self.find(f"navigation/biography/{self.prefix}_banner"):
self.tap("navigation/entry")
return
self.tap(f"navigation/biography/{self.prefix}_entry")
elif scene == Scene.TERMINAL_COLLECTION:
prefix = self.prefix
val = 0.9
if self.prefix not in collection_prefixs:
self.back()
return
if self.prefix == "PR":
prefix = self.prefix + "-" + self.pr_prefix
if self.prefix not in ["LS"]:
if self.find(f"navigation/collection/{prefix}_not_available"):
logger.info(f"{self.name}未开放")
return True
if pos := self.find(f"navigation/collection/{prefix}_entry"):
self.tap(pos)
else:
if self.prefix in ["AP", "CA", "CE", "SK"]:
self.swipe_noinertia((900, 500), (600, 0))
if self.prefix in ["PR"]:
self.swipe_noinertia((900, 500), (-600, 0))
elif scene == Scene.OPERATOR_CHOOSE_LEVEL:
if self.animation():
return
if (
self.mode == "copy"
and (result := config.recog.match("story_stage"))
and result[0] > 0.8
):
self.ctap(result[1])
return
name, val, loc = "", 1, None
prefix = self.prefix
# 资源收集关直接按坐标点击
if prefix in collection_prefixs:
if self.prefix == "PR":
prefix = "{}-{}".format(self.prefix, self.pr_prefix)
if pos := self.find(f"navigation/collection/{prefix}-1"):
self.success = True
self.ctap(va(pos[0], location[prefix][self.name][0]))
return
# 其余关
if self.act == 2:
if self.now_difficulty is None:
if self.find("navigation/ope_normal"):
self.now_difficulty = 0
elif self.find("navigation/ope_hard"):
self.now_difficulty = 1
else:
return
logger.info(f"当前难度{difficulty_str[self.now_difficulty]}")
if self.change_to is not None and self.now_difficulty != self.change_to:
config.recog.update()
if self.find("navigation/ope_difficulty"):
self.tap(
f"navigation/ope_{difficulty_str[self.change_to]}_small"
)
self.now_difficulty = None
else:
self.tap(
f"navigation/ope_{difficulty_str[self.now_difficulty]}"
)
return
for i in location[prefix]:
pad_left = 0
pad_right = 0
if len(i.split("-")[0]) < 2:
pad_left = 20
if len(i.split("-")[-1]) < 2:
pad_right = 20
result = cv2.matchTemplate(
config.recog.gray,
generate_name(
i,
pad_left=pad_left,
pad_right=pad_right,
style=location[prefix][i][1],
),
cv2.TM_SQDIFF_NORMED,
)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result)
if min_val < val:
val = min_val
loc = min_loc
name = i
target = va(
vs(loc, location[prefix][name][0]), location[prefix][self.name][0]
)
if target[0] + 200 > 1920:
self.swipe_noinertia((1400, 540), (-800, 0))
elif target[0] < 0:
self.swipe_noinertia((400, 540), (800, 0))
else:
self.success = True
self.ctap(va(target, (60, 20)))
elif scene == Scene.OPERATOR_BEFORE:
if self.find("ope_ex_mode") and self.switch_to_ex:
self.ctap("ope_ex_mode", 3)
return
if self.mode == "auto":
if self.act == 2:
if self.change_to is not None:
logger.info(f"{self.name} 无法代理")
self.success = False
self.back_to_index()
return True
if self.find("ope_agency_lock"):
self.change_to = self.now_difficulty ^ 1
logger.info(
f"{self.name} {difficulty_str[self.now_difficulty]} 无法代理,切难度尝试"
)
self.back()
return
if self.success:
return True
else:
self.back()
elif self.mode == "copy":
if not self.switch_to_ex:
if config.recog.gray[65][1333] < 200:
self.sleep()
return
# 取消代理作战
if config.recog.gray[907][1600] > 127 and not self.find(
"ope_agency_lock"
):
self.ctap((1776, 908), 3)
return
self.ctap("ope_start", 3)
else:
self.ctap("ope_ex_start", 3)
elif scene == Scene.OPERATOR_SELECT and self.success:
return True
elif scene in [Scene.OPERATOR_RECOVER_ORIGINITE, Scene.OPERATOR_RECOVER_POTION]:
return True
elif scene == Scene.STORY_STAGE:
self.tap("start_story")
else:
self.scene_graph_step(Scene.TERMINAL_MAIN)