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


C# IGame.GetController方法代码示例

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


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

示例1: PlayerDiscardsOneCard

            private void PlayerDiscardsOneCard(IGame game, IEffectHandle handle, IPlayer player, IPlayerCard card)
            {
                if (player.Hand.Cards.Count() == 0)
                {
                    handle.Cancel(string.Format("{0} does not have any cards in their hand to discard", player.Name));
                    return;
                }

                player.DiscardFromHand(new List<IPlayerCard> { card });

                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                {
                    handle.Cancel(string.Format("Could not determine the controller of {0}", CardSource.Title));
                    return;
                }

                var willpowerful = controller.CardsInPlay.OfType<IWillpowerfulInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault();
                if (willpowerful == null)
                {
                    handle.Cancel(string.Format("'{0}' is no longer in play", CardSource.Title));
                    return;
                }

                game.AddEffect(new WillpowerModifier(game.CurrentPhase.Code, source, willpowerful, TimeScope.Phase, 1));

                handle.Resolve(string.Format("{0} discarded a card to give '{0}' +1 Willpower until the end of the phase", player.Name, CardSource.Title));
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:28,代码来源:Eowyn.cs

示例2: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                    return base.GetHandle(game);

                var exhaustable = controller.CardsInPlay.OfType<IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault();
                if (exhaustable == null)
                    return base.GetHandle(game);

                var encounterCard = game.StagingArea.EncounterDeck.GetFromTop(1).FirstOrDefault();
                if (encounterCard == null)
                    return base.GetHandle(game);

                var builder =
                    new ChoiceBuilder(string.Format("Exhaust {0} to look at the top of the encounter deck. You may move that card to the bottom of the deck", CardSource.Title), game, controller)
                        .Question(string.Format("{0}, do you want to exhaust '{1}' to look at the top card of the encounter deck?", controller.Name))
                            .Answer(string.Format("Yes, I want to exhaust '{0}' to look at the top card of the encounter deck", CardSource.Title), true)
                                .Question(string.Format("{0}, do you want to put '{1}' on the bottom of the encounter deck?", controller.Name, encounterCard.Title))
                                    .Answer(string.Format("Yes, put '{0}' on the bottom of the encounter deck", encounterCard.Title), encounterCard, (source, handle, card) => PutEncounterCardOnBottomOfDeck(game, handle, controller, exhaustable, card))
                                    .LastAnswer(string.Format("No, put '{0}' back on the top of the encounter deck", encounterCard.Title), encounterCard, (source, handle, card) => PutEncounterCardBackOnTopOfDeck(game, handle, controller, exhaustable, card))
                            .LastAnswer(string.Format("No, I do not want to exhaust '{0}' to look at the top card of the encounter deck", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to exhaust '{1}' to look at the top card of the encounter deck", controller.Name, CardSource.Title)));

                return new EffectHandle(this, builder.ToChoice());
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:25,代码来源:Denethor.cs

示例3: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                if (game.StagingArea.RevealedEncounterCard == null)
                {
                    return base.GetHandle(game);
                }

                if (!(game.StagingArea.RevealedEncounterCard.Card is ITreacheryCard) || !game.StagingArea.RevealedEncounterCard.Card.HasEffect<IWhenRevealedEffect>())
                {
                    return base.GetHandle(game);
                }

                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                    return base.GetHandle(game);

                var exhaustable = controller.CardsInPlay.OfType<IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault();
                if (exhaustable == null || exhaustable.IsExhausted)
                    return base.GetHandle(game);

                var builder =
                    new ChoiceBuilder(string.Format("Exhaust '{0}' to cancel the when revealed effects of a treachery just revealed by the encounter deck", CardSource.Title), game, controller)
                        .Question(string.Format("{0}, do you want to exhaust '{1}' to cancel the revealed treachery?", controller.Name, CardSource.Title))
                            .Answer(string.Format("Yes, exhaust '{0}' to cancel the revealed treachery", CardSource.Title), exhaustable, (source, handle, item) => ExhaustToCancelRevealedTreachery(source, handle, exhaustable));

                return new EffectHandle(this, builder.ToChoice());
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:27,代码来源:Eleanor.cs

示例4: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var limit = new Limit(PlayerScope.Controller, TimeScope.Round, 1);

                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                    return base.GetHandle(game);

                var exhaustable = controller.CardsInPlay.OfType<IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault();
                if (exhaustable == null || exhaustable.IsExhausted)
                    return base.GetHandle(game);

                var builder =
                    new ChoiceBuilder(string.Format("Exhaust '{0}' to have a plyer draw 2 cards", CardSource.Title), game, controller);
                
                if (game.Players.Count() == 1)
                {
                    builder.Question(string.Format("You are the only player, exhaust '{0}' to draw 2 cards?", CardSource.Title))
                        .Answer(string.Format("Yes, I want to exhaust '{0}' to draw 2 cards", CardSource.Title), controller, (source, handle, player) => ExhaustAndPlayerDrawsTwoCards(source, handle, controller, exhaustable, player))
                        .LastAnswer("No, I do not want to exhaust '{0}' to draw 2 cards", false, (source, handle, item) => CancelEffect(source, handle, controller));
                }
                else
                {
                    builder.Question(string.Format("{0}, do you want to exhaust '{1}' to have a player draw 2 cards?", controller.Name))
                        .Answer(string.Format("Yes, I will exhaust '{0}' to have a player draw 2 cards", CardSource.Title), true)
                            .Question("Which player should draw 2 cards?")
                                .LastAnswers(game.Players.ToList(), item => item.Name, (source, handle, player) => ExhaustAndPlayerDrawsTwoCards(game, handle, controller, exhaustable, player))
                        .LastAnswer(string.Format("No, I do not want to exhaust '{0}' to have a player draw 2 cards", CardSource.Title), false, (source, handle, item) => CancelEffect(source, handle, controller));
                        
                }

                var choice = builder.ToChoice();

                return new EffectHandle(this, choice, limit);
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:35,代码来源:Beravor.cs

示例5: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                    throw new InvalidOperationException("Could not determine the controll of Gandalf after he entered play");

                var enemies = GetEnemiesInPlay(game);

                var builder =
                    new ChoiceBuilder(string.Format("Choose which effect you want to trigger on '{0}' after he enters play", CardSource.Title), game, controller)
                        .Question(string.Format("{0}, which effect do you want to trigger on '{1}'?", controller.Name, CardSource.Title))
                            .Answer("Draw 3 cards", 1, (source, handle, item) => DrawThreeCards(game, handle, controller));

                if (enemies.Count() > 0)
                {
                    builder.Answer("Deal 4 damage to 1 enemy in play", 2)
                        .Question("Which enemy do you want to deal 4 damage to?")
                            .LastAnswers(enemies, (item) => string.Format("'{0}' ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, enemy) => DealFourDamageToEnemyInPlay(game, handle, controller, enemy));

                }

                builder.LastAnswer("Reduce your threat by 5", 3, (source, handle, item) => ReduceYourThreatByFive(game, handle, controller));

                var choice = builder.ToChoice();

                return new EffectHandle(this, choice);
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:27,代码来源:Gandalf_Core.cs

示例6: ReadyExhaustedAlly

            private void ReadyExhaustedAlly(IGame game, IEffectHandle handle, IPlayer player, IExhaustableInPlay ally)
            {
                var controller = game.GetController(ally.BaseCard.Id);

                ally.Ready();

                if (player == controller)
                {
                    handle.Resolve(string.Format("{0} chose to ready '{1}'", player.Name, ally.Title));
                }
                else
                {
                    handle.Resolve(string.Format("{0} chose to ready '{1}' controlled by {2}", player.Name, ally.Title, controller.Name));
                }
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:15,代码来源:EverVigilant.cs

示例7: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                    return base.GetHandle(game);

                var resourceful = game.GetCardInPlay<ICharacterInPlay>(CardSource.Id);
                if (resourceful == null || resourceful.Resources == 0)
                    return base.GetHandle(game);

                var creatures = game.GetAllCardsInPlay<ICharacterInPlay>().Where(x => x.HasTrait(Trait.Creature) && x.Damage > 0).ToList();
                if (creatures.Count == 0)
                    return base.GetHandle(game);

                var builder =
                    new ChoiceBuilder("Choose a Creature in play", game, controller);

                if (resourceful.Resources == 1)
                {
                    builder.Question(string.Format("'{0}' only has 1 resource available do you want to pay that one resource to heal a creature?", CardSource.Title))
                        .Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true)
                            .Question("Which Creature do you want to heal?")
                                .LastAnswers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1));
                }
                else
                {
                    builder.Question("Which Creature do you want to heal?");

                    foreach (var creature in creatures)
                    {
                        //.Answers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1));

                    //builder.Question(string.Format("How many resources do you want to pay from '{0}' to heal a creature?", CardSource.Title))
                        //.Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true)
                    }
                            
                }

                builder.LastAnswer(string.Format("No, I do not want to pay any resources from '{0}' to heal a creature", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to have '{1}' pay any resources to heal a creature", controller.Name, CardSource.Title)));

                        

                
                return new EffectHandle(this, builder.ToChoice());
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:45,代码来源:Radagast.cs

示例8: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var character = game.GetCardInPlay<ICharacterInPlay>(CardSource.Id);
                if (character == null || character.Resources == 0)
                    return base.GetHandle(game);

                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                    return base.GetHandle(game);

                var builder =
                    new ChoiceBuilder(string.Format("Pay 1 resource from his resource pool to ready '{0}' after commiting him to the quest", CardSource.Title), game, controller)
                        .Question(string.Format("{0}, do you want to pay 1 resource from his resource pool to ready '{0}'?", CardSource.Title))
                            .Answer("Yes, I want to ready him", controller, (source, handle, item) => PayOneResourceToReadyAragorn(source, handle, item))
                            .LastAnswer("No, I do not want to ready him", false, (source, handle, item) => handle.Cancel(string.Format("", controller.Name)));

                return new EffectHandle(this, builder.ToChoice());
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:18,代码来源:Aragorn_Core.cs

示例9: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var card = source as IPlayerCard;
                if (card == null)
                    throw new InvalidOperationException();

                var player = card.Owner;
                if (player == null)
                    throw new InvalidOperationException();

                var allies = GetExhausedAlliesInPlay(game);
                if (allies.Count() == 0)
                    return new EffectHandle(this);

                var builder =
                    new ChoiceBuilder("Choose an ally to ready", game, player)
                        .Question("Which exhausted ally will you ready?")
                            .LastAnswers(allies, item => string.Format("'{0}' controlled by {1}", item.Title, game.GetController(item.BaseCard.Id).Name), (src, handle, ally) => ReadyExhaustedAlly(src, handle, player, ally));

                return new EffectHandle(this, builder.ToChoice());
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:21,代码来源:EverVigilant.cs

示例10: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var limit = new Limit(PlayerScope.None, TimeScope.Round, 1);

                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                    return base.GetHandle(game);

                var resourceful = controller.CardsInPlay.OfType<ICharacterInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault();
                if (resourceful == null || resourceful.Resources == 0)
                    return base.GetHandle(game);

                var characters = game.GetAllCardsInPlay<ICharacterInPlay>().Where(x => x.Damage > 0).ToList();
                if (characters.Count == 0)
                    return base.GetHandle(game);

                var builder =
                    new ChoiceBuilder("Choose a wounded character in play to heal", game, controller)
                        .Question("Which character do you want to heal 1 damage on?")
                            .Answers(characters, item => string.Format("{0} ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, character) => HealOneDamageOnCharacter(game, handle, controller, resourceful, character))
                            .LastAnswer(string.Format("No, I do not want to pay 1 resource from '{0}' to heal a character", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to pay 1 resource from '{1}' to heal a character", controller.Name, CardSource.Title)));
                
                return new EffectHandle(this, builder.ToChoice(), limit);
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:24,代码来源:Glorfindel_Core.cs

示例11: Trigger

            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var allyInPlay = game.GetCardInPlay<IAllyInPlay>(allyId);
                if (allyInPlay == null)
                    { handle.Cancel(GetCancelledString()); return; }

                var allyController = game.GetController(allyId);
                if (allyController == null)
                    { handle.Cancel(GetCancelledString()); return; }

                allyController.RemoveCardInPlay(allyInPlay);

                var eventController = game.GetController(CardSource.Id);
                if (eventController == null)
                    { handle.Cancel(GetCancelledString()); return; }

                eventController.Hand.AddCards(new List<IPlayerCard> { allyInPlay.Card });

                handle.Resolve(GetCompletedStatus());
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:20,代码来源:SneakAttack.cs

示例12: GetHandle

            public override IEffectHandle GetHandle(IGame game)
            {
                var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.ShadowCards.Any(y => y.Card.Id == CardSource.Id)).FirstOrDefault();
                if (enemyAttack == null)
                    return base.GetHandle(game);

                var player = enemyAttack.DefendingPlayer;

                if (enemyAttack.IsUndefended)
                {
                    var undefendedChoiceBuilder =
                        new ChoiceBuilder("Defending player must discard all attachments they control", game, player)
                            .Question(string.Format("{0} must discard all attachments they control", player))
                                .Answer("Yes", player, (source, handle, item) => DiscardAllAttachmentsControlledByDefendingPlayer(source, handle, item));

                    return new EffectHandle(this, undefendedChoiceBuilder.ToChoice());
                }

                var builder =
                    new ChoiceBuilder("Choose and discard 1 attachment from defending character", game, player)
                        .Question("Which defending character must discard an attachment?");

                var attachedDefenders = 0;
                foreach (var defender in enemyAttack.Defenders.OfType<IAttachmentHostInPlay>())
                {
                    var controller = game.GetController(defender.Card.Id);
                    if (controller == null)
                        continue;

                    var attachments = defender.Attachments.OfType<IAttachableInPlay>().Where(x => (x.Card is IObjectiveCard || x.Card is IPlayerCard) && (x.AttachedTo != null)).ToList();

                    if (attachments.Count == 0)
                        continue;

                    attachedDefenders++;

                    builder.Answer(string.Format("{0} (controlled by {1}", defender.Title, controller.Name), defender)
                        .Question(string.Format("Which attachment will be discarded from '{0}'?", defender.Title))
                            .Answers(attachments, item => item.Title, (source, handle, attachment) => DiscardOneAttachmentFromDefendingCharacter(game, handle, player, attachment));
                }

                if (attachedDefenders == 0)
                    return base.GetHandle(game);

                return new EffectHandle(this, builder.ToChoice());
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:46,代码来源:DrivenByShadow.cs


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