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


C# Card.AddEventHandler方法代码示例

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


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

示例1: Modify

        protected override void Modify(Card card)
        {
            card.Text = "You cannot rest or prepare."
                   + "<br/><br/>"
                   + "<b>Trophy:</b> Attack -1"
                   + "<br/><br/>" + "<b>Village/Dungeon:</b> Select 2 random cards from your hand <i>(excluding this card).</i>  "
                   + "You may destroy 1 of them to destroy this card.";

            card.AddEventHandler(
                events => events.Subscribe<CardDrawnToHand>(
                    ev =>
                        {
                            if (ev.Card == card)
                                card.Player.ValidActions = card.Player.ValidActions.Except(new[] {PlayerAction.Prepare, PlayerAction.Rest});
                        }));

            card.CreateAbility()
                .Description("Select 2 random cards from your hand. You may destroy 1 of them to destroy this card.")
                .SelectCards(x => x.Select().FromRandomHandSelection(2, c => c != card)
                                           .Caption("Curse of War").Message("Destroy 1 card."))
                .OnCardsSelected(x =>
                    {
                        x.Player.DestroyCard(x.Selected.First(), card.Name);
                        x.Player.DestroyCard(card, card.Name);
                    })
                .Condition(p => p.Hand.Count >= 3)
                .On(Phase.Village, Phase.Dungeon);
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:28,代码来源:CurseOfWar.cs

示例2: Modify

        protected override void Modify(Card card)
        {
            card.CreateAbility()
                .DestroyCard("Destroy a hero.", c => c.IsHero())
                .On(Phase.Battle);

            card.AddEventHandler(events => events.Subscribe<DungeonHallRefilled>(e => KeepStramstFromAdvancing(card, e)));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:8,代码来源:Stramst.cs

示例3: Modify

        protected override void Modify(Card card)
        {
            base.Modify(card);
            card.PotentialPhysicalAttack = () => 2;

            card.CreateAbility()
                .EquipWeapon(Attr.PhysicalAttack, 2)
                .On(Phase.Equip);

            card.AddEventHandler(
                events =>
                events.Subscribe<SelectingCards>(
                    message =>
                        {
                            if (message.TriggeringAbility != null && message.TriggeringAbility.Phase == Phase.Battle && card.IsEquipped)
                                message.Selection.Remove(card.GetEquipped().First());
                        }));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:18,代码来源:Pike.cs

示例4: Modify

        protected override void Modify(Card card)
        {
            base.Modify(card);

            card.PotentialPhysicalAttack = () => 5;

            card.CreateAbility()
                .EquipWeapon((player, hero) =>
                                 {
                                     hero.AddModifier(new SetMod(card, Attr.PhysicalAttack, 0));
                                     hero.AddModifier(new SetMod(card, Attr.MagicalAttack, 0));
                                 }).On(Phase.Equip);

            card.AddEventHandler(events => events.Subscribe<AttackRankSelected>(e =>
                                                              {
                                                                  if (e.AttackedRank.Number >= 2 && card.IsEquipped)
                                                                      card.GetEquipped().First().AddModifier(new PlusMod(card, Attr.PhysicalAttack, 5));
                                                              }));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:19,代码来源:FalconArbalest.cs

示例5: Modify

        protected override void Modify(Card card)
        {
            card.CreateAbility()
                .Description("If this is the first ability you use this turn, destroy this card. You cannot use any more abilities this turn.")
                .Action(x =>
                {
                    x.Player.DestroyCard(card, card.Name);
                    x.Player.ActiveAbilities.RemoveAll(a => a.Card.Owner == CardOwner.Player);
                })
                .On(Phase.Village, Phase.Dungeon);

            // Add event handler that removes this card's abilities when player uses another card's ability (except equipping)
            card.AddEventHandler(events => events.Subscribe<CardAbilityUsed>(e =>
            {
                var usedCard = e.Ability.Card;
                if (e.Ability.Phase != Phase.Equip && usedCard.Owner == CardOwner.Player && usedCard != card)
                    usedCard.Player.ActiveAbilities.RemoveAll(x => x.Card == card);
            }));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:19,代码来源:CurseOfDecay.cs


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