镜牢兔子洞速刷: 每场第一回合超频「空洞」、攻略路线卡包加分
run_task(task="mirror", strategy="rabbit_hole") 时生效, 不带 strategy 时不装: - 选队按 rabbit_hole.json 的编队名(默认「兔子洞」); - 每回合 P → 长按浮士德打开 E.G.O 列表 → OCR 找「空洞」, 第一回合长按卡片超频 (侵蚀「空洞」直接打人; 普通「空洞」只叠弹孔), 其余回合单击 → Enter; 审计 battle/hollow 记 overclock/ego/ego_unavailable/no_option; - 路线卡包加分: 赌徒 → 地狱鸡 → 去·海·边 → 憎恶与绝望 → 2号线(OurPlay 全程困难路线), 按 AALC 默认权重模拟每层都选到路线卡包。 长按点 press_at 出厂未校准: 只记 [ERROR], 照常 P+Enter。 机制和超频操作按零协游戏文本/教程核实; 编队、路线按 codex 检索的 OurPlay/Reddit 攻略。 实机校准步骤见 docs/feedback/2026-11-15/RABBIT-HOLE.md, 台账 R-08。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+192
-9
@@ -716,10 +716,11 @@ def _select_team_by_name(auto, names, log=print, rounds=6):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def install_system_team_selection(log=print):
|
def install_system_team_selection(log=print, names=None):
|
||||||
"""镜牢选队改成"按队伍体系对应的中文名"在列表里点。
|
"""镜牢选队改成"按队伍体系对应的中文名"在列表里点。
|
||||||
|
|
||||||
AALC 原生只认 编队#N; 本账号的编队是自定义名字(流血/斩击/...), 原生逻辑永远选不上。
|
AALC 原生只认 编队#N; 本账号的编队是自定义名字(流血/斩击/...), 原生逻辑永远选不上。
|
||||||
|
names 给了就不看体系, 直接按这些名字选(兔子洞这类固定编队的打法用)。
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from tasks.mirror import mirror as mirror_mod
|
from tasks.mirror import mirror as mirror_mod
|
||||||
@@ -737,8 +738,8 @@ def install_system_team_selection(log=print):
|
|||||||
def __init__(self, team_setting, team_num):
|
def __init__(self, team_setting, team_num):
|
||||||
original_init(self, team_setting, team_num)
|
original_init(self, team_setting, team_num)
|
||||||
system = getattr(self, 'system', '')
|
system = getattr(self, 'system', '')
|
||||||
wanted['names'] = (SYSTEM_TEAM_NAMES.get(system, ())
|
wanted['names'] = tuple(names) if names else (SYSTEM_TEAM_NAMES.get(system, ())
|
||||||
+ TEAM_PREFERENCES.get(system, ()))
|
+ TEAM_PREFERENCES.get(system, ()))
|
||||||
wanted['enter_failed'] = False
|
wanted['enter_failed'] = False
|
||||||
log('[lc_mcp] 镜牢体系 %s -> 目标编队 %s'
|
log('[lc_mcp] 镜牢体系 %s -> 目标编队 %s'
|
||||||
% (system or '?', '/'.join(wanted['names']) or '(无配置)'))
|
% (system or '?', '/'.join(wanted['names']) or '(无配置)'))
|
||||||
@@ -1642,6 +1643,7 @@ def theme_pack_bonus(pack, system, bonus):
|
|||||||
|
|
||||||
体系包给 featured 档, 有这个体系的专属饰品按件数给 unique 档, 社区推荐给 recommend 档, 取最大;
|
体系包给 featured 档, 有这个体系的专属饰品按件数给 unique 档, 社区推荐给 recommend 档, 取最大;
|
||||||
社区说这个体系走它不划算(avoid 里有这个体系)就不加; 速刷要避开的(avoid 里有 '*')再减 avoid。
|
社区说这个体系走它不划算(avoid 里有这个体系)就不加; 速刷要避开的(avoid 里有 '*')再减 avoid。
|
||||||
|
打法指定的路线卡包(pack['route'] 是它的加分, 如兔子洞)最后算, 至少给这么多, 不受体系和 avoid 影响。
|
||||||
"""
|
"""
|
||||||
score = bonus['featured'] if system in (pack.get('featured') or ()) else 0
|
score = bonus['featured'] if system in (pack.get('featured') or ()) else 0
|
||||||
count = (pack.get('unique') or {}).get(system, 0)
|
count = (pack.get('unique') or {}).get(system, 0)
|
||||||
@@ -1654,6 +1656,8 @@ def theme_pack_bonus(pack, system, bonus):
|
|||||||
score = min(score, 0)
|
score = min(score, 0)
|
||||||
if '*' in avoid:
|
if '*' in avoid:
|
||||||
score -= bonus.get('avoid', 0)
|
score -= bonus.get('avoid', 0)
|
||||||
|
if pack.get('route'):
|
||||||
|
score = max(score, pack['route'])
|
||||||
return score
|
return score
|
||||||
|
|
||||||
|
|
||||||
@@ -1719,8 +1723,12 @@ def boost_theme_pack_weights(weights, packs, system, bonus, language='zh_cn', ha
|
|||||||
return result, {k: info[k] for k in ordered}
|
return result, {k: info[k] for k in ordered}
|
||||||
|
|
||||||
|
|
||||||
def install_theme_pack_systems(log=print, env=None):
|
def install_theme_pack_systems(log=print, env=None, route=None, route_name='路线'):
|
||||||
"""镜牢选卡包时按当局体系给卡包加分。返回原 select_theme_pack, 未安装返回 None。"""
|
"""镜牢选卡包时按当局体系给卡包加分。返回原 select_theme_pack, 未安装返回 None。
|
||||||
|
|
||||||
|
route 是打法指定的路线卡包 {中文名: 加分}(如兔子洞的 rabbit_hole.json theme_packs), 每个至少加这么多,
|
||||||
|
当局没有体系也照加。
|
||||||
|
"""
|
||||||
env = os.environ if env is None else env
|
env = os.environ if env is None else env
|
||||||
setting = env.get(THEME_PACK_SYSTEMS_ENV, '').strip()
|
setting = env.get(THEME_PACK_SYSTEMS_ENV, '').strip()
|
||||||
if setting == '0':
|
if setting == '0':
|
||||||
@@ -1732,6 +1740,14 @@ def install_theme_pack_systems(log=print, env=None):
|
|||||||
except (OSError, ValueError) as e:
|
except (OSError, ValueError) as e:
|
||||||
log('[ERROR] [lc_mcp] 卡包体系表读不了(%s): %s, 卡包按 AALC 原权重选' % (path, e))
|
log('[ERROR] [lc_mcp] 卡包体系表读不了(%s): %s, 卡包按 AALC 原权重选' % (path, e))
|
||||||
return None
|
return None
|
||||||
|
route = dict(route or {})
|
||||||
|
if route:
|
||||||
|
known = {pack['zh'] for pack in packs}
|
||||||
|
missing = [name for name in route if name not in known]
|
||||||
|
if missing:
|
||||||
|
log('[ERROR] [lc_mcp] %s卡包不在卡包表里, 不加分: %s' % (route_name, '/'.join(missing)))
|
||||||
|
route = {name: extra for name, extra in route.items() if name in known}
|
||||||
|
packs = [dict(pack, route=route[pack['zh']]) if pack['zh'] in route else pack for pack in packs]
|
||||||
try:
|
try:
|
||||||
import inspect
|
import inspect
|
||||||
from tasks.mirror import mirror as mirror_mod
|
from tasks.mirror import mirror as mirror_mod
|
||||||
@@ -1761,7 +1777,9 @@ def install_theme_pack_systems(log=print, env=None):
|
|||||||
THEME_PACK_BOOSTED.clear()
|
THEME_PACK_BOOSTED.clear()
|
||||||
system = state['system']
|
system = state['system']
|
||||||
if system not in SYSTEM_TEAM_NAMES:
|
if system not in SYSTEM_TEAM_NAMES:
|
||||||
return original(*args, **kwargs)
|
if not route:
|
||||||
|
return original(*args, **kwargs)
|
||||||
|
system = None # 没有体系: 只加路线分(体系包、专属饰品、社区推荐都按 None 算 0)
|
||||||
real = theme_list.get_effective_theme_pack_list
|
real = theme_list.get_effective_theme_pack_list
|
||||||
|
|
||||||
def get_effective_theme_pack_list(hard_mode, language, *more, **kw):
|
def get_effective_theme_pack_list(hard_mode, language, *more, **kw):
|
||||||
@@ -1773,8 +1791,9 @@ def install_theme_pack_systems(log=print, env=None):
|
|||||||
log('[lc_mcp] 卡包按体系加分出错(%s: %s), 用 AALC 原权重' % (type(e).__name__, e))
|
log('[lc_mcp] 卡包按体系加分出错(%s: %s), 用 AALC 原权重' % (type(e).__name__, e))
|
||||||
return weights
|
return weights
|
||||||
if info:
|
if info:
|
||||||
log('[lc_mcp] 卡包按体系 %s 加分: %s' % (system, ', '.join(
|
log('[lc_mcp] 卡包按体系 %s%s 加分: %s' % (
|
||||||
'%s %d→%d' % (key, item['from'], item['to']) for key, item in info.items())))
|
system or '(无)', ('+' + route_name) if route else '', ', '.join(
|
||||||
|
'%s %d→%d' % (key, item['from'], item['to']) for key, item in info.items())))
|
||||||
THEME_PACK_BOOSTED.update(info)
|
THEME_PACK_BOOSTED.update(info)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -1784,7 +1803,9 @@ def install_theme_pack_systems(log=print, env=None):
|
|||||||
select_theme_pack.__wrapped__ = original
|
select_theme_pack.__wrapped__ = original
|
||||||
mirror_mod.Mirror.__init__ = __init__
|
mirror_mod.Mirror.__init__ = __init__
|
||||||
mirror_mod.select_theme_pack = select_theme_pack
|
mirror_mod.select_theme_pack = select_theme_pack
|
||||||
log('[lc_mcp] patch: 镜牢卡包按体系加分(%s, %d 个卡包)' % (os.path.basename(path), len(packs)))
|
log('[lc_mcp] patch: 镜牢卡包按体系加分(%s, %d 个卡包%s)' % (
|
||||||
|
os.path.basename(path), len(packs),
|
||||||
|
', %s %s' % (route_name, ' '.join('%s+%d' % item for item in route.items())) if route else ''))
|
||||||
return original
|
return original
|
||||||
|
|
||||||
|
|
||||||
@@ -1973,3 +1994,165 @@ def install_key_hold(log=print, env=None, user32=None):
|
|||||||
log('[lc_mcp] patch: 按键按住 %dms 再松开, 前台改发带扫描码的按键(%s)'
|
log('[lc_mcp] patch: 按键按住 %dms 再松开, 前台改发带扫描码的按键(%s)'
|
||||||
% (KEY_HOLD * 1000, '/'.join(sorted(originals))))
|
% (KEY_HOLD * 1000, '/'.join(sorted(originals))))
|
||||||
return originals
|
return originals
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- 镜牢「兔子洞」速刷: 每回合给浮士德放「空洞」
|
||||||
|
|
||||||
|
# 「兔子洞」(英文社区 Mao Hollow Faust) = 黑兽 - 卯 魁首 浮士德 + 浮士德的 E.G.O「空洞」。游戏数据(零协 2026111301):
|
||||||
|
# 普通「空洞」不打敌人, 只给自己叠 5 发弹孔; 弹孔不低于 1 发时改用「填补空洞」(大伤害); 侵蚀「空洞」随机打人。
|
||||||
|
# E.G.O 被动: 弹孔满 5 发时「空洞」(觉醒、侵蚀)不耗 E.G.O 资源, 每回合开始 +1 发。攻略(OurPlay 777774): 每场第一回合
|
||||||
|
# 超频(强制用侵蚀技能)直接清场。AALC 战斗只会 P+Enter, 不会放 E.G.O。游戏教程: 按住罪人的头像打开 E.G.O 列表
|
||||||
|
# (wiki.gg 写的是按住技能格), 单击 E.G.O 是普通放, 长按 E.G.O 是超频。完整依据见 docs/feedback/2026-11-15/RABBIT-HOLE.md。
|
||||||
|
RABBIT_HOLE_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data', 'rabbit_hole.json')
|
||||||
|
RABBIT_HOLE_POPUP_WAIT = 0.6 # 长按松开后等 E.G.O 列表弹出
|
||||||
|
RABBIT_HOLE_SETTLE = 0.4 # 点完 E.G.O 等界面刷新
|
||||||
|
|
||||||
|
|
||||||
|
def load_rabbit_hole(path=RABBIT_HOLE_FILE):
|
||||||
|
"""读兔子洞配置; 格式不对抛 ValueError。"""
|
||||||
|
with open(path, encoding='utf-8') as fh:
|
||||||
|
data = json.load(fh)
|
||||||
|
if not isinstance(data, dict):
|
||||||
|
raise ValueError('配置必须是 JSON 对象')
|
||||||
|
|
||||||
|
def names(field):
|
||||||
|
value = data.get(field)
|
||||||
|
if not isinstance(value, list) or not value or \
|
||||||
|
not all(isinstance(v, str) and normalize_team_name(v) for v in value):
|
||||||
|
raise ValueError('%s 必须是非空字符串列表' % field)
|
||||||
|
return tuple(normalize_team_name(v) for v in value)
|
||||||
|
|
||||||
|
press_at = data.get('press_at')
|
||||||
|
if press_at is not None:
|
||||||
|
if not isinstance(press_at, list) or len(press_at) != 2 or \
|
||||||
|
not all(isinstance(v, (int, float)) and 0 < v < 1 for v in press_at):
|
||||||
|
raise ValueError('press_at 必须是 null 或 [宽比例, 高比例], 都在 0~1 之间')
|
||||||
|
press_at = (float(press_at[0]), float(press_at[1]))
|
||||||
|
hold = data.get('hold_seconds', 1.0)
|
||||||
|
if isinstance(hold, bool) or not isinstance(hold, (int, float)) or not 0.2 <= hold <= 5:
|
||||||
|
raise ValueError('hold_seconds 必须在 0.2~5 秒之间')
|
||||||
|
overclock = data.get('overclock_first_turn', False)
|
||||||
|
if not isinstance(overclock, bool):
|
||||||
|
raise ValueError('overclock_first_turn 必须是 true/false')
|
||||||
|
packs = data.get('theme_packs', {})
|
||||||
|
if not isinstance(packs, dict) or not all(
|
||||||
|
isinstance(k, str) and k.strip() and not isinstance(v, bool) and isinstance(v, int) and 0 < v <= 50
|
||||||
|
for k, v in packs.items()):
|
||||||
|
raise ValueError('theme_packs 必须是 {卡包中文名: 加分(1~50 的整数)}')
|
||||||
|
return {'team_names': names('team_names'), 'ego_names': names('ego_names'),
|
||||||
|
'press_at': press_at, 'hold_seconds': float(hold), 'overclock_first_turn': overclock,
|
||||||
|
'theme_packs': {k.strip(): v for k, v in packs.items()}}
|
||||||
|
|
||||||
|
|
||||||
|
def find_ego_option(lines, ego_names, near=None):
|
||||||
|
"""OCR 逐行结果里找 E.G.O 名字(归一后完全相等); 有几条取离长按点最近的。返回 (文本, x, y) 或 None。"""
|
||||||
|
hits = [(text, x, y) for text, x, y in lines if normalize_team_name(text) in ego_names]
|
||||||
|
if not hits:
|
||||||
|
return None
|
||||||
|
if near is None:
|
||||||
|
return hits[0]
|
||||||
|
return min(hits, key=lambda hit: (hit[1] - near[0]) ** 2 + (hit[2] - near[1]) ** 2)
|
||||||
|
|
||||||
|
|
||||||
|
def rabbit_hole_turn(auto, cfg, config, log=print, overclock=False):
|
||||||
|
"""接管一回合: P → 长按浮士德(press_at)打开 E.G.O 列表 → 选「空洞」→ Enter。
|
||||||
|
|
||||||
|
overclock=True 时长按 E.G.O 卡片(超频: 1.5 倍资源和理智, 强制用侵蚀技能), 否则单击。
|
||||||
|
返回结果: ego / overclock / ego_unavailable / no_option。
|
||||||
|
按过 P 就一定按 Enter(中途出错也一样): 交回 AALC 会再按一次 P, 而 P 是在胜率/伤害之间切换。
|
||||||
|
"""
|
||||||
|
width, height = cfg.set_win_size * 16 / 9, cfg.set_win_size
|
||||||
|
x, y = config['press_at'][0] * width, config['press_at'][1] * height
|
||||||
|
names = config['ego_names']
|
||||||
|
result = 'no_option'
|
||||||
|
auto.key_press('p')
|
||||||
|
try:
|
||||||
|
time.sleep(0.5)
|
||||||
|
auto.mouse_drag(x, y, drag_time=config['hold_seconds'], dx=0, dy=0)
|
||||||
|
time.sleep(RABBIT_HOLE_POPUP_WAIT)
|
||||||
|
auto.take_screenshot()
|
||||||
|
lines = _ocr_lines(auto)
|
||||||
|
hit = find_ego_option(lines, names, near=(x, y))
|
||||||
|
if hit is None:
|
||||||
|
log('[lc_mcp] 兔子洞: 长按 (%d,%d) 后没找到 E.G.O「%s」; 这一屏: %s'
|
||||||
|
% (x, y, '/'.join(names), '/'.join(str(t) for t, _, _ in lines[:20]) or '(空)'))
|
||||||
|
else:
|
||||||
|
if overclock:
|
||||||
|
auto.mouse_drag(hit[1], hit[2], drag_time=config['hold_seconds'], dx=0, dy=0)
|
||||||
|
else:
|
||||||
|
auto.mouse_click(hit[1], hit[2])
|
||||||
|
time.sleep(RABBIT_HOLE_SETTLE)
|
||||||
|
auto.take_screenshot()
|
||||||
|
if find_ego_option(_ocr_lines(auto), names) is None:
|
||||||
|
result = 'overclock' if overclock else 'ego'
|
||||||
|
else:
|
||||||
|
result = 'ego_unavailable' # 列表还开着: 资源不够(灰的)或没点上
|
||||||
|
log('[lc_mcp] 兔子洞: %s「%s」后列表还在(可能 E.G.O 资源不够), 这回合按胜率打'
|
||||||
|
% ('长按' if overclock else '点了', hit[0]))
|
||||||
|
if result not in ('ego', 'overclock'):
|
||||||
|
auto.mouse_click_blank() # 关掉弹出的列表
|
||||||
|
time.sleep(RABBIT_HOLE_SETTLE)
|
||||||
|
finally:
|
||||||
|
auto.key_press('enter')
|
||||||
|
decisions.record('battle', 'hollow', result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def install_rabbit_hole(log=print, config=None):
|
||||||
|
"""镜牢战斗每回合给浮士德放「空洞」。返回原 Battle._battle_operation, 未安装返回 None。"""
|
||||||
|
try:
|
||||||
|
config = config or load_rabbit_hole()
|
||||||
|
except (OSError, ValueError) as e:
|
||||||
|
log('[ERROR] [lc_mcp] 兔子洞配置读不了(%s): %s' % (RABBIT_HOLE_FILE, e))
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
from tasks.battle.battle import Battle
|
||||||
|
from module.automation import auto
|
||||||
|
from module.config import cfg
|
||||||
|
except Exception as e:
|
||||||
|
log('[lc_mcp] 兔子洞补丁跳过: 无法导入 %s' % e)
|
||||||
|
return None
|
||||||
|
original = getattr(Battle, '_battle_operation', None)
|
||||||
|
if original is None or _source_mentions(original, 'auto.key_press("p")', 'auto.key_press("enter")') is False:
|
||||||
|
log('[ERROR] [lc_mcp] 上游 Battle._battle_operation 不再是 P+Enter 出手, 兔子洞补丁挂不上, 跳过')
|
||||||
|
return None
|
||||||
|
state = {'warned': False}
|
||||||
|
overclock = config.get('overclock_first_turn', False)
|
||||||
|
signature = None
|
||||||
|
if overclock:
|
||||||
|
import inspect
|
||||||
|
try:
|
||||||
|
signature = inspect.signature(original)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
signature = None
|
||||||
|
if signature is None or 'first_turn' not in signature.parameters:
|
||||||
|
log('[ERROR] [lc_mcp] 上游 Battle._battle_operation 没有 first_turn 参数, 兔子洞第一回合不超频, 只放普通「空洞」')
|
||||||
|
overclock = False
|
||||||
|
|
||||||
|
def first_turn(self, args, kwargs):
|
||||||
|
try:
|
||||||
|
return bool(signature.bind(self, *args, **kwargs).arguments.get('first_turn'))
|
||||||
|
except TypeError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _battle_operation(self, *args, **kwargs):
|
||||||
|
if config['press_at'] is None:
|
||||||
|
if not state['warned']:
|
||||||
|
state['warned'] = True
|
||||||
|
log('[ERROR] [lc_mcp] 兔子洞: rabbit_hole.json 的 press_at 还没在实机上量, 本次按 AALC 原来的 P+Enter 打')
|
||||||
|
return original(self, *args, **kwargs)
|
||||||
|
try:
|
||||||
|
rabbit_hole_turn(auto, cfg, config, log=log,
|
||||||
|
overclock=overclock and first_turn(self, args, kwargs))
|
||||||
|
except InterruptedError:
|
||||||
|
raise # AALC 的暂停/停止
|
||||||
|
except Exception as e: # Enter 已经在 rabbit_hole_turn 的 finally 里按过, 这回合照常打
|
||||||
|
log('[lc_mcp] 兔子洞: 这回合出错(%s: %s), 已按 Enter' % (type(e).__name__, e))
|
||||||
|
return False # 上游的返回值是「小指良单通的连续防御是否执行」
|
||||||
|
|
||||||
|
_battle_operation.__wrapped__ = original
|
||||||
|
Battle._battle_operation = _battle_operation
|
||||||
|
log('[lc_mcp] patch: 镜牢兔子洞: 每回合给浮士德放 E.G.O「%s」%s(%s)'
|
||||||
|
% ('/'.join(config['ego_names']), ', 每场第一回合超频' if overclock else '',
|
||||||
|
'长按点未校准, 先按 P+Enter' if config['press_at'] is None else '长按 %.3f,%.3f' % config['press_at']))
|
||||||
|
return original
|
||||||
|
|||||||
+36
-4
@@ -11,7 +11,8 @@ import sys
|
|||||||
|
|
||||||
from . import killswitch, preflight
|
from . import killswitch, preflight
|
||||||
from .aalc_engine import bootstrap
|
from .aalc_engine import bootstrap
|
||||||
from .aalc_patches import (TaskAbort, WindowGuard, driver_click_tasks, headless_hdr_warning,
|
from .aalc_patches import (TaskAbort, WindowGuard, driver_click_tasks, headless_hdr_warning, install_rabbit_hole,
|
||||||
|
load_rabbit_hole,
|
||||||
install_default_battle_team, install_event_choices, install_exact_team_match,
|
install_default_battle_team, install_event_choices, install_exact_team_match,
|
||||||
install_gift_confirm_guard, install_gift_preference, install_key_hold,
|
install_gift_confirm_guard, install_gift_preference, install_key_hold,
|
||||||
install_robust_set_foreground, install_shop_audit, install_shop_by_name,
|
install_robust_set_foreground, install_shop_audit, install_shop_by_name,
|
||||||
@@ -29,6 +30,10 @@ TASKS = {
|
|||||||
'enkephalin': {'times': 'set_lunacy_to_enkephalin'},
|
'enkephalin': {'times': 'set_lunacy_to_enkephalin'},
|
||||||
'mirror': {'count': 'set_mirror_count'},
|
'mirror': {'count': 'set_mirror_count'},
|
||||||
}
|
}
|
||||||
|
# 任务 -> {选项名: 允许的值}; 不对应 AALC 配置项, 只决定本次装哪些补丁
|
||||||
|
TASK_OPTIONS = {
|
||||||
|
'mirror': {'strategy': ('rabbit_hole',)}, # rabbit_hole: 兔子洞速刷, 见 lc_mcp/data/rabbit_hole.json
|
||||||
|
}
|
||||||
# 用户给了镜牢次数时一并临时关闭的配置: 开着无限刷牢, AALC 会把次数改成 9999
|
# 用户给了镜牢次数时一并临时关闭的配置: 开着无限刷牢, AALC 会把次数改成 9999
|
||||||
EXPLICIT_COUNT_OVERRIDES = {'mirror': {'count': {'infinite_dungeons': False}}}
|
EXPLICIT_COUNT_OVERRIDES = {'mirror': {'count': {'infinite_dungeons': False}}}
|
||||||
RESTORE_ENV = 'LCP_RESTORE_FILE'
|
RESTORE_ENV = 'LCP_RESTORE_FILE'
|
||||||
@@ -104,7 +109,23 @@ def run(task, params):
|
|||||||
return PREFLIGHT_EXIT
|
return PREFLIGHT_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
def split_options(task, params):
|
||||||
|
"""把任务选项(TASK_OPTIONS)从参数里拆出来, 返回 (次数类参数, 选项)。"""
|
||||||
|
allowed = TASK_OPTIONS.get(task, {})
|
||||||
|
params = dict(params)
|
||||||
|
options = {k: params.pop(k) for k in list(params) if k in allowed}
|
||||||
|
return params, options
|
||||||
|
|
||||||
|
|
||||||
def _run(task, params):
|
def _run(task, params):
|
||||||
|
params, options = split_options(task, params)
|
||||||
|
rabbit = None
|
||||||
|
if options.get('strategy') == 'rabbit_hole':
|
||||||
|
try:
|
||||||
|
rabbit = load_rabbit_hole()
|
||||||
|
except (OSError, ValueError) as e:
|
||||||
|
log('[ERROR] [lc_mcp] 兔子洞配置读不了: %s' % e)
|
||||||
|
return PREFLIGHT_EXIT
|
||||||
bootstrap()
|
bootstrap()
|
||||||
from module.automation import auto
|
from module.automation import auto
|
||||||
from module.config import cfg
|
from module.config import cfg
|
||||||
@@ -133,7 +154,7 @@ def _run(task, params):
|
|||||||
install_default_battle_team(scheme, log=log)
|
install_default_battle_team(scheme, log=log)
|
||||||
# 镜牢: 编队是自定义名字(体系名), AALC 只会找 "编队#N"; 改成按体系名点选。
|
# 镜牢: 编队是自定义名字(体系名), AALC 只会找 "编队#N"; 改成按体系名点选。
|
||||||
if task in ('mirror', 'all'):
|
if task in ('mirror', 'all'):
|
||||||
install_system_team_selection(log=log)
|
install_system_team_selection(log=log, names=rabbit['team_names'] if rabbit else None)
|
||||||
install_team_screen_guard(log=log)
|
install_team_screen_guard(log=log)
|
||||||
install_gift_confirm_guard(log=log) # 「获得E.G.O饰品」点不关时换落点/结束任务(ISSUES I-06)
|
install_gift_confirm_guard(log=log) # 「获得E.G.O饰品」点不关时换落点/结束任务(ISSUES I-06)
|
||||||
install_typed_keyboard_road(log=log)
|
install_typed_keyboard_road(log=log)
|
||||||
@@ -141,8 +162,13 @@ def _run(task, params):
|
|||||||
install_event_choices(log=log)
|
install_event_choices(log=log)
|
||||||
install_shop_audit(log=log)
|
install_shop_audit(log=log)
|
||||||
install_shop_by_name(log=log) # 装在审计之后(包在外层), 审计才看得到按名字点的那一下
|
install_shop_by_name(log=log) # 装在审计之后(包在外层), 审计才看得到按名字点的那一下
|
||||||
install_theme_pack_systems(log=log) # 卡包按体系加分(BACKLOG R-01)
|
if rabbit: # 卡包按体系加分(BACKLOG R-01); 兔子洞再给攻略路线上的卡包加分
|
||||||
|
install_theme_pack_systems(log=log, route=rabbit['theme_packs'], route_name='兔子洞路线')
|
||||||
|
else:
|
||||||
|
install_theme_pack_systems(log=log)
|
||||||
install_theme_pack_audit(log=log) # 装在加分之后(包在外层), 审计记得到加分
|
install_theme_pack_audit(log=log) # 装在加分之后(包在外层), 审计记得到加分
|
||||||
|
if rabbit:
|
||||||
|
install_rabbit_hole(log=log, config=rabbit)
|
||||||
guard = WindowGuard(screen, cfg, log=log)
|
guard = WindowGuard(screen, cfg, log=log)
|
||||||
guard.start()
|
guard.start()
|
||||||
restore_path = os.environ.get(RESTORE_ENV)
|
restore_path = os.environ.get(RESTORE_ENV)
|
||||||
@@ -189,10 +215,16 @@ def main(argv):
|
|||||||
return 2
|
return 2
|
||||||
task = argv[1]
|
task = argv[1]
|
||||||
params = json.loads(argv[2]) if len(argv) > 2 else {}
|
params = json.loads(argv[2]) if len(argv) > 2 else {}
|
||||||
unknown = set(params) - set(TASKS[task])
|
options = TASK_OPTIONS.get(task, {})
|
||||||
|
unknown = set(params) - set(TASKS[task]) - set(options)
|
||||||
if unknown:
|
if unknown:
|
||||||
print('unknown params for %s: %s' % (task, ', '.join(sorted(unknown))), file=sys.stderr)
|
print('unknown params for %s: %s' % (task, ', '.join(sorted(unknown))), file=sys.stderr)
|
||||||
return 2
|
return 2
|
||||||
|
bad = {k: v for k, v in params.items() if k in options and v not in options[k]}
|
||||||
|
if bad:
|
||||||
|
print('bad option for %s: %s' % (task, ', '.join('%s=%r' % kv for kv in sorted(bad.items()))),
|
||||||
|
file=sys.stderr)
|
||||||
|
return 2
|
||||||
print('[lc_mcp] task %s start %s' % (task, json.dumps(params)), flush=True)
|
print('[lc_mcp] task %s start %s' % (task, json.dumps(params)), flush=True)
|
||||||
code = run(task, params)
|
code = run(task, params)
|
||||||
if code:
|
if code:
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"_说明": [
|
||||||
|
"镜牢「兔子洞」速刷(Mao Hollow Faust): 黑兽 - 卯 魁首 浮士德 + 浮士德的 E.G.O「空洞」。run_task(task=\"mirror\", strategy=\"rabbit_hole\") 时生效。",
|
||||||
|
"每回合: 按 P(胜率) → 长按浮士德(press_at)打开 E.G.O 列表 → OCR 找 ego_names 里的名字, 单击放 E.G.O(每场第一回合长按 = 超频) → 按 Enter。",
|
||||||
|
"游戏数据(零协 release 2026111301): 人格 id 10212; E.G.O id 20211「空洞」。普通「空洞」不打敌人, 只给自己叠 5 发弹孔; 弹孔不低于 1 发时改用「填补空洞」(大伤害);",
|
||||||
|
"超频(侵蚀)的「空洞」直接随机打人。E.G.O 被动「排离空洞」: 弹孔满 5 发时「空洞」(觉醒、侵蚀)不耗 E.G.O 资源, 每回合开始 +1 发弹孔。",
|
||||||
|
"超频: 游戏教程「在战斗中选择 E.G.O 技能时, 可以长按 E.G.O 来使用 E.G.O 超频」, 1.5 倍 E.G.O 资源和理智; 资源够 1.5 倍是稳定超频(只打敌人), 不够是不稳定超频(不分敌我, 缺的资源扣成负数)。",
|
||||||
|
"overclock_first_turn: 每场战斗第一回合超频(OurPlay 攻略「前期每战第一回合侵蚀空洞」), 之后的回合单击。后期 Boss 攻略改成第一回合普通「空洞」, 这里不区分。",
|
||||||
|
"press_at 是长按点在游戏客户区里的位置(宽、高的比例, 0~1), 必须在实机上量。游戏教程是「按住罪人的头像以打开其 E.G.O 列表」, wiki.gg 写的是按住技能格, 以实机为准。",
|
||||||
|
"press_at 为 null 时不点任何东西, 记一条 [ERROR] 后按 AALC 原来的 P+Enter 打。team_names 是这套打法用的编队名(游戏里自己建)。",
|
||||||
|
"hold_seconds 是 AALC mouse_drag 的停留时间, 它松开前还会再按住 0.5 秒, 实际按住约 hold_seconds+0.5 秒; 长按头像和超频长按卡片都用它。",
|
||||||
|
"theme_packs: 攻略路线上的卡包 {中文名: 加分}, 加在 AALC 原权重上(没有体系也加)。OurPlay 全程困难路线: 1 层身无分文的赌徒 → 2 层地狱鸡 → 3 层去·海·边 → 4 层憎恶与绝望 → 5 层 2号线。",
|
||||||
|
"AALC 默认权重(困难 + 中文): 赌徒 0、地狱鸡 1、海边 0、绝望 -5、号线 -5; 憎恶与绝望多加 2 分, 4 层和 2号线同时出现时先选它(2号线 4、5 层都会出)。LCP_THEME_PACK_SYSTEMS=0 时路线加分一起关掉。"
|
||||||
|
],
|
||||||
|
"team_names": ["兔子洞"],
|
||||||
|
"ego_names": ["空洞"],
|
||||||
|
"press_at": null,
|
||||||
|
"hold_seconds": 1.0,
|
||||||
|
"overclock_first_turn": true,
|
||||||
|
"theme_packs": {"身无分文的赌徒": 10, "地狱鸡": 10, "去·海·边": 10, "憎恶与绝望": 12, "2号线": 10}
|
||||||
|
}
|
||||||
+15
-3
@@ -6,7 +6,7 @@ import threading
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from . import VERSION
|
from . import VERSION
|
||||||
from .aalc_task import TASKS
|
from .aalc_task import TASK_OPTIONS, TASKS
|
||||||
from .engine import find_hits
|
from .engine import find_hits
|
||||||
|
|
||||||
MAX_WAIT = 300.0
|
MAX_WAIT = 300.0
|
||||||
@@ -83,9 +83,14 @@ TOOLS = [
|
|||||||
'传 count 时本次临时关闭 AALC 无限刷牢,结束后恢复;完成局数不足时任务报 failed。'
|
'传 count 时本次临时关闭 AALC 无限刷牢,结束后恢复;完成局数不足时任务报 failed。'
|
||||||
'只刷一种日常时把另一种次数显式设为0,省略次数沿用配置。'
|
'只刷一种日常时把另一种次数显式设为0,省略次数沿用配置。'
|
||||||
'all 需明确要求全部任务;enkephalin 需明确授权花狂气,免费合成模块不能用它。'
|
'all 需明确要求全部任务;enkephalin 需明确授权花狂气,免费合成模块不能用它。'
|
||||||
'任务运行期间禁止手动点击类工具;最终 succeeded 也要检查 errors,用户停止后不自动重跑。'),
|
'任务运行期间禁止手动点击类工具;最终 succeeded 也要检查 errors,用户停止后不自动重跑。'
|
||||||
|
'mirror 可加 strategy="rabbit_hole":兔子洞速刷(黑兽-卯 浮士德每回合放 E.G.O「空洞」,每场第一回合超频),'
|
||||||
|
'编队、长按点、路线卡包见 lc_mcp/data/rabbit_hole.json。'),
|
||||||
'inputSchema': _obj({'task': {'type': 'string', 'enum': sorted(TASKS)},
|
'inputSchema': _obj({'task': {'type': 'string', 'enum': sorted(TASKS)},
|
||||||
'exp': _NUM, 'thread': _NUM, 'times': _NUM, 'count': _NUM}, ['task'])},
|
'exp': _NUM, 'thread': _NUM, 'times': _NUM, 'count': _NUM,
|
||||||
|
'strategy': {'type': 'string', 'enum': sorted({v for o in TASK_OPTIONS.values()
|
||||||
|
for v in o['strategy']})}},
|
||||||
|
['task'])},
|
||||||
{'name': 'task_status', 'description': '启动 run_task 前检查占用,启动后轮询此工具监控,避免逐帧截图和重复启动。'
|
{'name': 'task_status', 'description': '启动 run_task 前检查占用,启动后轮询此工具监控,避免逐帧截图和重复启动。'
|
||||||
'返回 idle/running/succeeded/failed/stopped、日志及异常;'
|
'返回 idle/running/succeeded/failed/stopped、日志及异常;'
|
||||||
'decisions.counts 按阶段统计选队/寻路/卡包/饰品/事件/商店的决策理由。'
|
'decisions.counts 按阶段统计选队/寻路/卡包/饰品/事件/商店的决策理由。'
|
||||||
@@ -158,6 +163,13 @@ class Server:
|
|||||||
if task not in TASKS:
|
if task not in TASKS:
|
||||||
raise ValueError('unknown task %r' % task)
|
raise ValueError('unknown task %r' % task)
|
||||||
params = {k: int(a[k]) for k in TASKS[task] if a.get(k) is not None}
|
params = {k: int(a[k]) for k in TASKS[task] if a.get(k) is not None}
|
||||||
|
options = TASK_OPTIONS.get(task, {})
|
||||||
|
for key in ('strategy',):
|
||||||
|
if a.get(key) is None:
|
||||||
|
continue
|
||||||
|
if a[key] not in options.get(key, ()):
|
||||||
|
raise ValueError('%s 不支持 %s=%r' % (task, key, a[key]))
|
||||||
|
params[key] = a[key]
|
||||||
# Starting must not race a click that has already checked running().
|
# Starting must not race a click that has already checked running().
|
||||||
# Reject promptly when busy instead of waiting behind a long OCR poll.
|
# Reject promptly when busy instead of waiting behind a long OCR poll.
|
||||||
if not self.lock.acquire(blocking=False):
|
if not self.lock.acquire(blocking=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user