Files
lc-mcp/scripts/game_scenes.py
T

29 lines
1.2 KiB
Python

"""Shared battle boundaries for all MCP controllers."""
def normalized_texts(state):
return [item['text'].replace(' ', '') for item in state.get('items', [])]
def death_retry_screen(texts):
combined = '\n'.join(texts)
return ('全体罪人' in combined and '死亡' in combined
or '当前剩余人员' in combined and '重试关卡' in combined)
def battle_is_terminal(state):
texts = normalized_texts(state)
markers = ('正在探', '获得E.G.O饰品', '选择E.G.O饰品', '饰品观测',
'开始战斗', '主题卡包', '应该让谁', '选择一位罪人', '进行判定',
'选择遭遇战奖励卡', '选项事件', '选择苦难', '选项', '结果',
'探索完成', '探索结束', '驾驶席', '服务器发生错误', '重试关卡')
return death_retry_screen(texts) or any(
text.upper() in ('VICTORY', 'DEFEAT') or any(marker in text for marker in markers)
for text in texts)
def battle_is_visible(state):
texts = normalized_texts(state)
return (any(marker in '\n'.join(texts).upper() for marker in ('WAVE', 'TURN', 'DURANTE'))
or any(text in ('胜率', '伤害') for text in texts))