babalae/better-genshin-impact · error · ArgumentException

round方法的入参格式错误,回合数必须大于0,例:round(1)

Error message

round方法的入参格式错误,回合数必须大于0,例:round(1)

What it means

Error "round方法的入参格式错误,回合数必须大于0,例:round(1)" thrown in babalae/better-genshin-impact.

Source

Thrown at BetterGenshinImpact/GameTask/AutoFight/Script/CombatScriptParser.cs:190

                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);
            }
        }
        return activatingRounds;
    }

    public static List<CombatCommand> ParseLineCommands(string lineWithoutAvatar, string avatarName) {
        var parts = lineWithoutAvatar.Split("|", StringSplitOptions.RemoveEmptyEntries);
        var fullCombatCommands = new List<CombatCommand>();
        foreach (var part in parts)
        {
            var combatCommands = ParseLinePart(part, avatarName);
            if (combatCommands.Count > 0 && combatCommands[0].Method == Method.Round) {
                // 遇到round指令,作为回合分隔符使用,不加入最终指令列表
                var roundCommand = combatCommands[0];
                var activatingRounds = ParseRoundCommand(roundCommand);
                combatCommands.RemoveAt(0);

View on GitHub (pinned to a7cb36712d)

Solutions

  1. round 的回合数必须大于0,如 round(1)
  2. 检查是否误写为 round(0) 或负数

Example fix

回合数从1开始,使用正整数,如 round(1)。

When it happens

Trigger: round 的单个回合参数解析后<=0(如 round(0)、round(-1))时抛出。

Common situations: 回合数写了0或负数。


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/4ed8629c81343927. Report an issue: GitHub.