Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyl18 committed Feb 26, 2018
1 parent eb551e2 commit f46d0cd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions CardSharp/CardSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
Expand Down
4 changes: 2 additions & 2 deletions CardSharp/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions CardSharp/GameComponents/IPlayerConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Numerics;
using Newtonsoft.Json;

namespace CardSharp.GameComponents
{
Expand All @@ -9,4 +11,5 @@ public interface IPlayerConfig
string PlayerID { get; }
bool IsAdmin { get; }
}

}
4 changes: 2 additions & 2 deletions CardSharp/GameComponents/Multiplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion CardSharp/GameComponents/PlayerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions CardSharp/GameSteps/WaitingParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 "下桌":
Expand All @@ -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)
Expand Down

0 comments on commit f46d0cd

Please sign in to comment.