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


C# GameState.GetPile方法代码示例

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


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

示例1: PreferMoneyOverDuchy

        private static bool PreferMoneyOverDuchy(DefaultPlayerAction playerAction, GameState gameState)
        {
            if (!gameState.GetPile(Dominion.Cards.Duchy).Any)
                return true;

            int minCoin = gameState.Self.ExpectedCoinValueAtEndOfTurn;
            int maxCoin = minCoin + 3;

            Card mostExpensiveCard = playerAction.purchaseOrder.GetPreferredCard(gameState, card => card.CurrentCoinCost(gameState.Self) > minCoin && card.CurrentCoinCost(gameState.Self) <= maxCoin);
            Card thatOrDuchy = playerAction.purchaseOrder.GetPreferredCard(gameState, card => card == Dominion.Cards.Duchy || card == mostExpensiveCard);

            if (mostExpensiveCard != null && thatOrDuchy != Dominion.Cards.Duchy)
                return true;

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

示例2: EndGame

            public override void EndGame(GameState gameState)
            {
                lock (this.factory.theLock)
                {
                    if (gameState.GetPile(Cards.Curse).Any)
                        return;

                    int player1Count = CountCurses(gameState, 0);
                    int player2Count = CountCurses(gameState, 1);

                    if (player1Count > player2Count)
                        this.factory.player1Win++;

                    if (player2Count > player1Count)
                        this.factory.player2Win++;

                    this.factory.totalGameCount++;
                }

                if (gameState.WinningPlayers.Count() > 1)
                {
                    int playerIndex = gameState.WinningPlayers[0].PlayerIndex;
                    //winningPlayerWas25++;
                }
            }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:25,代码来源:UnevenCurseSplit.cs

示例3: ReturnCardToSupply

        internal void ReturnCardToSupply(Card cardToReturn, GameState gameState)
        {
            this.gameLog.PlayerReturnedCardToPile(this, cardToReturn);
            PileOfCards pile = gameState.GetPile(cardToReturn);
            if (pile == null)
                throw new Exception("Could not find supply pile");

            pile.AddCardToTop(cardToReturn);
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:9,代码来源:PlayerState.cs

示例4: RequestPlayerEmbargoPileFromSupply

        internal PileOfCards RequestPlayerEmbargoPileFromSupply(GameState gameState)
        {
            Card cardType = this.actions.GetCardFromSupplyToEmbargo(gameState);

            PileOfCards pile = gameState.GetPile(cardType);
            if (pile == null)
            {
                throw new Exception("Must choose pile from supply");
            }

            return pile;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:12,代码来源:PlayerState.cs

示例5: RequestPlayerDiscardCardFromHand

        internal bool RequestPlayerDiscardCardFromHand(GameState gameState, CardPredicate acceptableCardsToDiscard, bool isOptional)
        {
            if (!this.hand.HasCard(acceptableCardsToDiscard))
            {
                return false;
            }

            Card cardTypeToDiscard = this.actions.GetCardFromHandToDiscard(gameState, acceptableCardsToDiscard, isOptional);
            if (cardTypeToDiscard == null)
            {
                if (isOptional)
                {
                    return false;
                }
                else
                {
                    throw new Exception("Player must choose a card to discard");
                }
            }
            else
            {
                if (gameState.GetPile(cardTypeToDiscard) != null &&  // TODO: this currently can not find ruins ... rework this method so a card is returned instead of a type.
                    !acceptableCardsToDiscard( cardTypeToDiscard))
                    throw new Exception("Card does not meet constraint: ");
            }

            this.MoveCardFromHandToDiscard(cardTypeToDiscard, gameState);

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

示例6: CountOfPile

        public static int CountOfPile(Card cardType, GameState gameState)
        {
            if (!gameState.CardGameSubset.HasCard(cardType))
                return 0;

            return gameState.GetPile(cardType).Count;
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:7,代码来源:Strategy.cs

示例7: MoveCardFromPlayToPile

        internal bool MoveCardFromPlayToPile(GameState gameState)
        {
            bool wasReturned = false;
            Card cardInPlay = this.cardsBeingPlayed.DrawCardFromTop();
            if (cardInPlay != null)
            {
                PileOfCards pile = gameState.GetPile(cardInPlay);
                pile.AddCardToTop(cardInPlay);
                wasReturned = true;
                this.gameLog.PlayerReturnedCardToPile(this, cardInPlay);
            }

            this.cardsBeingPlayed.AddCardToTop(null);
            return wasReturned;
        }
开发者ID:peterhal,项目名称:Dominulator,代码行数:15,代码来源:PlayerState.cs

示例8: CountOfPile

 public static int CountOfPile(Card cardType, GameState gameState)
 {
     return gameState.GetPile(cardType).Count;
 }
开发者ID:peterhal,项目名称:Dominulator,代码行数:4,代码来源:Strategies.cs


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