所以我正在学习 C#,我正在尝试制作一个简单的基于文本的 RPG,但是当我运行角色创建时,这种情况不断发生:
还剩 5 分
力量?
输入:4
点数太高!按 Enter。
这是代码。
public static void Start()
{
Console.Clear();
int charcreatepts = 10;
Console.WriteLine ("{0} Points Left", charcreatepts);
Console.WriteLine ("Intelligence?");
int CCPint1 = Convert.ToInt32 (Console.ReadLine ());
charcreatepts = charcreatepts - CCPint1;
if (CCPint1 > charcreatepts) {
Console.WriteLine ("Point amount too high! Press Enter.");
Console.ReadLine ();
Start ();
}else{
Console.Clear ();
Console.WriteLine ("{0} Points Left", charcreatepts);
Console.WriteLine ("Strength?");
int CCPint2 = Convert.ToInt32 (Console.ReadLine ());
charcreatepts = charcreatepts - CCPint2;
if (CCPint2 > charcreatepts) {
Console.WriteLine ("Point amount too high! Press Enter.");
Console.ReadLine ();
Start ();
}else{
Console.Clear ();
Console.WriteLine ("{0} Points Left", charcreatepts);
Console.WriteLine ("Social Skills?");
int CCPint3 = Convert.ToInt32 (Console.ReadLine ());
charcreatepts = charcreatepts - CCPint3;
if (CCPint3 > charcreatepts) {
Console.WriteLine ("Point amount too high! Press Enter.");
Console.ReadLine ();
Start();
}
}
}
}
}
我正在努力得到它,所以如果你愿意,你可以在这种情况下使用剩余的 5 点,力量,但由于某种原因,我什至不能使用 4。