상속: Sanguosha.Core.UI.CardUsageVerifier
예제 #1
0
 /// <summary>
 /// 某玩家对某玩家视为使用一张虚拟的杀,能被技能转化,影响选择的目标,如疠火,朱雀羽扇
 /// </summary>
 public static void UseDummyShaTo(Player source, Player target, CardHandler shaType, Prompt prompt, CardAttribute helper = null, bool notifyShaSound = true)
 {
     CompositeCard sha = new CompositeCard() { Type = shaType };
     var v1 = new DummyShaVerifier(target, shaType, helper);
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     Game.CurrentGame.Emit(GameEvent.PlayerIsAboutToUseCard, new PlayerIsAboutToUseOrPlayCardEventArgs() { Source = source, Verifier = v1 });
     source.AskForCardUsage(prompt, v1, out skill, out cards, out players);
     GameEventArgs args = new GameEventArgs();
     args.Source = source;
     args.Targets = new List<Player>(players);
     if (target != null) args.Targets.Add(target);
     args.Skill = skill == null ? new CardWrapper(source, shaType, notifyShaSound) : skill;
     args.Cards = cards;
     CompositeCard card = null;
     if (skill != null)
     {
         List<Card> dummyCards = new List<Card>() { new Card() { Type = shaType, Place = new DeckPlace(null, DeckType.None) } };
         (skill as CardTransformSkill).TryTransform(dummyCards, null, out card);
         //虚拟的杀是不能有子卡的。
         card.Subcards.Clear();
     }
     //在触发 CommitActionToTargets 的时候,只有在这里,args.Card才会被赋值,且为CompositeCard
     args.Card = card;
     if (args.Targets.Count == 0)
     {
         foreach (Player p in Game.CurrentGame.AlivePlayers)
         {
             if (p != source && v1.FastVerify(source, skill, cards, new List<Player>() { p }) != VerifierResult.Fail)
             {
                 args.Targets.Add(p);
                 break;
             }
         }
     }
     try
     {
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
     }
     catch (TriggerResultException)
     {
         //程序总是不应该执行到这里的
         Trace.Assert(false);
     }
 }
예제 #2
0
파일: ShenSu.cs 프로젝트: shonwang/sgs
        public ShenSu()
        {
            verifier = new Basic.Cards.DummyShaVerifier(null, new RegularSha(), ShenSuSha);
            var trigger = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) =>
                {
                    if (e == GameEvent.PhaseOutEvents[TurnPhase.Start])
                    {
                        return !Game.CurrentGame.PhasesSkipped.Contains(TurnPhase.Judge) || !Game.CurrentGame.PhasesSkipped.Contains(TurnPhase.Draw);
                    }
                    else return !Game.CurrentGame.PhasesSkipped.Contains(TurnPhase.Play);
                },
                Run,
                TriggerCondition.OwnerIsSource
            ) { AskForConfirmation = false, IsAutoNotify = false };

            var trigger2 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return a.Card[ShenSuSha] != 0; },
                (p, e, a) =>
                {
                    ShaEventArgs args = a as ShaEventArgs;
                    args.RangeApproval[0] = true;
                },
                TriggerCondition.OwnerIsSource
            ) { AskForConfirmation = false, IsAutoNotify = false };

            Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Start], trigger);
            Triggers.Add(GameEvent.PhaseOutEvents[TurnPhase.Draw], trigger);
            Triggers.Add(Sha.PlayerShaTargetValidation, trigger2);
            IsAutoInvoked = null;
        }
예제 #3
0
파일: ShenSu.cs 프로젝트: shonwang/sgs
 public ShenSuVerifier(bool ShenSu1, DummyShaVerifier verifier)
 {
     shensu1 = ShenSu1;
     this.verifier = verifier;
 }
예제 #4
0
        /// <summary>
        /// 某玩家对某玩家视为使用一张虚拟的杀,能被技能转化,影响选择的目标,如疠火,朱雀羽扇
        /// </summary>
        public static void UseDummyShaTo(Player source, Player target, CardHandler shaType, Prompt prompt, CardAttribute helper = null, bool notifyShaSound = true)
        {
            CompositeCard sha = new CompositeCard()
            {
                Type = shaType
            };
            var           v1 = new DummyShaVerifier(target, shaType, helper);
            ISkill        skill;
            List <Card>   cards;
            List <Player> players;

            Game.CurrentGame.Emit(GameEvent.PlayerIsAboutToUseCard, new PlayerIsAboutToUseOrPlayCardEventArgs()
            {
                Source = source, Verifier = v1
            });
            source.AskForCardUsage(prompt, v1, out skill, out cards, out players);
            GameEventArgs args = new GameEventArgs();

            args.Source  = source;
            args.Targets = new List <Player>(players);
            if (target != null)
            {
                args.Targets.Add(target);
            }
            args.Skill = skill == null ? new CardWrapper(source, shaType, notifyShaSound) : skill;
            args.Cards = cards;
            CompositeCard card = null;

            if (skill != null)
            {
                List <Card> dummyCards = new List <Card>()
                {
                    new Card()
                    {
                        Type = shaType, Place = new DeckPlace(null, DeckType.None)
                    }
                };
                (skill as CardTransformSkill).TryTransform(dummyCards, null, out card);
                //虚拟的杀是不能有子卡的。
                card.Subcards.Clear();
            }
            //在触发 CommitActionToTargets 的时候,只有在这里,args.Card才会被赋值,且为CompositeCard
            args.Card = card;
            if (args.Targets.Count == 0)
            {
                foreach (Player p in Game.CurrentGame.AlivePlayers)
                {
                    if (p != source && v1.FastVerify(source, skill, cards, new List <Player>()
                    {
                        p
                    }) != VerifierResult.Fail)
                    {
                        args.Targets.Add(p);
                        break;
                    }
                }
            }
            try
            {
                Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
            }
            catch (TriggerResultException)
            {
                //程序总是不应该执行到这里的
                Trace.Assert(false);
            }
        }