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


C# IGame.AddEffect方法代码示例

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


在下文中一共展示了IGame.AddEffect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Trigger

        public override void Trigger(IGame game, IEffectHandle handle)
        {
            var defeatedEnemies = new List<IEnemyInPlay>();

            foreach (var enemy in game.StagingArea.CardsInStagingArea.OfType<IEnemyInPlay>())
            {
                if (enemy.Damage >= enemy.Card.PrintedHitPoints)
                {
                    defeatedEnemies.Add(enemy);
                }
            }

            foreach (var player in game.Players)
            {
                foreach (var enemy in player.EngagedEnemies)
                {
                    if (enemy.Damage >= enemy.Card.PrintedHitPoints)
                    {
                        defeatedEnemies.Add(enemy);
                    }
                }
            }

            foreach (var enemy in defeatedEnemies)
            {
                var defeatedEffect = new EnemyDefeatedEffect(game, enemy, attackers);
                var defeatedHandle = defeatedEffect.GetHandle(game);
                game.AddEffect(defeatedEffect);
                game.TriggerEffect(defeatedHandle);
            }

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

示例3: Travel

        public virtual void Travel(IGame game)
        {
            if (game.QuestArea.ActiveLocation != null)
                return;

            game.AddEffect(this);
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:TravelEffectBase.cs

示例4: PutAllyIntoPlayFromYourHand

            private void PutAllyIntoPlayFromYourHand(IGame game, IEffectHandle handle, IPlayer player, IAllyCard allyCard)
            {
                player.Hand.RemoveCards(new List<IPlayerCard> { allyCard });
                player.AddCardInPlay(new AllyInPlay(game, allyCard));
                game.AddEffect(new AtEndOfPhaseReturnAllyToYourHand(CardSource, allyCard.Id));

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

示例5: AfterCostPaid

            protected override void AfterCostPaid(IGame game, IEffectHandle handle, IEnumerable<Tuple<ICharacterInPlay, byte>> charactersAndPayments)
            {
                var allyCard = source as IAllyCard;
                var allyInPlay = new AllyInPlay(game, allyCard);
                player.AddCardInPlay(allyInPlay);
                player.Hand.RemoveCards(new List<IPlayerCard> { allyCard });

                game.AddEffect(new ReturnToHandAfterSuccessfulQuest(cardSource));
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:9,代码来源:Bofur_Dw.cs

示例6: AfterCostPaid

        protected override void AfterCostPaid(IGame game, IEffectHandle handle, IEnumerable<Tuple<ICharacterInPlay, byte>> charactersAndPayments)
        {
            var eventEffect = eventCard.Text.Effects.First();
            var eventHandle = eventEffect.GetHandle(game);

            player.Hand.RemoveCards(new List<IPlayerCard> { eventCard });

            game.AddEffect(eventEffect);
            game.TriggerEffect(eventHandle);
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:10,代码来源:PlayEventEffect.cs

示例7: Trigger

            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault();
                if (enemyAttack == null)
                    { handle.Cancel(GetCancelledString()); return; }

                var bonus = enemyAttack.IsUndefended ? 3 : 1;

                game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemyAttack.Enemy, TimeScope.None, bonus));

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

示例8: AfterCommittingToQuest

            public void AfterCommittingToQuest(IGame game)
            {
                var questPhase = game.CurrentPhase as IQuestPhase;
                if (questPhase == null)
                    return;

                var self = questPhase.GetAllCharactersCommittedToQuest().Where(x => x.Card.Id == source.Id).FirstOrDefault();
                if (self == null)
                    return;

                game.AddEffect(this);
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:12,代码来源:Aragorn_Core.cs

示例9: Trigger

            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var enemy = game.GetCardInPlay<IEnemyInPlay>(source.Id);
                if (enemy == null || enemy.Resources == 0)
                    { handle.Cancel(GetCancelledString()); return; }

                var bonus = enemy.Resources * 2;

                game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemy, TimeScope.None, bonus));

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

示例10: Trigger

            public override void Trigger(IGame game, IEffectHandle handle)
            {
                foreach (var player in game.Players)
                {
                    //TODO: Check for IDuringDrawingCards effects here

                    var drawEffect = new DrawingCardsEffect(game, player, 1);
                    var drawHandle = drawEffect.GetHandle(game);
                    game.AddEffect(drawEffect);
                    game.TriggerEffect(drawHandle);
                }

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

示例11: BeforeChoosingEnemyToAttack

            public void BeforeChoosingEnemyToAttack(IGame game)
            {
                var combatPhase = game.CurrentPhase as ICombatPhase;
                if (combatPhase == null)
                    return;

                var chooseEnemy = game.CurrentPhase.GetEnemiesChosenToAttack().Where(x => x.Attackers.Any(y => y.Card.Id == source.Id)).FirstOrDefault();
                if (chooseEnemy == null)
                    return;

                if (chooseEnemy.Attackers.Count() != 1)
                    return;

                game.AddEffect(this);
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:15,代码来源:Dunhere.cs

示例12: Trigger

            public override void Trigger(IGame game, IEffectHandle handle)
            {
                if (game.StagingArea.CardsInStagingArea.Count() == 0)
                {
                    game.StagingArea.RevealEncounterCard();
                    {
                        handle.Cancel(GetCancelledString());
                        return;
                    }
                }

                foreach (var threatening in game.StagingArea.CardsInStagingArea.OfType<IThreateningInPlay>())
                {
                    game.AddEffect(new ThreatModifier(game.CurrentPhase.Code, source, threatening, TimeScope.Phase, 1));
                }

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

示例13: Trigger

            public override void Trigger(IGame game, IEffectHandle handle)
            {
                IEnemyInPlay enemy = null;

                foreach (var player in game.Players)
                {
                    enemy = player.EngagedEnemies.Where(x => x.Card.Id == source.Id).FirstOrDefault();
                    if (enemy != null)
                        break;
                }

                if (enemy == null)
                    { handle.Cancel(GetCancelledString()); return; }

                game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemy, TimeScope.Round, 1));

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

示例14: DuringEncounterCardRevealed

            public void DuringEncounterCardRevealed(IGame game)
            {
                var questPhase = game.CurrentPhase as IQuestPhase;
                if (questPhase == null)
                    return;

                var revealed = game.StagingArea.RevealedEncounterCard;
                if (revealed == null)
                    return;

                if (!(revealed is IEnemyInPlay))
                    return;

                if (!questPhase.IsCommittedToQuest(source.Id))
                    return;

                game.AddEffect(this);
            }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:18,代码来源:Thalin.cs

示例15: Trigger

        public override void Trigger(IGame game, IEffectHandle handle)
        {
            var defeatedState = new EnemyDefeated(game, enemy, attackers);

            foreach (var card in game.GetCardsInPlayWithEffect<ICardInPlay, IBeforeEnemyDefeated>())
            {
                foreach (var effect in card.BaseCard.Text.Effects.OfType<IBeforeEnemyDefeated>())
                {
                    effect.BeforeEnemyDefeated(defeatedState);
                }
            }

            foreach (var card in game.GetCardsInPlayWithEffect<ICardInPlay, IDuringEnemyDefeated>())
            {
                foreach (var effect in card.BaseCard.Text.Effects.OfType<IDuringEnemyDefeated>())
                {
                    effect.DuringEnemyDefeated(defeatedState);
                }
            }

            if (!defeatedState.IsEnemyDefeated)
                { handle.Cancel(GetCancelledString()); return; }

            foreach (var card in game.GetCardsInPlayWithEffect<ICardInPlay, IAfterEnemyDefeated>())
            {
                foreach (var effect in card.BaseCard.Text.Effects.OfType<IAfterEnemyDefeated>())
                {
                    effect.AfterEnemyDefeated(defeatedState);
                }
            }

            var leavingPlayEffect = new CardLeavesPlayEffect(game, enemy);
            game.AddEffect(leavingPlayEffect);
            var leavingPlayHandle = leavingPlayEffect.GetHandle(game);
            game.TriggerEffect(leavingPlayHandle);

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


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