当前位置: 首页>>代码示例>>C#>>正文


C# TurnContext.DiscardCards方法代码示例

本文整理汇总了C#中Dominion.Rules.TurnContext.DiscardCards方法的典型用法代码示例。如果您正苦于以下问题:C# TurnContext.DiscardCards方法的具体用法?C# TurnContext.DiscardCards怎么用?C# TurnContext.DiscardCards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dominion.Rules.TurnContext的用法示例。


在下文中一共展示了TurnContext.DiscardCards方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Attack

 public override void Attack(Player victim, TurnContext context, ICard source)
 {
     if (victim.Hand.CardCount > 4)
     {
         context.DiscardCards(victim, victim.Hand);
         victim.DrawCards(4);
     }
 }
开发者ID:razzielx,项目名称:Dominion,代码行数:8,代码来源:Minion.cs

示例2: Play

        public void Play(TurnContext context)
        {
            if(context.ActivePlayer.Hand.CardCount > 0)
            {
                context.DiscardCards(context.ActivePlayer, context.ActivePlayer.Hand);
                context.AddLongLivedEffect(new TacticianEffect(this));
            }
            else
            {
                context.Game.Log.LogMessage("{0} did not have any cards to discard to the Tactician.", context.ActivePlayer.Name);
            }

        }
开发者ID:razzielx,项目名称:Dominion,代码行数:13,代码来源:Caravan.cs

示例3: Resolve

 public override void Resolve(TurnContext context, ICard source)
 {
     if(context.ActivePlayer.Hand.CardCount < 4)
     {
         context.DiscardCards(context.ActivePlayer, context.ActivePlayer.Hand);
     }
     else
     {
         var discardActivity = Activities.DiscardCards(context, context.ActivePlayer, 3, source);
         _activities.Add(discardActivity);    
     }
     
 }
开发者ID:razzielx,项目名称:Dominion,代码行数:13,代码来源:Warehouse.cs

示例4: Resolve

            public override void Resolve(TurnContext context, ICard source)
            {
                Action discardAction = () =>
                {
                    context.DiscardCards(context.ActivePlayer, context.ActivePlayer.Hand);
                    context.DrawCards(4);
                    DistributeAttacks(context, source);
                };

                Action moneyAction = () => context.AvailableSpend += 2;

                var activity = Activities.ChooseYesOrNo(context.Game.Log, context.ActivePlayer, "Discard your hand?",
                                                        source, discardAction, moneyAction);
                _activities.Add(activity);
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:15,代码来源:Minion.cs

示例5: Resolve

            public override void Resolve(TurnContext context, ICard source)
            {
                var activity = new SelectCardsActivity(
                    context,
                    "Select any number of cards to discard, you will draw 1 new card for each discard",
                    SelectionSpecifications.SelectUpToXCards(context.ActivePlayer.Hand.CardCount), source);

                activity.AfterCardsSelected = cards =>
                {
                    context.DiscardCards(activity.Player, cards);
                    context.DrawCards(cards.Count());
                };

                _activities.Add(activity);
            }
开发者ID:anatolilightfoot,项目名称:Dominion,代码行数:15,代码来源:Cellar.cs

示例6: Resolve

            public override void Resolve(TurnContext context)
            {
                var activity = new SelectCardsActivity(
                    context,
                    "Select any number of cards to discard, you will gain $1 per card",
                    SelectionSpecifications.SelectUpToXCards(context.ActivePlayer.Hand.CardCount));

                activity.AfterCardsSelected = cards =>
                {
                    context.DiscardCards(activity.Player, cards);
                    context.AvailableSpend += cards.Count();                    
                };
                
                _activities.Add(activity);
            }
开发者ID:trentkerin,项目名称:Dominion,代码行数:15,代码来源:SecretChamber.cs

示例7: Attack

            public override void Attack(Player victim, TurnContext context, ICard source)
            {
                Action discardCards;

                if (victim.Hand.CardCount > 2)
                    discardCards = () => _activities.Add(Activities.DiscardCards(context, victim, 2, source));
                else if(victim.Hand.CardCount > 0)
                    discardCards = () => context.DiscardCards(victim, victim.Hand);
                else
                    discardCards = () => context.Game.Log.LogMessage("{0} had no cards to discard.", victim.Name);
   
                Action gainCurse = () => new GainUtility(context, victim).Gain<Curse>(victim.Hand);

                var decideActivity = Activities.ChooseYesOrNo(context.Game.Log, victim, "Discard two cards to Torturer?",
                                                              source, discardCards, gainCurse);

                _activities.Add(decideActivity);
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:18,代码来源:Torturer.cs


注:本文中的Dominion.Rules.TurnContext.DiscardCards方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。