From 04a0cdb7e87637e1351c843ac35dec54986b8c63 Mon Sep 17 00:00:00 2001 From: Funny-ppt <1763341376@qq.com> Date: Tue, 23 Jan 2024 15:24:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=B9=B2=E5=91=98=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E6=B7=BB=E5=8A=A0=E7=A9=BA=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InfrastSim/TimeDriven/ScriptHelper.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/InfrastSim/TimeDriven/ScriptHelper.cs b/InfrastSim/TimeDriven/ScriptHelper.cs index 8b03c1a..1fff46b 100644 --- a/InfrastSim/TimeDriven/ScriptHelper.cs +++ b/InfrastSim/TimeDriven/ScriptHelper.cs @@ -29,14 +29,17 @@ public static void SetOpState(Simulator simu, string[] args) { var op = simu.GetOperatorNoThrow(args[0]) ?? throw new ScriptException($"{args[0]} 干员不存在"); - if (!int.TryParse(args[1], out var upgraded)) { + int upgraded = -1; + double mood = double.NaN; + + if (args[1] != "_" && !int.TryParse(args[1], out upgraded)) { throw new ScriptException($"{args[1]} 不是一个有效的整数"); } - if (!double.TryParse(args[2], out var mood)) { + if (args[2] != "_" && !double.TryParse(args[2], out mood)) { throw new ScriptException($"{args[2]} 不是一个有效的浮点数"); } - op.Upgraded = upgraded; - op.SetMood(mood); + if (upgraded != -1) op.Upgraded = upgraded; + if (mood != double.NaN) op.SetMood(mood); } [Alias(Language.CN, "设置等级")]