From f46d0cdaf9ee3cb3e44bc7ad71652ccb41341603 Mon Sep 17 00:00:00 2001 From: Cyl18 Date: Mon, 26 Feb 2018 19:42:56 +0800 Subject: [PATCH] update --- CardSharp/CardSharp.csproj | 1 + CardSharp/Constants.cs | 4 ++-- CardSharp/GameComponents/IPlayerConfig.cs | 3 +++ CardSharp/GameComponents/Multiplier.cs | 4 ++-- CardSharp/GameComponents/PlayerConfig.cs | 2 +- CardSharp/GameSteps/WaitingParser.cs | 10 +++++----- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CardSharp/CardSharp.csproj b/CardSharp/CardSharp.csproj index b9a8a09..0971e37 100644 --- a/CardSharp/CardSharp.csproj +++ b/CardSharp/CardSharp.csproj @@ -47,6 +47,7 @@ + ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll diff --git a/CardSharp/Constants.cs b/CardSharp/Constants.cs index 21620a0..afdcbcc 100644 --- a/CardSharp/Constants.cs +++ b/CardSharp/Constants.cs @@ -6,8 +6,8 @@ public class Constants public const int AmountCardNum = 4; /*每种牌4张*/ public const int MaxPlayer = 3; /*最多3人*/ public const string ConfigDir = "CardSharp"; - public const long PointAdd = 10000 * (long)int.MaxValue; - public const int BaseScore = 1000; + public const long PointAdd = 10000; + public const long BaseScore = 1000; public const int BoardcastCardNumThreshold = 5; public class Cards diff --git a/CardSharp/GameComponents/IPlayerConfig.cs b/CardSharp/GameComponents/IPlayerConfig.cs index 65cb423..0b9bda2 100644 --- a/CardSharp/GameComponents/IPlayerConfig.cs +++ b/CardSharp/GameComponents/IPlayerConfig.cs @@ -1,4 +1,6 @@ using System; +using System.Numerics; +using Newtonsoft.Json; namespace CardSharp.GameComponents { @@ -9,4 +11,5 @@ public interface IPlayerConfig string PlayerID { get; } bool IsAdmin { get; } } + } \ No newline at end of file diff --git a/CardSharp/GameComponents/Multiplier.cs b/CardSharp/GameComponents/Multiplier.cs index e91924b..492728a 100644 --- a/CardSharp/GameComponents/Multiplier.cs +++ b/CardSharp/GameComponents/Multiplier.cs @@ -18,9 +18,9 @@ public static void Multiplie(Desk desk, IRule rule) } } - public static int CalcResult(Desk desk) + public static long CalcResult(Desk desk) { - return (int) Math.Pow(2, desk.Multiplier) * Constants.BaseScore; + return (long) Math.Pow(2, desk.Multiplier) * Constants.BaseScore; } } } \ No newline at end of file diff --git a/CardSharp/GameComponents/PlayerConfig.cs b/CardSharp/GameComponents/PlayerConfig.cs index 39fea5e..c8cd337 100644 --- a/CardSharp/GameComponents/PlayerConfig.cs +++ b/CardSharp/GameComponents/PlayerConfig.cs @@ -10,7 +10,7 @@ static PlayerConfig() if (!Directory.Exists(Constants.ConfigDir)) Directory.CreateDirectory(Constants.ConfigDir); } - public PlayerConfig(string playerid, int point = default, DateTime lastTime = default, bool isAdmin = default ) + public PlayerConfig(string playerid, long point = default, DateTime lastTime = default, bool isAdmin = default ) { PlayerID = playerid ?? throw new ArgumentNullException(nameof(playerid)); Point = point; diff --git a/CardSharp/GameSteps/WaitingParser.cs b/CardSharp/GameSteps/WaitingParser.cs index c9a5aad..fdf5a98 100644 --- a/CardSharp/GameSteps/WaitingParser.cs +++ b/CardSharp/GameSteps/WaitingParser.cs @@ -12,10 +12,10 @@ public void Parse(Desk desk, Player player, string command) case "上桌": case "fork table": case "法克忒薄": // By Charlie Jiang - //var point = PlayerConfig.GetConfig(player).Point; - //if (point <= 0) - // desk.AddMessage($"你的积分不足以进行游戏! 你现在有{point}点积分."); - //else + var point = PlayerConfig.GetConfig(player).Point; + if (point <= -100000) + desk.AddMessage($"CNM 这里是CY 你们的印钞厂停业了."); + else desk.AddPlayer(player); break; case "下桌": @@ -41,7 +41,7 @@ public void Parse(Desk desk, Player player, string command) break; } - if (command.StartsWith("开始游戏 ")) + if (command.StartsWith("开始游戏 ") && PlayerConfig.GetConfig(player).IsAdmin) { var seed = int.Parse(command.Substring(5)); if (desk.PlayerList.Count == 3)