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


C# Card.CardToMimick方法代码示例

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


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

示例1: DoPlayAction

        internal void DoPlayAction(Card currentCard, GameState gameState, int countTimes = 1)
        {
            if (!currentCard.isAction)
            {
                throw new Exception("Can't play a card that isn't a action");
            }

            this.cardsBeingPlayed.AddCardToTop(currentCard);

            Card cardToPlayAs = currentCard.CardToMimick(this, gameState);
            gameState.cardContextStack.PushCardContext(this, cardToPlayAs, CardContextReason.CardBeingPlayed);

            if (cardToPlayAs != null)
            {
                for (int i = 0; i < countTimes; ++i)
                {
                    this.gameLog.PlayedCard(this, currentCard);
                    this.gameLog.PushScope();

                    this.AddActions(cardToPlayAs.plusAction);
                    this.AddBuys(cardToPlayAs.plusBuy);
                    this.AddCoins(cardToPlayAs.plusCoin);
                    this.AddVictoryTokens(cardToPlayAs.plusVictoryToken);
                    this.DrawAdditionalCardsIntoHand(cardToPlayAs.plusCard, gameState);

                    if (cardToPlayAs.isAttack && cardToPlayAs.isAttackBeforeAction)
                    {
                        AttackOtherPlayers(gameState, cardToPlayAs.DoSpecializedAttack);
                    }

                    cardToPlayAs.DoSpecializedAction(gameState.players.CurrentPlayer, gameState);

                    if (cardToPlayAs.isAttack && !cardToPlayAs.attackDependsOnPlayerChoice && !cardToPlayAs.isAttackBeforeAction)
                    {
                        AttackOtherPlayers(gameState, cardToPlayAs.DoSpecializedAttack);
                    }

                    if (this.ownsCardWithSpecializedActionToCardWhileInPlay)
                    {
                        foreach(var cardInPlay in this.cardsInPlay)
                        {
                            if (cardInPlay.HasSpecializedActionToCardWhileInPlay)
                            {
                                gameState.cardContextStack.PushCardContext(this, cardInPlay, CardContextReason.CardReacting);
                                cardInPlay.DoSpecializedActionToCardWhileInPlay(this, gameState, cardToPlayAs);
                                gameState.cardContextStack.Pop();
                            }
                        }
                    }

                    this.gameLog.PopScope();
                }
            }

            gameState.cardContextStack.Pop();
            CardHasBeenPlayed(cardToPlayAs, countTimes);
        }
开发者ID:NathanTeeuwen,项目名称:Dominulator,代码行数:57,代码来源:PlayerState.cs


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