コード例 #1
0
        /// <summary>
        /// 与另一个玩家交换所有卡牌
        /// </summary>
        /// <param name="target"></param>
        internal void ExchangeCards(SimpleGamePlayer target)
        {
            DealCards();
            target.DealCards();

            var cards = target._cards;

            target._cards = cards;
            _cards        = cards;

            PlayerHost.WriteMessage("卡牌已经交换");
        }
コード例 #2
0
        /// <summary>
        /// 重写此方法进行游戏
        /// </summary>
        /// <param name="roundEvent">玩家回合事件信息</param>
        /// <param name="token">取消标识</param>
        /// <returns>用于等待玩家操作完成的 Task 对象</returns>
        protected override async Task PlayCard(PlayerRoundEvent roundEvent, CancellationToken token)
        {
            {
                var list = secretMessages;
                secretMessages = new ConcurrentBag <GameMessage>();
                foreach (var message in list)
                {
                    PlayerHost.WriteMessage(message, true);
                }
            }

            if ((bool?)roundEvent.DataBag.Confine == true)
            {
                Game.AnnounceMessage($"只见 {PlayerName} 动弹不得,什么也做不了。");
                PlayerHost.WriteMessage("您被禁锢一回合,无法出牌");
                return;
            }

            ActionPoint = 1;
            DealCards();


            await base.PlayCard(roundEvent, token);
        }