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

C# Dominion.GameState类代码示例

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

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



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

示例1: DoesHandHaveCombinationToTrash

            private static bool DoesHandHaveCombinationToTrash(GameState gameState)
            {
                int countToTrash = CountInHandFrom(TrashOrder(), gameState);
                int countInHand = gameState.Self.Hand.Count;

                return (countInHand - countToTrash <= 2);
            }
开发者ID:peterhal,项目名称:Dominulator,代码行数:7,代码来源:FishingVillageLibraryCountPoorHouse.cs


示例2: ShouldGainHermit

        private static bool ShouldGainHermit(GameState gameState)
        {
            if (PlayBigHermit(gameState))
                return CountHermitsEverGained(gameState) < 9 && CountAllOwned(Cards.MarketSquare, gameState) == 0;

            return CountHermitsEverGained(gameState) < 7 && CountAllOwned(Cards.MarketSquare, gameState) == 0;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:HermitMarketSquare.cs


示例3: ShouldPlayRebuild

 private static bool ShouldPlayRebuild(GameState gameState)
 {
     return !(gameState.players.CurrentPlayer.ExpectedCoinValueAtEndOfTurn >= 8 && CountOfPile(Cards.Province, gameState) == 1)
            && !(CountOfPile(Cards.Duchy, gameState) == 0
            && CountInDeckAndDiscard(Cards.Duchy, gameState) == 0 && PlayersPointLead(gameState) < 0)
            && CountOfPile(Cards.Province, gameState) > 0;
 }
开发者ID:peterhal,项目名称:Dominulator,代码行数:7,代码来源:RebuildAdvanced.cs


示例4: ShouldGainCopper

        private static bool ShouldGainCopper(GameState gameState, ICardPicker gainOrder)
        {
            PlayerState self = gameState.Self;

            int minValue = self.ExpectedCoinValueAtEndOfTurn;
            int maxValue = minValue + Strategy.CountInHand(Dominion.Cards.IllGottenGains, gameState);

            if (maxValue == minValue)
                return false;

            CardPredicate shouldGainCard = delegate(Card card)
            {
                int currentCardCost = card.CurrentCoinCost(self);

                return currentCardCost >= minValue &&
                        currentCardCost <= maxValue;
            };

            Card cardType = gainOrder.GetPreferredCard(gameState, shouldGainCard);
            if (cardType == null)
                return false;

            int coppersToGain = DefaultPlayerAction.CostOfCard(cardType, gameState) - minValue;

            return (coppersToGain > 0);
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:26,代码来源:IllGottenGains.cs


示例5: GameStatePredicate

        public bool GameStatePredicate(GameState gameState)
        {
            int countOfTheSource;

            switch (countSource)
            {
                case CountSource.Pile:
                    countOfTheSource = Strategies.CountOfPile(this.cardType, gameState);
                    break;
                case CountSource.AllOwned:
                    countOfTheSource = Strategies.CountAllOwned(this.cardType, gameState);
                    break;
                case CountSource.InHand:
                    countOfTheSource = Strategies.CountInHand(this.cardType, gameState);
                    break;
                case CountSource.None:
                    return true;
                default:
                    throw new Exception("Unhandled source case");
            }

            switch (this.comparison)
            {
                case Comparison.GreaterThan:
                    {
                        return countOfTheSource > this.countThreshHold;
                    }
                case Comparison.LessThan:
                    {
                        return countOfTheSource < this.countThreshHold;
                    }
                default:
                    throw new Exception("Unhandled comparison case");
            }
        }
开发者ID:peterhal,项目名称:Dominulator,代码行数:35,代码来源:MatchDescription.cs


示例6: GetPreferredCardReverse

        public Card GetPreferredCardReverse(GameState gameState, CardPredicate cardPredicate)
        {
            if (predicate(gameState))
                return this.picker.GetPreferredCardReverse(gameState, cardPredicate);

            return null;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:CardPickForCondition.cs


示例7: EndGame

 public override void EndGame(GameState gameState)
 {
     if (this.textWriter != null)
     {
         Write(this.textWriter, gameState.players.OriginalPlayerOrder);
     }
 }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:GainSequenceGameLog.cs


示例8: GetCardFromHandToReveal

        public override Card GetCardFromHandToReveal(GameState gameState, CardPredicate acceptableCard)
        {
            if (gameState.Self.Hand.HasCard(gameState.BaneCard))
                return gameState.BaneCard;

            return null;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:YoungWitch.cs


示例9: AmountWillingtoOverPayFor

        public int AmountWillingtoOverPayFor(Card card, GameState gameState)
        {
            if (predicate(gameState))
                return this.picker.AmountWillingtoOverPayFor(card, gameState);

            return 0;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:CardPickForCondition.cs


示例10: ShouldPutCardOnTopOfDeck

        public override bool ShouldPutCardOnTopOfDeck(Card card, GameState gameState)
        {
            if (this.playerAction.discardOrder.DoesCardPickerMatch(gameState, card))
                return false;

            return true;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:PearlDiver.cs


示例11: ShouldPlayTrader

        private static bool ShouldPlayTrader(GameState gameState)
        {
            if (gameState.Self.Hand.HasCard(Cards.Estate))
            {
                return !ShouldGainEstate(gameState);
            }

            if (gameState.Self.ExpectedCoinValueAtEndOfTurn >= 8)
                return false;
            /*
            if (gameState.Self.Actions.ShouldGainCard(gameState, Cards.Duchy) && gameState.Self.ExpectedCoinValueAtEndOfTurn >= 5)
                return false;
            */
            if (gameState.Self.ExpectedCoinValueAtEndOfTurn <= 4)
                return true;

            /*
            if (gameState.Self.Actions.ShouldGainCard(gameState, Cards.Province))
                return false;*/

            if (gameState.Self.ExpectedCoinValueAtEndOfTurn <= 3 && !gameState.Self.Hand.HasCard(Cards.Silver))
                return false;

            return true;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:25,代码来源:BigMoneyTrader.cs


示例12: ChooseBetween

            public override PlayerActionChoice ChooseBetween(GameState gameState, IsValidChoice acceptableChoice)
            {
                if (gameState.CurrentContext.CurrentCard == Cards.Governor)
                    return PlayerActionChoice.GainCard;

                return base.ChooseBetween(gameState, acceptableChoice);
            }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:GovernorJunkDealer.cs


示例13: ShouldTrashPotion

        private static bool ShouldTrashPotion(GameState gameState)
        {
            if (!gameState.Self.Actions.ShouldGainCard(gameState, Cards.ScryingPool))
                return true;

            return false;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:RatsScryingPoolVillagePoorHouseSeaHag.cs


示例14: DoSpecializedAction

        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(acceptableCard => true, gameState);
            PlayerState.AttackAction attackAction = this.DoEmptyAttack;

            if (revealedCard != null && !revealedCard.isShelter)
            {
                int maxReturnCount = Math.Max(currentPlayer.Hand.CountOf(revealedCard), 2);

                int returnCount = currentPlayer.actions.GetCountToReturnToSupply(revealedCard, gameState);
                returnCount = Math.Min(returnCount, maxReturnCount);
                returnCount = Math.Max(returnCount, 0);

                for (int i = 0; i < returnCount; ++i)
                {
                    if (currentPlayer.hand.HasCard(revealedCard))
                    {
                        currentPlayer.ReturnCardFromHandToSupply(revealedCard, gameState);
                    }
                }

                attackAction = delegate(PlayerState currentPlayer2, PlayerState otherPlayer, GameState gameState2)
                {
                    otherPlayer.GainCardFromSupply(gameState, revealedCard);
                };
            }

            currentPlayer.AttackOtherPlayers(gameState, attackAction);
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:29,代码来源:Seaside.cs


示例15: ShouldByLastCard

            private static bool ShouldByLastCard(Card card, GameState gameState)
            {
                if (CountOfPile(card, gameState) != 1)
                    return true;

                return CountOfPile(Cards.Province, gameState) == 1;
            }
开发者ID:peterhal,项目名称:Dominulator,代码行数:7,代码来源:GardensBeggarIronworks.cs


示例16: CountOfPileLessthanEqual

        private static bool CountOfPileLessthanEqual(Card cardType, GameState gameState, int count)
        {
            if (gameState.GetSupplyPile(cardType) == null)
                return true;

            return CountOfPile(cardType, gameState) <= count;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:MountebankHoard.cs


示例17: EndGame

        public void EndGame(GameState gameState)
        {
            this.textWriter.WriteLine("Game ended in {0} turns.", this.roundNumber);

            PlayerState[] winners = gameState.WinningPlayers;

            if (winners.Length == 1)
            {
                this.textWriter.WriteLine("{0} Won!", winners[0].actions.PlayerName);
            }
            else
            {
                this.textWriter.Write("There was a tie between: ");
                foreach (PlayerState player in winners)
                {
                    this.textWriter.Write("{0}, ", player.actions.PlayerName);
                }
                this.textWriter.WriteLine();
            }

            foreach (PlayerState player in gameState.players.AllPlayers)
            {
                this.textWriter.WriteLine("{0} total score: {1}", player.actions.PlayerName, player.TotalScore());
                this.PushScope();
                this.WriteAllCards(player);
                this.PopScope();
            }

            this.textWriter.Write("Trash contains: ");
            this.WriteAllCards(gameState.trash);

            this.textWriter.WriteLine();
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:33,代码来源:DebugGameLog.cs


示例18: DoesHandHaveCombinationToTrash

        private static bool DoesHandHaveCombinationToTrash(DefaultPlayerAction playerAction, GameState gameState)
        {
            int countToTrash = Strategy.CountInHandFrom(playerAction.trashOrder, gameState);
            int countInHand = gameState.Self.Hand.Count;

            return (countInHand - countToTrash <= 2);
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:Count.cs


示例19: HasChainingDeck

 private static bool HasChainingDeck(GameState gameState)
 {
     return CountAllOwned(Cards.Chapel, gameState) +
            CountAllOwned(Cards.IronWorks, gameState) +
            CountAllOwned(Cards.Copper, gameState) +
            CountAllOwned(Cards.Estate, gameState) <= 4;
 }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:ChapelCanTripKingsCourtMasquerade.cs


示例20: DoSpecializedAction

        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(acceptableCard => true, gameState);
            if (revealedCard == null)
            {
                return;
            }

            currentPlayer.MoveRevealedCardToHand(revealedCard);

            int maxReturnCount = 1;
            if (currentPlayer.Hand.CountWhere(card => card.Equals(revealedCard)) > 1)
            {
                maxReturnCount++;
            }

            int returnCount = currentPlayer.actions.GetCountToReturnToSupply(revealedCard, gameState);
            returnCount = Math.Min(returnCount, maxReturnCount);
            returnCount = Math.Max(returnCount, 0);

            for (int i = 0; i < returnCount; ++i)
            {
                currentPlayer.ReturnCardFromHandToSupply(revealedCard, gameState);
            }

            foreach (PlayerState otherPlayer in gameState.players.OtherPlayers)
            {
                if (!otherPlayer.IsAffectedByAttacks(gameState))
                {
                    otherPlayer.GainCardFromSupply(gameState, revealedCard);
                }
            }
        }
开发者ID:peterhal,项目名称:Dominulator,代码行数:33,代码来源:Seaside.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Dominion.PlayerState类代码示例发布时间:2022-05-24
下一篇:
C# Dominion.Card类代码示例发布时间: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