Files

39 lines
2.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Chinese presentation for combat diagnostics; raw evidence stays unchanged."""
import re
def battle_message(message, *, translate_unknown=True):
text = str(message or "")
objective = "Non-elimination win/loss objective is unsupported"
units = "Protected/destroy objective units are unsupported"
if objective in text and units in text:
text = text.replace(objective + "; " + units,
"本关需要保护或摧毁指定目标,当前模拟器尚未支持这类战斗规则")
for source, target in (
(objective, "本关采用特殊胜负条件,当前模拟器尚未支持"),
(units, "本关涉及保护或摧毁指定目标,当前模拟器尚未支持"),
("Elimination battle must contain configured enemies", "关卡缺少有效敌方配置,暂时无法模拟"),
("Selected team is absent from the raw snapshot", "未找到所选战斗队伍,请重新选择队伍"),
("Team must contain distinct original roster monsters", "队伍为空或包含重复魔物,请检查队伍"),
("Selected team uses a locked original team slot", "队伍使用了尚未解锁的出战位置"),
("Only hatched, positive-level roster monsters can fight", "队伍包含尚未孵化或等级无效的魔物"),
("Full original battleField configuration is required", "关卡缺少完整战场配置,暂时无法模拟"),
("Unknown original configured species", "关卡包含资料未知的魔物,暂时无法模拟"),
("Unknown original player species", "出战魔物资料未知,暂时无法模拟"),
("实验模型战败(近似)", "打不过(模拟结果)"),
("实际战败", "打不过"),
):
text = text.replace(source, target)
for pattern, target in (
(r"Unsupported monster controller: [^;;\n]+", "当前模拟器尚未支持这种魔物行为规则"),
(r"Unsupported battle controller: [^;;\n]+", "当前模拟器尚未支持这种战斗机制"),
(r"Unsupported battle triggers: [^;;\n]+", "当前模拟器尚未支持这种战斗触发事件"),
(r"Unsupported active field area: [^;;\n]+", "当前模拟器尚未支持这种战场区域效果"),
(r"Full roster is missing monster field [^;;\n]+", "魔物属性数据不完整,暂时无法模拟"),
(r"Invalid numeric field: [^;;\n]+", "战斗数据包含无效数值,暂时无法模拟"),
):
text = re.sub(pattern, target, text)
if translate_unknown and re.search(r"[a-zA-Z]{2,}", text) and not re.search(r"[\u3400-\u9fff]", text):
return "战斗模拟暂时无法处理当前数据,详细原因已保留在调试记录中"
return text