babalae/better-genshin-impact · error · ArgumentException
round方法的入参格式错误,例:round(1-3)
Error message
round方法的入参格式错误,例:round(1-3)
What it means
Error "round方法的入参格式错误,例:round(1-3)" thrown in babalae/better-genshin-impact.
Source
Thrown at BetterGenshinImpact/GameTask/AutoFight/Script/CombatScriptParser.cs:174
combatAvatarNames.Add(character);
return oneLineCombatCommands;
}
public static List<int> ParseRoundCommand(CombatCommand roundCommand) {
// 解析round命令的入参,返回一个整数列表,代表在哪些回合执行后续指令
// 支持Round(1)、Round(1,3,5)、Round(2-4)、Round(1,3-5)等格式
var activatingRounds = new List<int>();
if (roundCommand.Args == null || roundCommand.Args.Count == 0) {
Logger.LogError("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
throw new ArgumentException("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
}
foreach (var arg in roundCommand.Args) {
if (arg.Contains('-')) {
// 范围
var parts = arg.Split('-', StringSplitOptions.TrimEntries);
if (parts.Length != 2) {
Logger.LogError("round方法的入参格式错误,例:round(1-3)");
throw new ArgumentException("round方法的入参格式错误,例:round(1-3)");
}
var start = int.Parse(parts[0]);
var end = int.Parse(parts[1]);
if (start > end || start <= 0) {
Logger.LogError("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
throw new ArgumentException("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
}
for (int i = start; i <= end; i++) {
activatingRounds.Add(i);
}
} else {
// 单个回合
var round = int.Parse(arg);
if (round <= 0) {
Logger.LogError("round方法的入参格式错误,回合数必须大于0,例:round(1)");
throw new ArgumentException("round方法的入参格式错误,回合数必须大于0,例:round(1)");
}
activatingRounds.Add(round);View on GitHub (pinned to a7cb36712d)
Solutions
- 按 round(起始-结束) 格式书写,如 round(1-3)
- 检查范围表达式是否使用了正确的连字符
Example fix
范围写成“起始-结束”两段式,如 round(1-3)。
When it happens
Trigger: round 的范围参数按 '-' 拆分后不是两段(如 round(1-2-3) 或 round(-3) 等),抛出。
Common situations: 回合范围写法错误,包含多个连字符或格式不完整。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/699d2cb6fdf3769e.
Report an issue: GitHub.