• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Rules.TurnContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



TurnContext类属于Dominion.Rules命名空间,在下文中一共展示了TurnContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Play

        public void Play(TurnContext context)
        {
            context.DrawCards(1);
            context.RemainingActions += 1;

            context.AddEffect(this, new UpgradeEffect());
        }
开发者ID:anatolilightfoot,项目名称:Dominion,代码行数:7,代码来源:Upgrade.cs


示例2: OnTurnStarting

            public override void OnTurnStarting(TurnContext context)
            {
                base.OnTurnStarting(context);

                context.DrawCards(1);
                context.Game.Log.LogMessage("Caravan draws an extra card");
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:7,代码来源:Caravan.cs


示例3: Resolve

            public override void Resolve(TurnContext context, ICard source)
            {
                var upgradeActivity = new SelectCardsActivity(context, "Select a card to Upgrade",
                    SelectionSpecifications.SelectExactlyXCards(1), source);

                upgradeActivity.AfterCardsSelected = cardList =>
                {
                    var player = context.ActivePlayer;
                    var cardToUpgrade = cardList.Single();
                    var upgradeCost = cardToUpgrade.Cost + 1;
                    context.Trash(player, cardToUpgrade);

                    if (context.Game.Bank.Piles.Any(p => !p.IsEmpty && p.TopCard.Cost == upgradeCost))
                    {
                        var gainActivity = Activities.GainACardCostingExactlyX(context.Game.Log, player,
                            upgradeCost, player.Discards, source);
                        _activities.Add(gainActivity);
                    }
                    else
                    {
                        context.Game.Log.LogMessage("{0} could gain no card of appropriate cost", player);
                    }
                };

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


示例4: Resolve

            public override void Resolve(TurnContext context, ICard source)
            {
                var estate = context.ActivePlayer.Hand.OfType<Estate>().FirstOrDefault();

                Action discardAction = () =>
                {
                    context.AvailableSpend += 4;
                    context.DiscardCard(context.ActivePlayer, estate);
                };

                Action gainAction = () => new GainUtility(context, context.ActivePlayer).Gain<Estate>();

                if (estate != null)
                {
                    var activity = Activities.ChooseYesOrNo
                        (context.Game.Log, context.ActivePlayer, "Discard an Estate?",
                         source,
                         discardAction, gainAction);

                    _activities.Add(activity);
                }
                else
                {
                    gainAction();
                }
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:26,代码来源:Baron.cs


示例5: Resolve

            public override void Resolve(TurnContext context)
            {
                var player = context.ActivePlayer;
                var log = context.Game.Log;

                if (player.Hand.OfType<IActionCard>().Any())
                {
                    var activity = new SelectCardsActivity(
                        log, player,
                        "Select an action to play twice",
                        SelectionSpecifications.SelectExactlyXCards(1));

                    activity.Specification.CardTypeRestriction = typeof (IActionCard);
                    activity.AfterCardsSelected = cards =>
                    {
                        var actionCard = cards.OfType<IActionCard>().Single();
                        log.LogMessage("{0} selected {1} to be played twice.", player.Name, actionCard.Name);

                        actionCard.MoveTo(player.PlayArea);

                        actionCard.Play(context);
                        actionCard.Play(context);
                    };

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


示例6: OnTurnStarting

 public void OnTurnStarting(TurnContext context)
 {
     context.RemainingActions += 1;
     context.AvailableSpend += 1;
     IsFinished = true;
     context.Game.Log.LogMessage("FishingVillage adds one action and one spend");
 }
开发者ID:anatolilightfoot,项目名称:Dominion,代码行数:7,代码来源:FishingVillage.cs


示例7: Play

        public void Play(TurnContext context)
        {
            context.RemainingActions += 2;
            context.AvailableSpend += 1;

            context.AddLongLivedEffect(new FishingVillageEffect(this));
        }
开发者ID:anatolilightfoot,项目名称:Dominion,代码行数:7,代码来源:FishingVillage.cs


示例8: Attack

            public override void Attack(Player victim, TurnContext context, ICard source)
            {
                var victoryTypes = victim.Hand.OfType<IVictoryCard>()
                    .WithDistinctTypes()
                    .ToList();

                if(victoryTypes.Count() > 1)
                {
                    var activity = Activities.PutCardOfTypeFromHandOnTopOfDeck(context.Game.Log, victim,
                                                                               "Select a victory card to put on top",
                                                                               typeof (IVictoryCard),
                                                                               source);
                   _activities.Add(activity);
                }
                else if(victoryTypes.Any())
                {
                    var card = victoryTypes.Single();
                    victim.Deck.MoveToTop(card);
                    context.Game.Log.LogMessage("{0} put a {1} on top of the deck.", victim.Name, card.Name);
                }
                else
                {
                    context.Game.Log.LogRevealHand(victim);
                }
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:25,代码来源:Bureaucrat.cs


示例9: Resolve

            public override void Resolve(TurnContext context, ICard source)
            {
                base.Resolve(context, source);

                if(context.ActivePlayer.Deck.TopCard != null)
                    _activities.Add(Activities.ChooseWhetherToMillTopCard(context, context.ActivePlayer, context.ActivePlayer, source));
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:7,代码来源:Spy.cs


示例10: Play

 public void Play(TurnContext context)
 {
     context.DrawCards(1);
     context.RemainingActions += 1;
     context.Buys += 1;
     context.AvailableSpend += 1;
 }
开发者ID:razzielx,项目名称:Dominion,代码行数:7,代码来源:Market.cs


示例11: Attack

            public override void Attack(Player victim, TurnContext context, ICard source)
            {
                var swindledCard = victim.Deck.TopCard;
                if(swindledCard == null)
                {
                    context.Game.Log.LogMessage("{0} did not have any cards to be swindled.", victim.Name);
                    return;
                }
                
                context.Trash(victim, swindledCard);
                var candidates = context.Game.Bank.Piles.Where(p => p.IsEmpty == false && p.TopCard.Cost == swindledCard.Cost);                

                if(candidates.Count() == 0)
                {
                    context.Game.Log.LogMessage("There are no cards of cost {0}.", swindledCard.Cost);
                }
                else if (candidates.Count() == 1)
                {
                    var pile = candidates.Single();
                    var card = pile.TopCard;
                    card.MoveTo(victim.Discards);
                    context.Game.Log.LogGain(victim, card);
                }
                else
                {
                    var activity = Activities.SelectACardForOpponentToGain(context, context.ActivePlayer, victim, swindledCard.Cost, source);
                    _activities.Add(activity);    
                }
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:29,代码来源:Swindler.cs


示例12: Play

        public void Play(TurnContext context)
        {
            context.RemainingActions += 1;
            context.DrawCards(1);

            context.AddLongLivedEffect(new CaravanEffect(this));
        }
开发者ID:trentkerin,项目名称:Dominion,代码行数:7,代码来源:Caravan.cs


示例13: Play

        public void Play(TurnContext context)
        {
            context.DrawCards(4);
            context.Buys += 1;

            foreach (var opponent in context.Opponents)
                opponent.DrawCards(1);
        }
开发者ID:razzielx,项目名称:Dominion,代码行数:8,代码来源:CouncilRoom.cs


示例14: DoTrash

 private void DoTrash(TurnContext context, ICard source)
 {
     if (context.ActivePlayer.Hand.CardCount > 0)
     {
         var activity = Activities.SelectUpToXCardsToTrash(context, context.ActivePlayer, 1, source);
         _activities.Add(activity);
     }
 }
开发者ID:razzielx,项目名称:Dominion,代码行数:8,代码来源:Masquerade.cs


示例15: Attack

            public override void Attack(Player victim, TurnContext context, ICard source)
            {
                if (victim.Deck.CardCount + victim.Discards.CardCount > 0)
                    victim.Deck.MoveTop(1, victim.Discards);

                var gainUtil = new GainUtility(context, victim);
                gainUtil.Gain<Curse>(c => victim.Deck.MoveToTop(c));
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:8,代码来源:SeaHag.cs


示例16: 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


示例17: Attack

            public override void Attack(Player player, TurnContext context, ICard source)
            {
                if (player.Deck.CardCount + player.Discards.CardCount > 0)
                    player.Deck.MoveTop(1, player.Discards);

                var gainUtil = new GainUtility(context, player);
                gainUtil.Gain<Curse>(c => player.Deck.MoveToTop(c));
            }
开发者ID:anatolilightfoot,项目名称:Dominion,代码行数:8,代码来源:SeaHag.cs


示例18: Attack

            public override void Attack(Player victim, TurnContext context, ICard source)
            {
                int cardsToPutBack = victim.Hand.CardCount - 3;

                var activities = Activities.PutMultipleCardsFromHandOnTopOfDeck(context.Game.Log, victim, cardsToPutBack, source);
                foreach(var activity in activities)
                    _activities.Add(activity);
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:8,代码来源:GhostShip.cs


示例19: TrashAndDiscard

 private Card TrashAndDiscard(TurnContext context, RevealZone revealZone, IEnumerable<ITreasureCard> revealedTreasures)
 {
     var trashedCard = revealedTreasures.Single();
     trashedCard.MoveTo(context.Game.Trash);
     context.Game.Log.LogTrash(revealZone.Owner, trashedCard);
     revealZone.MoveAll(revealZone.Owner.Discards);
     return (Card) trashedCard;
 }
开发者ID:razzielx,项目名称:Dominion,代码行数:8,代码来源:Thief.cs


示例20: BeginResolve

 public virtual void BeginResolve(TurnContext currentTurn)
 {
     if (!_isResolved)
     {
         _isResolved = true;
         Resolve(currentTurn);
     }
 }
开发者ID:trentkerin,项目名称:Dominion,代码行数:8,代码来源:CardEffectBase.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Players.Player类代码示例发布时间:2022-05-24
下一篇:
C# Dominion.PlayerState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap