Exemple #1
0
        internal virtual void MoveNext(Desk desk)
        {
            desk.Step++;
            if (Reversed)
            {
                CurrentIndex--;
                if (CurrentIndex == -1)
                {
                    CurrentIndex = desk.Players.Count() - 1;
                }
            }
            else
            {
                CurrentIndex = (CurrentIndex + 1) % desk.Players.Count();
            }

            if (desk.CurrentPlayer.AutoSubmitCard)
            {
                desk.Events.Add(new TimerEvent(() => { DoAutoSubmitCard(desk); }, 5, desk.Step));
            }
            desk.Events.Add(new TimerEvent(() => { desk.AddMessage($"{desk.CurrentPlayer.AtCode}你只剩15s时间出牌啦!"); }, 25, desk.Step));
            desk.Events.Add(new TimerEvent(() =>
            {
                desk.CurrentPlayer.AutoSubmitCard = true;
                desk.AddMessage($"{desk.CurrentPlayer.AtCode}出牌超时");
                DoAutoSubmitCard(desk);
            }, 40, desk.Step));
        }
Exemple #2
0
        public void Parse(Desk desk, Player player, string command)
        {
            if (command.StartsWith("设置昵称 "))
            {
                var nick = command.Substring("设置昵称 ".Length);
                if (nick.Length > 20)
                {
                    desk.AddMessage("不要设置 太长的昵称 请。");
                    return;
                }
                var config = Config.Get();
                config.Nicks[player.PlayerId] = nick;
                config.Save();
                desk.AddMessage("Done.");
            }

            switch (command)
            {
            case "特殊牌功能":
                foreach (var specialCard in Card.SpecialCards)
                {
                    desk.AddMessageLine($"{specialCard.ShortName} {specialCard.Description}");
                    desk.AddMessageLine(specialCard.ToImage().ToImageCodeAndDispose());
                }
                break;
            }
        }
        private bool ParseUnoCommand(Desk desk, Player player, string command)
        {
            switch (command.ToUpper())
            {
            case "UNO":
            case "UNO!":
            case "UNO!":
                if ((desk.CurrentPlayer == player && player.Cards.Count == 2) ||
                    (desk.LastSendPlayer == player && player.Cards.Count == 1))
                {
                    player.Uno = true;
                    desk.AddMessage("UNO!");
                }
                else
                {
                    desk.AddMessage("你还不能说 UNO!");
                }
                return(true);

            case "质疑UNO":
            case "UNO PLZ":
                if (desk.LastSendPlayer.Cards.Count == 1 && !desk.LastSendPlayer.Uno)
                {
                    desk.AddMessage($"{desk.LastSendPlayer.AtCode}没有说 UNO, 被罚两张!");
                    desk.LastSendPlayer.AddCardsAndSort(2);
                    desk.SendLastCardMessage();
                }
                return(true);
            }

            return(false);
        }
Exemple #4
0
        private void Behave(Desk desk, Player player, Card card)
        {
            player.SendCardsMessage();
            MoveNext(desk);
            var nextPlayer = desk.CurrentPlayer;

            switch (card.Type)
            {
            case CardType.Number:
                // ignored
                break;

            case CardType.Reverse:
                desk.AddMessage("方向反转.");
                Reverse();
                MoveNext(desk);
                MoveNext(desk);
                break;

            case CardType.Skip:
                desk.AddMessage($"{nextPlayer.AtCode}被跳过.");
                MoveNext(desk);
                nextPlayer = desk.CurrentPlayer;
                break;

            case CardType.DrawTwo:
                desk.State           = GamingState.WaitingDrawTwoOverlay;
                desk.OverlayCardNum += 2;
                BehaveDrawTwo(nextPlayer, desk);
                break;

            case CardType.Wild:
                desk.AddMessage($"变色");
                break;

            case CardType.DrawFour:
                if (desk.State == GamingState.Gaming)
                {
                    _firstSubmitDrawFourPlayer = Previous(desk);
                    desk.State = GamingState.WaitingDrawFourOverlay;
                }
                desk.OverlayCardNum += 4;
                BehaveDrawFour(nextPlayer, desk);
                break;

            case CardType.Special:
                var special = (ISpecialCard)card;
                desk.AddMessage($"特殊牌: {special.ShortName}, {special.Description}!");
                special.Behave(desk);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #5
0
        public void Parse(Desk desk, Player player, string command)
        {
            switch (command)
            {
            case "上桌":
            case "fork table":
            case "法克忒薄":     // By Charlie Jiang
                //var point = PlayerConfig.GetConfig(player).Point;
                //if (point <= 0)
                //    desk.AddMessage($"你的积分不足以进行游戏! 你现在有{point}点积分.");
                //else
                desk.AddPlayer(player);
                break;

            case "下桌":
                desk.RemovePlayer(player);
                break;

            case "开始游戏":
                if (desk.Players.All(p => p is FakePlayer))
                {
                    desk.AddMessage("仨机器人可不行哟~");
                    return;
                }
                if (desk.PlayerList.Count == 3)
                {
                    desk.Start();
                }
                else
                {
                    desk.AddMessage("人数不够.");
                }
                break;

            case "添加机器人":
                desk.AddPlayer(new FakePlayer(desk));
                break;

            case "移除机器人":
                if (desk.Players.Any(p => p is FakePlayer))
                {
                    desk.RemovePlayer(desk.Players.First(p => p is FakePlayer));
                }
                break;
            }

            if (command.StartsWith("开始游戏 "))
            {
                var seed = int.Parse(command.Substring(5));
                if (desk.PlayerList.Count == 3)
                {
                    desk.Start(seed);
                }
            }
        }
Exemple #6
0
        public void Parse(Desk desk, Player player, string command)
        {
            if (command.StartsWith("设置昵称 "))
            {
                var nick = command.Substring("设置昵称 ".Length);
                if (nick.Length > 40)
                {
                    desk.AddMessage("请不要设置 太长的昵称 。");
                    return;
                }
                var config = Config.Get();
                config.Nicks[player.PlayerId] = nick;
                config.Save();
                desk.AddMessage("Done.");
            }

            switch (command)
            {
            case "特殊牌功能":
                foreach (var specialCard in Card.SpecialCards)
                {
                    desk.AddMessageLine($"{specialCard.ShortName} {specialCard.Description}");
                    desk.AddMessageLine(specialCard.ToImage().ToImageCodeAndDispose());
                }
                break;
            }

            if (Config.IsAdmin(player.PlayerId))
            {
                if (command.StartsWith("印卡"))
                {
                    var split  = command.Split(' ');
                    var target = split[1];
                    var num    = int.Parse(split[2]);
                    desk.AddMessage("[印卡场] 快速印卡正在执行...");
                    if (num > 200)
                    {
                        desk.GetPlayer(target).FastCreateCards(num);
                    }
                    else
                    {
                        desk.GetPlayer(target).AddCardsAndSort(num);
                    }
                    desk.AddMessage("[印卡场] Done.");
                    desk.SendLastCardMessage();
                    GC.Collect();
                }
            }
        }
Exemple #7
0
 private void FinishDoubt(Desk desk, Player player, bool doubt)
 {
     if (doubt)
     {
         if (desk.LastNonDrawFourCard == null)
         {
             desk.AddMessage("无法质疑: 没有上一张牌.");
             desk.FinishDraw(player);
             return;
         }
         var valid = _firstSubmitDrawFourPlayer.Cards.ContainsColor(desk.LastNonDrawFourCard.Color) ||
                     _firstSubmitDrawFourPlayer.Cards.ContainsValue(desk.LastNonDrawFourCard.Value);
         if (valid) // doubt is valid
         {
             desk.FinishDraw(_firstSubmitDrawFourPlayer);
         }
         else
         {
             desk.OverlayCardNum += 2;
             desk.FinishDraw(player);
         }
     }
     else
     {
         desk.FinishDraw(player);
     }
 }
Exemple #8
0
        private void Update(Desk desk)
        {
            const string path     = "Origind.Card.Game\\CardSharp.dll";
            const string filename = "CardSharp.dll";

            try
            {
                File.Delete(path);
            }
            catch (Exception e)
            {
                desk.AddMessage($"删除文件时发生错误 {e}");
                return;
            }
            var data = ReleaseGetter.Get();
            var wc   = new WebClient();

            wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36");
            wc.DownloadFile(data.assets.First(asset => asset.name == filename).browser_download_url, path);
            desk.AddMessage($"文件下载完成.");
        }
Exemple #9
0
        private static void Commits(Desk desk)
        {
            var updates = CommitsGetter.Get()
                          .Take(6);
            var sb2 = new StringBuilder();

            sb2.AppendLine("最近的6次更新: ");
            foreach (var data in updates)
            {
                sb2.AppendLine($"{data.commit.author.date}:{data.commit.author.name} {data.commit.message}");
            }

            desk.AddMessage(sb2.ToString());
        }
Exemple #10
0
        public static void DoAutoSubmitCard(Desk desk)
        {
            var validstr = UnoRule.ExtractCommand(desk.CurrentPlayer.Cards, desk.LastCard, desk.State);

            desk.AddMessage($"{(desk.CurrentPlayer is FakePlayer ? "机器人" : "托管玩家")}命令: {validstr}");
            Thread.Sleep(100);
            var cp = desk.CurrentPlayer.PlayerId;

            if (desk.CurrentPlayer.Cards.Count == 2)
            {
                desk.Events.Add(new TimerEvent(() => desk.ParseMessage(cp, "uno"), 1, -1));
            }
            desk.ParseMessage(desk.CurrentPlayer.PlayerId, validstr);
        }
Exemple #11
0
        private static void ScoreBoard(Desk desk)
        {
            var configs = Directory.GetFiles(Constants.ConfigDir)
                          .Select(File.ReadAllText)
                          .Select(PlayerConfig.FromJson)
                          .OrderByDescending(conf => conf.Point)
                          .Take(10);
            var sb = new StringBuilder();

            sb.AppendLine("积分排行榜: ");
            foreach (var config in configs)
            {
                sb.AppendLine($"{(config.IsAdmin ? "**" : "")}{config.PlayerID}-{config.ToAtCode()}: {config.Point}");
            }

            desk.AddMessage(sb.ToString());
        }
 private void BehaveDrawFour(Player nextPlayer, Desk desk)
 {
     if (nextPlayer.Cards.ContainsType(CardType.DrawFour))
     {
         nextPlayer.AddMessage("你现在可以选择 叠加+4 或者 摸牌来让前面叠加的+2加到你身上");
     }
     else
     {
         if (desk.OverlayCardNum > 4)
         {
             desk.FinishDraw(nextPlayer);
         }
         else
         {
             desk.State = GamingState.Doubting;
             desk.AddMessage($"{nextPlayer.AtCode}你要质疑吗?");
         }
     }
 }
Exemple #13
0
        private void TimerDraw(Desk desk, Player player, Card deskLastCard)
        {
            var genCard = Card.Generate();

            player.AddCardAndSort(genCard);
            if (UnoRule.IsValid(genCard, deskLastCard, desk.State))
            {
                desk.AddMessageLine("摸牌结束. 强制打出.");
                desk.ParseMessage(player.PlayerId, genCard.ToShortString());
            }
            else
            {
                desk.AddMessage("没有摸到....继续摸牌");
                desk.Events.Add(new TimerEvent(() =>
                {
                    TimerDraw(desk, player, deskLastCard);
                }, 2, desk.Step));
            }
        }
Exemple #14
0
        public override void Parse(Desk desk, Player player, string command)
        {
            var genericCommand = ToGenericCommand(command);

            switch (genericCommand)
            {
            case "join":
                desk.AddPlayer(player);
                break;

            case "leave":
                desk.RemovePlayer(player);
                break;

            case "addRobot":
                desk.AddMessage("请使用 添加机器人 [昵称]");
                break;

            case "start":
                desk.StartGame();
                break;
            }

            if (command.StartsWith("添加机器人 "))
            {
                var nick = command.Substring(6);
                desk.AddPlayer(new FakePlayer(nick, desk));
            }

            if (command.StartsWith("移除机器人 "))
            {
                var nick    = command.Substring(6);
                var players = desk.PlayerList.OfType <FakePlayer>().Where(p => p.Nick == nick).ToArray();
                if (players.Length == 0)
                {
                    return;
                }
                desk.RemovePlayer(players.First());
            }
        }
Exemple #15
0
        private bool ParseStandardCommand(Desk desk, Player player, string command)
        {
            switch (command)
            {
            case "结束游戏":
                desk.AddMessage("请寻找管理员结束.");
                return(true);

            case "记牌器":
                desk.AddMessage(CardCounter.GenerateCardString(desk));
                return(true);

            case "全场牌数":
                desk.AddMessage(string.Join(Environment.NewLine,
                                            desk.PlayerList.Select(p => $"{p.ToAtCodeWithRole()}: {p.Cards.Count}")));
                return(true);

            //case "弃牌":
            //player.GiveUp = true;
            //desk.AddMessage("弃牌成功");
            //return true;

            case "托管":
                if (desk.Players.Count(p => p is FakePlayer) == 2)
                {
                    desk.AddMessage("你觉得这样好玩么?");
                    return(true);
                }
                player.HostedEnabled = true;
                desk.AddMessage("托管成功");
                RunHostedCheck(desk);
                return(true);

            case "结束托管":
                player.HostedEnabled = false;
                desk.AddMessage("结束成功");
                return(true);
            }

            return(false);
        }
        public override void Parse(Desk desk, Player player, string command)
        {
            if (!desk.Players.Contains(player))
            {
                return;
            }
            if (ParseUnoCommand(desk, player, command))
            {
                return;
            }
            if (!IsValidPlayer(desk, player))
            {
                return;
            }

            // uno draw
            switch (command)
            {
            case "摸":
            case "摸牌":
            case "mo":
            case "draw":
            case "画画":
                switch (desk.State)
                {
                case GamingState.Gaming:
                    player.AddCardsAndSort(1);
                    desk.AddMessageLine("已为你摸牌.");
                    break;

                case GamingState.WaitingDrawTwoOverlay:
                case GamingState.WaitingDrawFourOverlay:
                    desk.FinishDraw(desk.CurrentPlayer);
                    break;

                case GamingState.Doubting:
                    desk.AddMessage("我在问你要不要质疑! 不是问你摸不摸!");
                    return;
                }

                MoveNext(desk);
                desk.SendLastCardMessage();
                return;
            }

            // uno doubt
            if (desk.State == GamingState.Doubting)
            {
                switch (command)
                {
                case "质疑":
                    FinishDoubt(desk, player, true);
                    return;

                case "不质疑":
                    FinishDoubt(desk, player, false);
                    return;

                default:
                    desk.AddMessage("不是一个标准的质疑命令.");
                    return;
                }
            }

            // uno submit card
            var card = command.ToCard();

            if (card == null)
            {
                desk.AddMessage("无法匹配你想出的牌.");
                return;
            }

            if (!UnoRule.IsValid(card, desk.LastCard, desk.State))
            {
                desk.AddMessage("你想出的牌并不匹配 UNO 规则.");
                return;
            }

            if (!card.IsValidForPlayerAndRemove(player))
            {
                desk.AddMessage("你的手里并没有这些牌.");
                return;
            }

            desk.LastCard = card;
            if (card.Type != CardType.DrawFour)
            {
                desk.LastNonDrawFourCard = card;
            }

            if (player.Cards.Count == 0)
            {
                desk.FinishGame(player);
                return;
            }

            player.LastSendTime = DateTime.Now;
            desk.LastSendPlayer = player;
            Behave(desk, player, card);
            desk.SendLastCardMessage();
        }
Exemple #17
0
        private void ParsePlayerSubmitCard(Desk desk, Player player, string command)
        {
            switch (command)
            {
            case "过":

                #region Pass

            case "pass":
            case "passs":
            case "passss":
            case "passsss":
            case "passssss":
            case "passsssss":
            case "passssssss":
            case "passsssssss":
            case "passssssssss":
            case "passsssssssss":
            case "passssssssssss":     // 应LG的要求 别怪我 这里是暴力写法
            case "passsssssssssss":
            case "passssssssssssss":
            case "passsssssssssssss":
            case "passssssssssssssss":
            case "passsssssssssssssss":
            case "passssssssssssssssss":
            case "passsssssssssssssssss":
            case "passssssssssssssssssss":
            case "passsssssssssssssssssss":

                #endregion

            case "不出":
            case "不要":
            case "出你妈":
            case "要你妈":
                if (desk.CurrentRule == null)
                {
                    desk.AddMessage("为什么会这样呢...为什么你不出牌呢...");
                }
                else
                {
                    AnalyzeGiveUpAndMoveNext(desk);
                    RefreshCurrentRule(desk);
                    desk.BoardcastCards();
                }

                return;
            }

            if (command.StartsWith("出"))
            {
                desk.AddMessage("出的命令已经被替换为直接出牌. 如<出34567>被替换为<34567>");
                command = command.Substring(1);
            }
            var cardsCommand = command.ToUpper();
            if (cardsCommand.IsValidCardString())
            {
                if (Rules.Rules.IsCardsMatch(cardsCommand.ToCards(), desk))
                {
                    player.SendCards(desk);
                    if (CheckPlayerWin(desk))
                    {
                        return;
                    }
                    if (player.Cards.Count <= Constants.BoardcastCardNumThreshold)
                    {
                        desk.AddMessageLine($"{player.ToAtCodeWithRole()} 只剩{player.Cards.Count}张牌啦~");
                    }

                    if (desk.SuddenDeathEnabled)
                    {
                        desk.AddMessageLine("WARNING: SUDDEN DEATH ENABLED");
                    }

                    if (player.PublicCards)
                    {
                        desk.AddMessageLine($"明牌:{player.Cards.ToFormatString()}");
                    }

                    AnalyzeGiveUpAndMoveNext(desk);
                    RefreshCurrentRule(desk);
                    desk.BoardcastCards();
                }
                else
                {
                    if (desk.CurrentRule != null)
                    {
                        var rule = Rules.Rules.FirstMatchRule(cardsCommand.ToCards());
                        if (rule != null && rule != desk.CurrentRule)
                        {
                            desk.AddMessage($"你想出的牌匹配了规则{rule},但是当前规则是{desk.CurrentRule},所以你并不能出牌哟~~");
                        }
                        else
                        {
                            desk.AddMessage("你似乎不能出这些牌哟~");
                        }
                    }
                    else
                    {
                        desk.AddMessage("你似乎不能出这些牌哟~");
                    }
                }
            }
        }
Exemple #18
0
 public void Prepare(Desk desk)
 {
     desk.AddMessage($"请{desk.CurrentPlayer.ToAtCodeWithRole()}出牌");
     RunHostedCheck(desk);
 }
Exemple #19
0
        public void Parse(Desk desk, Player player, string command)
        {
            switch (command)
            {
            case "上桌":
            case "fork table":
            case "法克忒薄":     // By Charlie Jiang
                var point = PlayerConfig.GetConfig(player).Point;
                if (point <= -100000)
                {
                    desk.AddMessage($"CNM 这里是CY 你们的印钞厂停业了.");
                }
                else if (point <= -2000)
                {
                    desk.AddMessage("你输光了.");
                }
                else if (point == 0)
                {
                    desk.AddMessage("你没输入过'领取积分'");
                }
                else
                {
                    desk.AddPlayer(player);
                }
                break;

            case "下桌":
                desk.RemovePlayer(player);
                break;

            case "开始游戏":
                if (desk.Players.Count(p => p is FakePlayer) >= 2)
                {
                    desk.AddMessageLine("游戏要和朋友一起玩才好玩嘛!如果你想看机器人打架 可以@管理员 '表演开始'.");

                    return;
                }

                if (desk.PlayerList.Count == 3)
                {
                    desk.Start();
                }
                else
                {
                    desk.AddMessage("人数不够.");
                }
                break;

            case "添加机器人":
                desk.AddPlayer(new FakePlayer(desk));
                break;

            case "移除机器人":
                if (desk.Players.Any(p => p is FakePlayer))
                {
                    desk.RemovePlayer(desk.Players.First(p => p is FakePlayer));
                }
                break;
            }

            if (command.StartsWith("开始游戏 ") && PlayerConfig.GetConfig(player).IsAdmin)
            {
                var seed = int.Parse(command.Substring(5));
                if (desk.PlayerList.Count == 3)
                {
                    desk.Start(seed);
                }
            }
            if (command.StartsWith("表演开屎") && PlayerConfig.GetConfig(player).IsAdmin)
            {
                if (desk.Players.Any())
                {
                    desk.AddMessage("有玩家了不可以使用.");
                    return;
                }

                for (int i = 0; i < 3; i++)
                {
                    desk.AddPlayer(new FakePlayer(desk));
                }
                desk.Start();
            }
        }
        public void Parse(Desk desk, Player player, string command)
        {
            switch (command)
            {
            case "上桌":
            case "fork table":
            case "法克忒薄":     // By Charlie Jiang
                var point = PlayerConfig.GetConfig(player).Point;
                if (point <= -100000)
                {
                    desk.AddMessage($"CNM 这里是CY 你们的印钞厂停业了.");
                }
                else if (point <= 0)
                {
                    desk.AddMessage("您输完了/没领取过分.");
                }
                else
                {
                    desk.AddPlayer(player);
                }
                break;

            case "下桌":
                desk.RemovePlayer(player);
                break;

            case "开始游戏":
                if (desk.Players.All(p => p is FakePlayer))
                {
                    desk.AddMessage("仨机器人可不行哟~");
                    return;
                }

                if (desk.PlayerList.Count == 3)
                {
                    desk.Start();
                }
                else
                {
                    desk.AddMessage("人数不够.");
                }
                break;

            case "添加机器人":
                desk.AddPlayer(new FakePlayer(desk));
                break;

            case "移除机器人":
                if (desk.Players.Any(p => p is FakePlayer))
                {
                    desk.RemovePlayer(desk.Players.First(p => p is FakePlayer));
                }
                break;
            }

            if (command.StartsWith("开始游戏 ") && PlayerConfig.GetConfig(player).IsAdmin)
            {
                var seed = int.Parse(command.Substring(5));
                if (desk.PlayerList.Count == 3)
                {
                    desk.Start(seed);
                }
            }
        }
        public void Parse(Desk desk, Player player, string command)
        {
            if (command.Contains("当前玩家有: ") && !command.Contains("UNO"))
            {
                desk.AddMessage($"我们目前检测到了一些小小的\"机器人冲突\". 输入[关闭机器人{RandomBotId}]来降低这个机器人在此群的地位.");
            }

            if (command == $"关闭机器人{RandomBotId}")
            {
                Desk.ShutedGroups.Add(desk.DeskId);
                desk.AddMessage($"已经关闭斗地主. 重新恢复为[恢复机器人{RandomBotId}]");
            }
            else if (command == $"恢复机器人{RandomBotId}")
            {
                Desk.ShutedGroups.RemoveAll(d => d == desk.DeskId);
                desk.AddMessage("已经重启斗地主.");
            }

            var pconfig = PlayerConfig.GetConfig(player);

            switch (command)
            {
            case "所有游戏":
                desk.BoardcastDesks();
                break;

            case "获取积分":
                var px = DateTime.Now - pconfig.LastTime;
                if (px.TotalSeconds.Seconds() > 12.Hours())
                {
                    pconfig.AddPoint();
                    desk.AddMessage($"领取成功. 你当前积分为{pconfig.Point}");
                }
                else
                {
                    desk.AddMessage(
                        $"你现在不能这么做. 你可以在{(12.Hours() - px).Humanize(culture: new CultureInfo("zh-CN"), maxUnit: TimeUnit.Hour)}后领取.");
                }

                break;

            case "我的信息":
                desk.AddMessage($"你的积分为 {pconfig.Point}");
                break;

            case "重新发牌":
                if (desk.State == GameState.Gaming || desk.State == GameState.DiscussLandlord)
                {
                    desk.SendCardsMessage();
                }
                break;

            case "命令列表":
                desk.AddMessage(@"=    命令列表    =

/////没牌的直接添加机器人好友(有牌的最好也添加)机器人会自动同意请求\\\\\
Powered by Cy.
Unpowered by LG.
命令说明:
         带有[D]的命令 还未开发完成
         带有[B]的命令 是测试功能,可能会更改
         带有[R]的命令 是正式功能,'一般'不会做更改
群聊命令:
[R]|上桌|fork table|:加入游戏
[R]|下桌|:退出游戏
[R]|过|不出|不要|出你妈|要你妈|pass|passs|passss|passsss|passsssssssssssssssss|:过牌
[R]|抢地主|抢他妈的|:抢地主
[R]|不抢|抢你妈|抢个鸡毛掸子|:不抢地主
[R]|开始游戏|:准备环节→开始游戏
[R]|重新发牌|:不是重置牌!是会把你的牌通过私聊再发一次!
[R]|加倍|:加倍或超级加倍在一局游戏中只能使用一次
[R]|超级加倍|:加倍再加倍
[B]|减倍|:减倍或超级减倍在一局游戏中只能使用一次
[B]|超级减倍|:减倍再减倍
[B]|SUDDEN_DEATH_DUEL_CARD|: 死亡决斗卡 将会把你所有的积分赌上桌,要么破产,要么暴富
[R]|下桌|:退出游戏,只能在准备环节使用
[R]|明牌|:显示自己的牌给所有玩家,明牌会导致积分翻倍,只能在发完牌后以及出牌之前使用。
[B]|托管|:自动出牌
[B]|结束托管|:结束自动出牌
[B]|弃牌|:放弃本局游戏,当地主或者两名农民弃牌游戏结束,弃牌农民玩家赢了不得分,输了双倍扣分
[B]|结束游戏|:只有参与游戏的人可以使用
[R]|获取积分|:获取积分,12小时可获取10000分。
[R]|我的信息|:你的积分
[B]|记牌器|:显示每种牌在场上还剩下多少张
[B]|安静出牌启用|:所有信息都会私聊发送
[B]|安静出牌禁用|:所有信息不都会私聊发送
[B]|自动过牌启用|:启用自动过牌
[B]|自动过牌禁用|:禁用自动过牌

如果崩溃请大家多多包涵,游戏愉快。
");
                break;

            case "安静出牌启用":
                desk.Silence = true;
                break;

            case "安静出牌禁用":
                desk.Silence = false;
                break;

            case "自动过牌启用":
                player.AutoPass = true;
                desk.AddMessage("Done.");
                break;

            case "自动过牌禁用":
                player.AutoPass = false;
                desk.AddMessage("Done.");
                break;
            }

            if (pconfig.IsAdmin)
            {
                switch (command)
                {
                case "结束游戏":
                    desk.FinishGame();
                    break;

                case "玩家牌":
                    if (!Player.ForceSendPlayers.Contains(player))
                    {
                        Player.ForceSendPlayers.Add(player);
                    }
                    player.ForceSend = true;
                    player.AddMessage(string.Join(Environment.NewLine, desk.Players.Select(p => $"{p.PlayerId} {p.Cards.ToFormatString()}")));
                    break;
                }

                if (command.StartsWith("设置积分"))
                {
                    var sp     = command.Split(" ");
                    var target = sp[1];
                    var point  = int.Parse(sp[2]);
                    var cfg    = PlayerConfig.GetConfig(new Player(target));
                    cfg.Point = point;
                    desk.AddMessage("Set done.");
                    cfg.Save();
                }

                if (command.StartsWith("Sudo"))
                {
                    var sp     = command.Split(' ');
                    var target = sp[1];
                    var cmd    = sp[2];
                    desk.AddMessageLine("[Begin sudo execution block]");
                    desk.ParseCommand(target, cmd);
                    desk.AddMessage(Environment.NewLine + "[End sudo execution block]");
                }
            }
        }
Exemple #22
0
        public override void Parse(Desk desk, Player player, string command)
        {
            command = ToGenericCommand(command);
            switch (command)
            {
            case "lastCard":
                desk.SendLastCardMessage();
                return;
            }
            if (!desk.Players.Contains(player))
            {
                return;
            }
            if (ParseUnoCommand(desk, player, command))
            {
                return;
            }
            switch (command)
            {
            case "publicCard":
                player.PublicCard = true;
                desk.AddMessage("明牌成功.");
                return;

            case "myRound":
                desk.AddMessage("是是, 我们都知道是你的回合");
                return;

            case "autoSubmit":
                desk.AddMessage("完成.");
                player.AutoSubmitCard = true;
                return;

            case "disableAutoSubmit":
                desk.AddMessage("完成.");
                player.AutoSubmitCard = false;
                return;
            }



            var card = command.ToCard();

            if (card != null && UnoRule.IsValidForFollowCard(card, desk.LastCard, desk.State))
            {
                if (!card.IsValidForPlayerAndRemove(player))
                {
                    desk.AddMessage("你的手里并没有这些牌.");
                    return;
                }

                After(desk, player, card);
                CurrentIndex = desk.PlayerList.FindIndex(p => p == player);
                MoveNext(desk);
                desk.SendLastCardMessage();
            }
            if (!IsValidPlayer(desk, player))
            {
                return;
            }
            // uno draw
            switch (command)
            {
            case "draw":
                switch (desk.State)
                {
                case GamingState.Gaming:
                    TimerDraw(desk, player, desk.LastCard);
                    return;

                case GamingState.WaitingDrawTwoOverlay:
                case GamingState.WaitingDrawFourOverlay:
                    desk.FinishDraw(desk.CurrentPlayer);
                    break;

                case GamingState.Doubting:
                    desk.AddMessage("我在问你要不要质疑! 不是问你摸不摸!");
                    return;
                }

                MoveNext(desk);
                desk.SendLastCardMessage();
                return;
            }

            // uno doubt
            if (desk.State == GamingState.Doubting)
            {
                switch (command)
                {
                case "doubt":
                    FinishDoubt(desk, player, true);
                    return;

                case "nonDoubt":
                    FinishDoubt(desk, player, false);
                    return;

                default:
                    desk.AddMessage("不是一个标准的质疑命令.");
                    return;
                }
            }

            // uno submit card

            if (card == null)
            {
                desk.AddMessage("无法匹配你想出的牌.");
                return;
            }

            if (!UnoRule.IsValid(card, desk.LastCard, desk.State))
            {
                desk.AddMessage("你想出的牌并不匹配 UNO 规则.");
                return;
            }

            if (!card.IsValidForPlayerAndRemove(player))
            {
                desk.AddMessage("你的手里并没有这些牌.");
                return;
            }



            After(desk, player, card);
            desk.SendLastCardMessage();
        }
Exemple #23
0
        private void LatestUpdate(Desk desk)
        {
            var data = ReleaseGetter.Get();

            desk.AddMessage($"更新时间为: {data.assets.First().updated_at}");
        }