Example #1
0
 public FangQuan()
 {
     var trigger = new AutoNotifyPassiveSkillTrigger(
         this,
         (p, e, a) =>
         {
             return !Game.CurrentGame.PhasesSkipped.Contains(TurnPhase.Play);
         },
         (p, e, a) =>
         {
             p[FangQuanUsed] = 1;
             Game.CurrentGame.PhasesSkipped.Add(TurnPhase.Play);
         },
         TriggerCondition.OwnerIsSource
     );
     var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         (p, e, a) => { return p[FangQuanUsed] == 1; },
         (p, e, a, cards, players) =>
         {
             Game.CurrentGame.HandleCardDiscard(a.Source, cards);
             Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, new FangQuanTrigger(Owner, players[0]));
         },
         TriggerCondition.OwnerIsSource,
         new FangQuanVerifier()
     ) { AskForConfirmation = false };
     Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Draw], trigger);
     Triggers.Add(GameEvent.PhaseProceedEvents[TurnPhase.End], trigger2);
 }
Example #2
0
        public FangQuan()
        {
            var trigger = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) =>
            {
                return(!Game.CurrentGame.PhasesSkipped.Contains(TurnPhase.Play));
            },
                (p, e, a) =>
            {
                p[FangQuanUsed] = 1;
                Game.CurrentGame.PhasesSkipped.Add(TurnPhase.Play);
            },
                TriggerCondition.OwnerIsSource
                );
            var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p[FangQuanUsed] == 1); },
                (p, e, a, cards, players) =>
            {
                Game.CurrentGame.HandleCardDiscard(a.Source, cards);
                Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, new FangQuanTrigger(Owner, players[0]));
            },
                TriggerCondition.OwnerIsSource,
                new FangQuanVerifier()
                )
            {
                AskForConfirmation = false
            };

            Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Draw], trigger);
            Triggers.Add(GameEvent.PhaseProceedEvents[TurnPhase.End], trigger2);
        }
Example #3
0
        public YuCe()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p.HandCards().Count > 0 && a.Source != null); },
                (p, e, a, cards, players) =>
            {
                ISkill skill;
                List <Card> nCards;
                List <Player> nPlayer;
                Game.CurrentGame.SyncImmutableCardAll(cards.First());
                Game.CurrentGame.NotificationProxy.NotifyShowCard(p, cards.First());
                if (a.Source.AskForCardUsage(new CardUsagePrompt("YuCeSource"), new YuCeVerfier(cards[0].Type.BaseCategory()), out skill, out nCards, out nPlayer))
                {
                    Game.CurrentGame.HandleCardDiscard(a.Source, nCards);
                }
                else
                {
                    Game.CurrentGame.RecoverHealth(p, p, 1);
                }
            },
                TriggerCondition.OwnerIsTarget,
                new YuCeVerfier()
                )
            {
                AskForConfirmation = false
            };

            Triggers.Add(GameEvent.AfterDamageInflicted, trigger);

            IsAutoInvoked = null;
        }
Example #4
0
 public QiaoShui()
 {
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
             this,
             (p, e, a) => { return p.HandCards().Count > 0; },
             (p, e, a, c, t) =>
             {
                 var result = Game.CurrentGame.PinDian(Owner, t[0], this);
                 if (result == true)
                 {
                     var winTrigger = new QiaoShuiWinTrigger(p, this);
                     Game.CurrentGame.RegisterTrigger(GameEvent.PlayerUsedCard, winTrigger);
                     Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, new QiaoShuiWinRemoval(Owner, winTrigger));
                 }
                 else
                 {
                     var loseTrigger = new QiaoShuiLoseTrigger(Owner);
                     Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanUseCard, loseTrigger);
                     Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, new QiaoShuiRemoval(Owner, loseTrigger));
                 }
             },
             TriggerCondition.OwnerIsSource,
             new PinDianVerifier()
         );
     Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Play], trigger);
     IsAutoInvoked = null;
 }
Example #5
0
        public LongYin()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) =>
            {
                return(a.Card.Type is Sha && Game.CurrentGame.CurrentPhase == TurnPhase.Play);
            },
                (p, e, a, c, pls) =>
            {
                Game.CurrentGame.HandleCardDiscard(p, c);
                if (a.Card.SuitColor == SuitColorType.Red)
                {
                    Game.CurrentGame.DrawCards(p, 1);
                }
                a.Source[Sha.NumberOfShaUsed]--;
            },
                TriggerCondition.Global,
                new LongYinVerifier()
                )
            {
                IsAutoNotify = false
            };

            Triggers.Add(GameEvent.PlayerUsedCard, trigger);
            IsAutoInvoked = null;
        }
Example #6
0
        public ZhiYan()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return true; },
                (p, e, a, c, pls) =>
                {
                    Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
                    Card card = Game.CurrentGame.PeekCard(0);
                    Game.CurrentGame.DrawCards(pls[0], 1);
                    Game.CurrentGame.SyncImmutableCardAll(card);
                    if (card.Type.BaseCategory() == CardCategory.Equipment)
                    {
                        Game.CurrentGame.RecoverHealth(pls[0], pls[0], 1);
                        var args = new GameEventArgs();
                        args.Source = pls[0];
                        args.Targets = new List<Player>();
                        args.Skill = null;
                        args.Cards = new List<Card>() { card };
                        Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
                    }
                    else
                    {
                        Game.CurrentGame.HideHandCard(card);
                    }
                },
                TriggerCondition.OwnerIsSource,
                new ZhiYanVerifier()
            ) { };

            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.End], trigger);
        }
Example #7
0
 public QiaoBian()
 {
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         Draw,
         TriggerCondition.OwnerIsSource,
         new DrawVerifier()
     );
     var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         (p, e, a, cards, players) =>
         {
             Game.CurrentGame.HandleCardDiscard(p, cards);
             Game.CurrentGame.CurrentPhase++;
             Game.CurrentGame.CurrentPhaseEventIndex = 2;
             throw new TriggerResultException(TriggerResult.End);
         },
         TriggerCondition.OwnerIsSource,
         new SkipOnlyVerifier()
     );
     var trigger3 = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         Move,
         TriggerCondition.OwnerIsSource,
         new MoveVerifier()
     );
     Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Judge], trigger);
     Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Draw], trigger3);
     Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Start], trigger2);
     Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Play], trigger2);
     IsAutoInvoked = null;
 }
Example #8
0
        public JieYuan()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return p.Health <= a.Source.Health && p != a.Source; },
                (p, e, a, c, pls) =>
                {
                    p[JieYuanEffect] = 1;
                    Game.CurrentGame.HandleCardDiscard(p, c);
                    var damageArgs = a as DamageEventArgs;
                    damageArgs.Magnitude--;
                },
                TriggerCondition.OwnerIsTarget,
                new JieYuanVerifier(true)
            );
            Triggers.Add(GameEvent.DamageInflicted, trigger);

            var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return p.Health <= a.Targets[0].Health && p != a.Targets[0]; },
                (p, e, a, c, pls) =>
                {
                    p[JieYuanEffect] = 0;
                    Game.CurrentGame.HandleCardDiscard(p, c);
                    var damageArgs = a as DamageEventArgs;
                    damageArgs.Magnitude++;
                },
                TriggerCondition.OwnerIsSource,
                new JieYuanVerifier(false)
            );
            Triggers.Add(GameEvent.DamageCaused, trigger2);
            IsAutoInvoked = null;
        }
Example #9
0
        public QiaoShui()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p.HandCards().Count > 0); },
                (p, e, a, c, t) =>
            {
                var result = Game.CurrentGame.PinDian(Owner, t[0], this);
                if (result == true)
                {
                    var winTrigger = new QiaoShuiWinTrigger(p, this);
                    Game.CurrentGame.RegisterTrigger(GameEvent.PlayerUsedCard, winTrigger);
                    Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, new QiaoShuiWinRemoval(Owner, winTrigger));
                }
                else
                {
                    var loseTrigger = new QiaoShuiLoseTrigger(Owner);
                    Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanUseCard, loseTrigger);
                    Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, new QiaoShuiRemoval(Owner, loseTrigger));
                }
            },
                TriggerCondition.OwnerIsSource,
                new PinDianVerifier()
                );

            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Play], trigger);
            IsAutoInvoked = null;
        }
Example #10
0
        public XingWu()
        {
            var tagClear = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { p[CardSuitUsed] = 0; },
                TriggerCondition.OwnerIsSource
            ) { IsAutoNotify = false, AskForConfirmation = false };
            Triggers.Add(GameEvent.PhaseBeforeStart, tagClear);

            var cardUsed = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) =>
                {
                    var card = a.ReadonlyCard;
                    p[CardSuitUsed] |= 1 << (int)card.SuitColor;
                },
                TriggerCondition.OwnerIsSource
            ) { IsAutoNotify = false, AskForConfirmation = false };
            Triggers.Add(GameEvent.PlayerUsedCard, cardUsed);

            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return p.HandCards().Count > 0; },
                (p, e, a, cards, players) =>
                {
                    NotifySkillUse();
                    Game.CurrentGame.HandleCardTransfer(p, p, XingWuDeck, cards, HeroTag);
                    Game.CurrentGame.PlayerAcquiredCard(p, cards);
                    List<Card> XingWuCards = Game.CurrentGame.Decks[p, XingWuDeck];
                    if (XingWuCards.Count >= 3)
                    {
                        Game.CurrentGame.HandleCardDiscard(p, XingWuCards);
                        List<Player> aPlayers = Game.CurrentGame.AlivePlayers;
                        if (!aPlayers.Any(pl => pl.IsMale))
                        {
                            return;
                        }
                        ISkill skill;
                        List<Card> nCards;
                        List<Player> nPlayers;
                        if (!p.AskForCardUsage(new CardUsagePrompt("XingWuChoicePlayer"), new XingWuChoicePlayer(), out skill, out nCards, out nPlayers))
                        {
                            nPlayers.Add((from m in aPlayers where m.IsMale select m).First());
                        }
                        Player target = nPlayers.First();
                        NotifySkillUse(nPlayers);
                        Game.CurrentGame.DoDamage(p, target, 2, DamageElement.None, null, null);
                        Game.CurrentGame.HandleCardDiscard(target, target.Equipments());
                    }
                },
                TriggerCondition.OwnerIsSource,
                new XingWuVerifier()
            ) { AskForConfirmation = false, IsAutoNotify = false };
            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Discard], trigger);
            IsAutoInvoked = null;
            DeckCleanup.Add(XingWuDeck);
        }
Example #11
0
        public QiuYuan()
        {
            qiuYuanVerifier = new QiuYuanVerifier();
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) =>
            {
                if (a.ReadonlyCard.Type is Sha)
                {
                    qiuYuanVerifier.ShaSource = a.Source;
                    return(true);
                }
                return(false);
            },
                (p, e, a, cards, players) =>
            {
                ISkill skill;
                List <Card> nCards;
                List <Player> nPlayers;
                Card theCard = null;
                if (!players[0].AskForCardUsage(new CardUsagePrompt("QiuYuanGiveCard", p), new QiuYuanGiveCardVerifier(), out skill, out nCards, out nPlayers))
                {
                    theCard = players[0].HandCards().First();
                    Game.CurrentGame.SyncImmutableCardAll(theCard);
                    nCards.Add(theCard);
                }
                else
                {
                    theCard = nCards.First();
                }
                Game.CurrentGame.HandleCardTransferToHand(players[0], p, nCards);
                if (!(theCard.Type is Shan) && !a.Targets.Contains(players[0]))
                {
                    a.Targets.Add(players[0]);
                    if (Game.CurrentGame.OrderOf(Game.CurrentGame.CurrentPlayer, p) < Game.CurrentGame.OrderOf(Game.CurrentGame.CurrentPlayer, players[0]))
                    {
                        GameEventArgs newArgs = new GameEventArgs();
                        newArgs.Source        = a.Source;
                        newArgs.UiTargets     = players;
                        newArgs.Targets       = players;
                        newArgs.Card          = a.Card;
                        newArgs.ReadonlyCard  = a.ReadonlyCard;
                        newArgs.InResponseTo  = a.InResponseTo;
                        Game.CurrentGame.Emit(GameEvent.CardUsageTargetConfirming, newArgs);
                    }
                }
            },
                TriggerCondition.OwnerIsTarget,
                qiuYuanVerifier
                )
            {
                AskForConfirmation = false
            };

            Triggers.Add(GameEvent.CardUsageTargetConfirming, trigger);
            IsAutoInvoked = null;
        }
Example #12
0
 public JuJian()
 {
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         Run,
         TriggerCondition.OwnerIsSource,
         new JuJianVerifier()
     );
     Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.End], trigger);
     IsAutoInvoked = null;
 }
Example #13
0
 public XuanHuo()
 {
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         Run,
         TriggerCondition.OwnerIsSource,
         new XuanHuoVerifier()
     ) { IsAutoNotify = false, AskForConfirmation = false };
     Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Draw], trigger);
     IsAutoInvoked = null;
 }
Example #14
0
 public FangZhu()
 {
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         OnAfterDamageInflicted,
         TriggerCondition.OwnerIsTarget,
         new FangZhuVerifier()
     );
     Triggers.Add(GameEvent.AfterDamageInflicted, trigger);
     IsAutoInvoked = null;
 }
Example #15
0
 public YingHun()
 {
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         (p, e, a) => { return p.MaxHealth > p.Health; },
         Run,
         TriggerCondition.OwnerIsSource,
         new YingHunVerifier()
     );
     Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Start], trigger);
     IsAutoInvoked = null;
 }
Example #16
0
        public JuJian()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                Run,
                TriggerCondition.OwnerIsSource,
                new JuJianVerifier()
                );

            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.End], trigger);
            IsAutoInvoked = null;
        }
Example #17
0
        public FangZhu()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                OnAfterDamageInflicted,
                TriggerCondition.OwnerIsTarget,
                new FangZhuVerifier()
                );

            Triggers.Add(GameEvent.AfterDamageInflicted, trigger);
            IsAutoInvoked = null;
        }
Example #18
0
 public QiuYuan()
 {
     qiuYuanVerifier = new QiuYuanVerifier();
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         (p, e, a) =>
         {
             if (a.ReadonlyCard.Type is Sha)
             {
                 qiuYuanVerifier.ShaSource = a.Source;
                 return true;
             }
             return false;
         },
         (p, e, a, cards, players) =>
         {
             ISkill skill;
             List<Card> nCards;
             List<Player> nPlayers;
             Card theCard = null;
             if (!players[0].AskForCardUsage(new CardUsagePrompt("QiuYuanGiveCard", p), new QiuYuanGiveCardVerifier(), out skill, out nCards, out nPlayers))
             {
                 theCard = players[0].HandCards().First();
                 Game.CurrentGame.SyncImmutableCardAll(theCard);
                 nCards.Add(theCard);
             }
             else
             {
                 theCard = nCards.First();
             }
             Game.CurrentGame.HandleCardTransferToHand(players[0], p, nCards);
             if (!(theCard.Type is Shan) && !a.Targets.Contains(players[0]))
             {
                 a.Targets.Add(players[0]);
                 if (Game.CurrentGame.OrderOf(Game.CurrentGame.CurrentPlayer, p) < Game.CurrentGame.OrderOf(Game.CurrentGame.CurrentPlayer, players[0]))
                 {
                     GameEventArgs newArgs = new GameEventArgs();
                     newArgs.Source = a.Source;
                     newArgs.UiTargets = players;
                     newArgs.Targets = players;
                     newArgs.Card = a.Card;
                     newArgs.ReadonlyCard = a.ReadonlyCard;
                     newArgs.InResponseTo = a.InResponseTo;
                     Game.CurrentGame.Emit(GameEvent.CardUsageTargetConfirming, newArgs);
                 }
             }
         },
         TriggerCondition.OwnerIsTarget,
         qiuYuanVerifier
     ) { AskForConfirmation = false };
     Triggers.Add(GameEvent.CardUsageTargetConfirming, trigger);
     IsAutoInvoked = null;
 }
Example #19
0
        public YingHun()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p.LostHealth > 0); },
                Run,
                TriggerCondition.OwnerIsSource,
                new YingHunVerifier()
                );

            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Start], trigger);
            IsAutoInvoked = null;
        }
Example #20
0
 public BaiYinFangZhu()
 {
     Triggers.Clear();
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         (p, e, a) => {return p[RenJie.RenMark] > 0;},
         Wrapper,
         TriggerCondition.OwnerIsTarget,
         new FangZhuVerifier()
     );
     Triggers.Add(GameEvent.AfterDamageInflicted, trigger);
     IsAutoInvoked = null;
 }
Example #21
0
 public XuanFeng()
 {
     var trigger = new AutoNotifyUsagePassiveSkillTrigger(
         this,
         canTrigger,
         Run,
         TriggerCondition.OwnerIsSource,
         new XuanFengVerifier()
     );
     Triggers.Add(GameEvent.CardsLost, trigger);
     Triggers.Add(GameEvent.CardsEnteredDiscardDeck, trigger);
     IsAutoInvoked = null;
 }
Example #22
0
        public LeiJi()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(a.ReadonlyCard != null && a.ReadonlyCard.Type is Shan); },
                Run,
                TriggerCondition.OwnerIsSource,
                new LeiJiVerifier()
                );

            Triggers.Add(GameEvent.PlayerPlayedCard, trigger);
            Triggers.Add(GameEvent.PlayerUsedCard, trigger);
            IsAutoInvoked = null;
        }
Example #23
0
            public BaiYinFangZhu()
            {
                Triggers.Clear();
                var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                    this,
                    (p, e, a) => { return(p[RenJie.RenMark] > 0); },
                    Wrapper,
                    TriggerCondition.OwnerIsTarget,
                    new FangZhuVerifier()
                    );

                Triggers.Add(GameEvent.AfterDamageInflicted, trigger);
                IsAutoInvoked = null;
            }
Example #24
0
        public XuanHuo()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                Run,
                TriggerCondition.OwnerIsSource,
                new XuanHuoVerifier()
                )
            {
                IsAutoNotify = false, AskForConfirmation = false
            };

            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Draw], trigger);
            IsAutoInvoked = null;
        }
Example #25
0
            public ChunLaoPassiveSkill()
            {
                ParentSkill = null;
                var trigger1 = new AutoNotifyUsagePassiveSkillTrigger(
                    this,
                    (p, e, a) => { return(Game.CurrentGame.Decks[p, ChunDeck].Count == 0); },
                    StoreChun,
                    TriggerCondition.OwnerIsSource,
                    new ChunLaoStoreChunVerifier()
                    )
                {
                    AskForConfirmation = false, IsAutoNotify = false
                };

                Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.End], trigger1);
            }
Example #26
0
        public JieYuan()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(a.Source != null && p.Health <= a.Source.Health && p != a.Source); },
                (p, e, a, c, pls) =>
            {
                JieYuanEffect = 0;
                NotifySkillUse();
                Game.CurrentGame.HandleCardDiscard(p, c);
                var damageArgs = a as DamageEventArgs;
                damageArgs.Magnitude--;
                if (damageArgs.Magnitude == 0)
                {
                    throw new TriggerResultException(TriggerResult.End);
                }
            },
                TriggerCondition.OwnerIsTarget,
                new JieYuanVerifier(true)
                )
            {
                IsAutoNotify = false
            };

            Triggers.Add(GameEvent.DamageInflicted, trigger);

            var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p.Health <= a.Targets[0].Health && p != a.Targets[0]); },
                (p, e, a, c, pls) =>
            {
                JieYuanEffect = 1;
                NotifySkillUse();
                Game.CurrentGame.HandleCardDiscard(p, c);
                var damageArgs = a as DamageEventArgs;
                damageArgs.Magnitude++;
            },
                TriggerCondition.OwnerIsSource,
                new JieYuanVerifier(false)
                )
            {
                IsAutoNotify = false
            };

            Triggers.Add(GameEvent.DamageCaused, trigger2);
            IsAutoInvoked = null;
        }
Example #27
0
        public XuanFeng()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                canTrigger,
                Run,
                TriggerCondition.OwnerIsSource,
                new XuanFengVerifier()
                )
            {
                Priority = SkillPriority.XiaoJi
            };

            Triggers.Add(GameEvent.CardsLost, trigger);
            Triggers.Add(GameEvent.CardsEnteredDiscardDeck, trigger);
            IsAutoInvoked = null;
        }
Example #28
0
        public DuoDao()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return p.HandCards().Count > 0 && a.Source != null && a.Source.Weapon() != null; },
                (p, e, a, cards, players) =>
                {
                    Game.CurrentGame.HandleCardDiscard(p, cards);
                    Game.CurrentGame.HandleCardTransferToHand(a.Source, p, new List<Card>() { a.Source.Weapon() });
                },
                TriggerCondition.OwnerIsTarget,
                new DuoDaoVerifier()
            ) { AskForConfirmation = false };
            Triggers.Add(GameEvent.AfterDamageInflicted, trigger);

            IsAutoInvoked = null;
        }
Example #29
0
        public ZhaoLie()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                   this,
                   (p, e, a) =>
                   {
                       return Game.CurrentGame.AlivePlayers.Any(pl => Game.CurrentGame.DistanceTo(p, pl) <= p[Player.AttackRange] + 1 && pl != p);
                   },
                   (p, e, a, c, pls) =>
                   {
                       p[Player.DealAdjustment]--;
                       ZhaoLieTarget = pls[0];
                       ZhaoLieUsed = true;
                   },
                   TriggerCondition.OwnerIsSource,
                   new ZhaoLieVerifier()
               ) { AskForConfirmation = false };
            Triggers.Add(GameEvent.PhaseProceedEvents[TurnPhase.Draw], trigger);

            var trigger2 = new AutoNotifyPassiveSkillTrigger(
                   this,
                   (p, e, a) => { return ZhaoLieUsed && ZhaoLieTarget != null; },
                   ZhaoLieProcess,
                   TriggerCondition.OwnerIsSource
               ) { AskForConfirmation = false, IsAutoNotify = false };
            Triggers.Add(GameEvent.PhaseEndEvents[TurnPhase.Draw], trigger2);

            var trigger3 = new AutoNotifyPassiveSkillTrigger(
                   this,
                   (p, e, a) => { return ZhaoLieTarget != null && a.Targets.Contains(ZhaoLieTarget) && a.ReadonlyCard != null && a.ReadonlyCard[ZhaoLieDamage] != 0; },
                   (p, e, a) => { a.ReadonlyCard[ZhaoLieDamage[ZhaoLieTarget]] = 1; },
                   TriggerCondition.OwnerIsSource
               ) { AskForConfirmation = false, IsAutoNotify = false, Priority = int.MinValue };
            Triggers.Add(GameEvent.DamageInflicted, trigger3);

            var trigger4 = new AutoNotifyPassiveSkillTrigger(
                   this,
                   (p, e, a) => { return ZhaoLieTarget != null && a.ReadonlyCard != null && a.ReadonlyCard[ZhaoLieDamage[a.Targets[0]]] != 0; },
                   (p, e, a) => { Game.CurrentGame.HandleCardTransferToHand(null, a.Targets[0], basicCards); ZhaoLieTarget = null; },
                   TriggerCondition.OwnerIsSource
               ) { AskForConfirmation = false, IsAutoNotify = false };
            Triggers.Add(GameEvent.DamageComputingFinished, trigger4);

            IsAutoInvoked = null;
        }
Example #30
0
        public LongYin()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) =>
                {
                    return a.Card.Type is Sha && Game.CurrentGame.CurrentPhase == TurnPhase.Play;
                },
                (p, e, a, c, pls) =>
                {
                    Game.CurrentGame.HandleCardDiscard(p, c);
                    if (a.Card.SuitColor == SuitColorType.Red) Game.CurrentGame.DrawCards(p, 1);
                    a.Source[Sha.NumberOfShaUsed]--;
                },
                TriggerCondition.Global,
                new LongYinVerifier()
            ) { IsAutoNotify = false };

            Triggers.Add(GameEvent.PlayerUsedCard, trigger);
            IsAutoInvoked = null;
        }
Example #31
0
        public LeiJi()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return a.Card.Type is Shan; },
                Run,
                TriggerCondition.OwnerIsSource,
                new LeiJiVerifier()
            );
            var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return a.Card.Type is Shan;},
                Run,
                TriggerCondition.OwnerIsSource,
                new LeiJiVerifier()
            );

            Triggers.Add(GameEvent.PlayerPlayedCard, trigger);
            Triggers.Add(GameEvent.PlayerUsedCard, trigger2);
            IsAutoInvoked = null;
        }
Example #32
0
        public FangQuan()
        {
            var trigger = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) =>
                {
                    p[FangQuanUsed] = 1;
                    Game.CurrentGame.CurrentPhase++;
                    Game.CurrentGame.CurrentPhaseEventIndex = 2;
                    throw new TriggerResultException(TriggerResult.End);
                },
                TriggerCondition.OwnerIsSource
            );
            var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return p[FangQuanUsed] == 1; },
                (p, e, a, cards, players) =>
                {
                    Game.CurrentGame.HandleCardDiscard(a.Source, cards);

                    var saveP = Game.CurrentGame.CurrentPlayer;
                    var savePh = Game.CurrentGame.CurrentPhase;
                    var savePhI = Game.CurrentGame.CurrentPhaseEventIndex;
                    GameEventArgs args = new GameEventArgs();
                    args.Source = players[0];
                    Game.CurrentGame.CurrentPhaseEventIndex = 0;
                    Game.CurrentGame.CurrentPhase = TurnPhase.BeforeStart;
                    Game.CurrentGame.Emit(GameEvent.DoPlayer, args);
                    Game.CurrentGame.CurrentPlayer = saveP;
                    Game.CurrentGame.CurrentPhase = savePh;
                    Game.CurrentGame.CurrentPhaseEventIndex = savePhI;
                },
                TriggerCondition.OwnerIsSource,
                new FangQuanVerifier()
            ) { AskForConfirmation = false };
            Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Draw], trigger);
            Triggers.Add(GameEvent.PhaseProceedEvents[TurnPhase.End], trigger2);
        }
Example #33
0
        public ZhiYan()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(true); },
                (p, e, a, c, pls) =>
            {
                Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
                Card card = Game.CurrentGame.PeekCard(0);
                Game.CurrentGame.DrawCards(pls[0], 1);
                Game.CurrentGame.SyncImmutableCardAll(card);
                if (card.Type.BaseCategory() == CardCategory.Equipment)
                {
                    Game.CurrentGame.RecoverHealth(pls[0], pls[0], 1);
                    var args     = new GameEventArgs();
                    args.Source  = pls[0];
                    args.Targets = new List <Player>();
                    args.Skill   = null;
                    args.Cards   = new List <Card>()
                    {
                        card
                    };
                    Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
                }
                else
                {
                    Game.CurrentGame.HideHandCard(card);
                }
            },
                TriggerCondition.OwnerIsSource,
                new ZhiYanVerifier()
                )
            {
            };

            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.End], trigger);
        }
Example #34
0
        public JieYuan()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return a.Source != null && p.Health <= a.Source.Health && p != a.Source; },
                (p, e, a, c, pls) =>
                {
                    JieYuanEffect = 0;
                    NotifySkillUse();
                    Game.CurrentGame.HandleCardDiscard(p, c);
                    var damageArgs = a as DamageEventArgs;
                    damageArgs.Magnitude--;
                    if (damageArgs.Magnitude == 0) throw new TriggerResultException(TriggerResult.End);
                },
                TriggerCondition.OwnerIsTarget,
                new JieYuanVerifier(true)
            ) { IsAutoNotify = false };
            Triggers.Add(GameEvent.DamageInflicted, trigger);

            var trigger2 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return p.Health <= a.Targets[0].Health && p != a.Targets[0]; },
                (p, e, a, c, pls) =>
                {
                    JieYuanEffect = 1;
                    NotifySkillUse();
                    Game.CurrentGame.HandleCardDiscard(p, c);
                    var damageArgs = a as DamageEventArgs;
                    damageArgs.Magnitude++;
                },
                TriggerCondition.OwnerIsSource,
                new JieYuanVerifier(false)
            ) { IsAutoNotify = false };
            Triggers.Add(GameEvent.DamageCaused, trigger2);
            IsAutoInvoked = null;
        }
Example #35
0
        public DuoDao()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p.HandCards().Count > 0 && a.Source != null && a.Source.Weapon() != null); },
                (p, e, a, cards, players) =>
            {
                Game.CurrentGame.HandleCardDiscard(p, cards);
                Game.CurrentGame.HandleCardTransferToHand(a.Source, p, new List <Card>()
                {
                    a.Source.Weapon()
                });
            },
                TriggerCondition.OwnerIsTarget,
                new DuoDaoVerifier()
                )
            {
                AskForConfirmation = false
            };

            Triggers.Add(GameEvent.AfterDamageInflicted, trigger);

            IsAutoInvoked = null;
        }
Example #36
0
 public ChunLaoPassiveSkill()
 {
     ParentSkill = null;
     var trigger1 = new AutoNotifyUsagePassiveSkillTrigger(
             this,
             (p, e, a) => { return Game.CurrentGame.Decks[p, ChunDeck].Count == 0; },
             StoreChun,
             TriggerCondition.OwnerIsSource,
             new ChunLaoStoreChunVerifier()
         ) { AskForConfirmation = false, IsAutoNotify = false };
     Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.End], trigger1);
 }
Example #37
0
        public MouDuan()
        {
            mdJiAng   = new JiAng();
            mdQianXun = new QianXun();
            mdYingZi  = new YingZi();
            mdKeJi    = new KeJi();

            var trigger1 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) =>
            {
                if (e == GameEvent.PlayerSkillSetChanged)
                {
                    SkillSetChangedEventArgs args = a as SkillSetChangedEventArgs;
                    return(!args.IsLosingSkill && args.Skills.Contains(this));
                }
                return(true);
            },
                (p, e, a) =>
            {
                if (p.HandCards().Count > 2)
                {
                    p[WuMark] = 1;
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdJiAng, HeroTag);
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdQianXun, HeroTag);
                }
                else
                {
                    p[WenMark] = 1;
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdYingZi, HeroTag);
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdKeJi, HeroTag);
                }
            },
                TriggerCondition.OwnerIsSource
                )
            {
                AskForConfirmation = false, IsAutoNotify = false
            };

            Triggers.Add(GameEvent.PlayerGameStartAction, trigger1);
            Triggers.Add(GameEvent.PlayerSkillSetChanged, trigger1);

            var trigger2 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return(p.HandCards().Count <= 2 && p[WuMark] != 0); },
                (p, e, a) =>
            {
                p[WuMark]  = 0;
                p[WenMark] = 1;
                Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdJiAng);
                Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdQianXun);
                Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdYingZi, HeroTag);
                Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdKeJi, HeroTag);
            },
                TriggerCondition.OwnerIsSource
                )
            {
                AskForConfirmation = false
            };

            Triggers.Add(GameEvent.CardsLost, trigger2);

            var trigger3 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p[WenMark] != 0); },
                (p, e, a, c, t) =>
            {
                Game.CurrentGame.HandleCardDiscard(p, c);
                if (p.HandCards().Count <= 2)
                {
                    return;
                }
                p[WuMark]  = 1;
                p[WenMark] = 0;
                Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdYingZi);
                Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdKeJi);
                Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdJiAng, HeroTag);
                Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdQianXun, HeroTag);
            },
                TriggerCondition.Global,
                new MouDuanVerifier()
                )
            {
                AskForConfirmation = false
            };

            Triggers.Add(GameEvent.PhaseBeforeStart, trigger3);

            IsAutoInvoked = null;
        }
Example #38
0
        public XingWu()
        {
            var tagClear = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { p[CardSuitUsed] = 0; },
                TriggerCondition.OwnerIsSource
                )
            {
                IsAutoNotify = false, AskForConfirmation = false
            };

            Triggers.Add(GameEvent.PhaseBeforeStart, tagClear);

            var cardUsed = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) =>
            {
                var card         = a.ReadonlyCard;
                p[CardSuitUsed] |= 1 << (int)card.SuitColor;
            },
                TriggerCondition.OwnerIsSource
                )
            {
                IsAutoNotify = false, AskForConfirmation = false
            };

            Triggers.Add(GameEvent.PlayerUsedCard, cardUsed);

            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return(p.HandCards().Count > 0); },
                (p, e, a, cards, players) =>
            {
                NotifySkillUse();
                Game.CurrentGame.HandleCardTransfer(p, p, XingWuDeck, cards, HeroTag);
                Game.CurrentGame.PlayerAcquiredCard(p, cards);
                List <Card> XingWuCards = Game.CurrentGame.Decks[p, XingWuDeck];
                if (XingWuCards.Count >= 3)
                {
                    Game.CurrentGame.HandleCardDiscard(p, XingWuCards);
                    List <Player> aPlayers = Game.CurrentGame.AlivePlayers;
                    if (!aPlayers.Any(pl => pl.IsMale))
                    {
                        return;
                    }
                    ISkill skill;
                    List <Card> nCards;
                    List <Player> nPlayers;
                    if (!p.AskForCardUsage(new CardUsagePrompt("XingWuChoicePlayer"), new XingWuChoicePlayer(), out skill, out nCards, out nPlayers))
                    {
                        nPlayers.Add((from m in aPlayers where m.IsMale select m).First());
                    }
                    Player target = nPlayers.First();
                    NotifySkillUse(nPlayers);
                    Game.CurrentGame.DoDamage(p, target, 2, DamageElement.None, null, null);
                    Game.CurrentGame.HandleCardDiscard(target, target.Equipments());
                }
            },
                TriggerCondition.OwnerIsSource,
                new XingWuVerifier()
                )
            {
                AskForConfirmation = false, IsAutoNotify = false
            };

            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.Discard], trigger);
            IsAutoInvoked = null;
            DeckCleanup.Add(XingWuDeck);
        }
Example #39
0
        public ZhaoLie()
        {
            var trigger = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) =>
            {
                return(Game.CurrentGame.AlivePlayers.Any(pl => Game.CurrentGame.DistanceTo(p, pl) <= p[Player.AttackRange] + 1 && pl != p));
            },
                (p, e, a, c, pls) =>
            {
                p[Player.DealAdjustment]--;
                ZhaoLieTarget = pls[0];
                ZhaoLieUsed   = true;
            },
                TriggerCondition.OwnerIsSource,
                new ZhaoLieVerifier()
                )
            {
                AskForConfirmation = false
            };

            Triggers.Add(GameEvent.PhaseProceedEvents[TurnPhase.Draw], trigger);

            var trigger2 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return(ZhaoLieUsed && ZhaoLieTarget != null); },
                ZhaoLieProcess,
                TriggerCondition.OwnerIsSource
                )
            {
                AskForConfirmation = false, IsAutoNotify = false
            };

            Triggers.Add(GameEvent.PhaseEndEvents[TurnPhase.Draw], trigger2);

            var trigger3 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return(ZhaoLieTarget != null && a.Targets.Contains(ZhaoLieTarget) && a.ReadonlyCard != null && a.ReadonlyCard[ZhaoLieDamage] != 0); },
                (p, e, a) => { a.ReadonlyCard[ZhaoLieDamage[ZhaoLieTarget]] = 1; },
                TriggerCondition.OwnerIsSource
                )
            {
                AskForConfirmation = false, IsAutoNotify = false, Priority = int.MinValue
            };

            Triggers.Add(GameEvent.DamageInflicted, trigger3);

            var trigger4 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return(ZhaoLieTarget != null && a.ReadonlyCard != null && a.ReadonlyCard[ZhaoLieDamage[a.Targets[0]]] != 0); },
                (p, e, a) => { Game.CurrentGame.HandleCardTransferToHand(null, a.Targets[0], basicCards); ZhaoLieTarget = null; },
                TriggerCondition.OwnerIsSource
                )
            {
                AskForConfirmation = false, IsAutoNotify = false
            };

            Triggers.Add(GameEvent.DamageComputingFinished, trigger4);

            IsAutoInvoked = null;
        }
Example #40
0
        public MouDuan()
        {
            mdJiAng = new JiAng();
            mdQianXun = new QianXun();
            mdYingZi = new YingZi();
            mdKeJi = new KeJi();

            var trigger1 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) =>
                {
                    if (e == GameEvent.PlayerSkillSetChanged)
                    {
                        SkillSetChangedEventArgs args = a as SkillSetChangedEventArgs;
                        return !args.IsLosingSkill && args.Skills.Contains(this);
                    }
                    return true;
                },
                (p, e, a) =>
                {
                    if (p.HandCards().Count > 2)
                    {
                        p[WuMark] = 1;
                        Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdJiAng, HeroTag);
                        Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdQianXun, HeroTag);
                    }
                    else
                    {
                        p[WenMark] = 1;
                        Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdYingZi, HeroTag);
                        Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdKeJi, HeroTag);
                    }
                },
                TriggerCondition.OwnerIsSource
                ) { AskForConfirmation = false, IsAutoNotify = false };
            Triggers.Add(GameEvent.PlayerGameStartAction, trigger1);
            Triggers.Add(GameEvent.PlayerSkillSetChanged, trigger1);

            var trigger2 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return p.HandCards().Count <= 2 && p[WuMark] != 0; },
                (p, e, a) =>
                {
                    p[WuMark] = 0;
                    p[WenMark] = 1;
                    Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdJiAng);
                    Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdQianXun);
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdYingZi, HeroTag);
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdKeJi, HeroTag);
                },
                TriggerCondition.OwnerIsSource
                ) { AskForConfirmation = false };
            Triggers.Add(GameEvent.CardsLost, trigger2);

            var trigger3 = new AutoNotifyUsagePassiveSkillTrigger(
                this,
                (p, e, a) => { return p[WenMark] != 0; },
                (p, e, a, c, t) =>
                {
                    Game.CurrentGame.HandleCardDiscard(p, c);
                    if (p.HandCards().Count <= 2) return;
                    p[WuMark] = 1;
                    p[WenMark] = 0;
                    Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdYingZi);
                    Game.CurrentGame.PlayerLoseAdditionalSkill(p, mdKeJi);
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdJiAng, HeroTag);
                    Game.CurrentGame.PlayerAcquireAdditionalSkill(p, mdQianXun, HeroTag);
                },
                TriggerCondition.Global,
                new MouDuanVerifier()
                ) { AskForConfirmation = false };
            Triggers.Add(GameEvent.PhaseBeforeStart, trigger3);

            IsAutoInvoked = null;
        }