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

Commit

Permalink
add some check
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyl18 committed Feb 18, 2018
1 parent f9b1861 commit ef12bec
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions CardSharp/GameSteps/LandlordDiscuss.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using CardSharp.GameComponents;
using CardSharp.GameSteps;

Expand All @@ -15,8 +16,7 @@ public LandlordDiscuss(IEnumerable<Card> landlordCards, Desk desk)
_landlordCards = landlordCards;
var player = desk.GetPlayerFromIndex(CurrentIndex);
desk.AddMessage($"开始游戏, {player.ToAtCode()}你要抢地主吗?[抢地主/不抢]");
if (player is FakePlayer)
{
if (player is FakePlayer) {
Parse(desk, player, "抢");
}
}
Expand All @@ -25,38 +25,47 @@ public void Parse(Desk desk, Player player, string command)
{
if (!desk.Players.Contains(player))
return;
switch (command)
{
switch (command) {
case "加倍":
if (!player.Multiplied)
{
if (desk.Players.Any(p => p is FakePlayer)) {
desk.AddMessage("有机器人玩家, 加倍不可用");
break;
}

if (!player.Multiplied) {
desk.AddMessage("加倍完成.");
desk.Multiplier += 1;
player.Multiplied = true;
}

break;
case "超级加倍":
if (!player.Multiplied)
{
if (desk.Players.Any(p => p is FakePlayer)) {
desk.AddMessage("有机器人玩家, 加倍不可用");
break;
}

if (!player.Multiplied) {
desk.AddMessage("超级加倍完成.");
desk.Multiplier += 2;
player.Multiplied = true;
}

break;
case "SUDDEN_DEATH_DUEL_CARD":
if (!player.Multiplied && !desk.SuddenDeathEnabled)
{
if (desk.Players.Any(p => p is FakePlayer)) {
desk.AddMessage("有机器人玩家, 加倍不可用");
break;
}
if (!player.Multiplied && !desk.SuddenDeathEnabled) {
desk.AddMessage("SUDDEN DEATH ENABLED.");
desk.SuddenDeathEnabled = true;
player.Multiplied = true;
}

break;
case "明牌":
if (!player.PublicCards)
{
if (!player.PublicCards) {
player.PublicCards = true;
desk.Multiplier += 1;
desk.AddMessage("明牌成功.");
Expand All @@ -71,14 +80,12 @@ public void Parse(Desk desk, Player player, string command)
if (!IsValidPlayer(desk, player))
return;

if (_count >= 3)
{
if (_count >= 3) {
desk.AddMessage("你们干嘛呢 我...我不干了!(╯‵□′)╯︵┻━┻");
desk.FinishGame();
}

switch (command)
{
switch (command) {
case "抢":
case "抢地主":
case "抢他妈的":
Expand Down

0 comments on commit ef12bec

Please sign in to comment.