예제 #1
0
 public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
 {
     card = new CompositeCard();
     card.Type = handler;
     card.Subcards = new List<Card>(cards);
     return VerifierResult.Success;
 }
예제 #2
0
파일: JiJiang.cs 프로젝트: maplegh/sgs
        protected override bool DoTransformSideEffect(CompositeCard card, object arg, List<Player> targets)
        {
            ICard result = null;
            List<Player> toProcess = new List<Player>(Game.CurrentGame.AlivePlayers);
            toProcess.Remove(Owner);
            Game.CurrentGame.SortByOrderOfComputation(Owner, toProcess);
            bool noAnswer = true;
            foreach (var player in toProcess)
            {
                if (player.Hero.Allegiance == Core.Heroes.Allegiance.Shu)
                {
                    bool failToRespond = false;
                    while (true)
                    {
                        IUiProxy ui = Game.CurrentGame.UiProxies[player];
                        SingleCardUsageVerifier v1 = new SingleCardUsageVerifier((c) => { return c.Type is Sha; }, false);
                        ISkill skill;
                        List<Player> p;
                        List<Card> cards;
                        if (!ui.AskForCardUsage(new CardUsagePrompt("JiJiang", Owner), v1, out skill, out cards, out p))
                        {
                            failToRespond = true;
                            break;
                        }
                        if (!Game.CurrentGame.CommitCardTransform(player, skill, cards, out result, targets))
                        {
                            continue;
                        }
                        noAnswer = false;
                        Trace.TraceInformation("Player {0} Responded JiJiang with SHA, ", player.Id);
                        break;
                    }
                    if (failToRespond)
                    {
                        continue;
                    }
                    break;
                }
            }

            if (noAnswer)
            {
                return false;
            }

            Trace.Assert(result != null);
            card.Subcards = new List<Card>();
            if (result is CompositeCard)
            {
                card.Subcards.AddRange(((CompositeCard)result).Subcards);
                card.Type = ((CompositeCard)result).Type;
            }
            else
            {
                Trace.Assert(result is Card);
                card.Subcards.Add((Card)result);
                card.Type = ((Card)result).Type;
            }
            return true;
        }
예제 #3
0
        public override VerifierResult TryTransform(List<Card> cards, List<Player> arg, out CompositeCard card, bool isPlay)
        {
            card = new CompositeCard();
            card.Subcards = new List<Card>();
            card.Type = AdditionalType;
            card[TieSuoLianHuan.ProhibitReforging] = 1;
            if (Game.CurrentGame.CurrentPlayer == null || Game.CurrentGame.CurrentPlayer[GuHuoUsed] == 1)
            {
                return VerifierResult.Fail;
            }
            if (AdditionalType == null)
            {
                return VerifierResult.Partial;
            }
            if (!CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.Basic) &&
                !CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.ImmediateTool))
            {
                return VerifierResult.Fail;
            }
            if (cards == null || cards.Count == 0)
            {
                return VerifierResult.Partial;
            }
            if (cards != null && cards.Count != 1)
            {
                return VerifierResult.Fail;
            }
            if (cards[0].Place.DeckType != DeckType.Hand)
            {
                return VerifierResult.Fail;
            }

            card.Subcards.Add(cards[0]);
            return VerifierResult.Success;
        }
예제 #4
0
파일: QiCe.cs 프로젝트: pxoylngx/sgs
        public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
        {
            card = new CompositeCard();
            card.Subcards = new List<Card>();
            card.Type = AdditionalType;
            if (Owner[QiCeUsed] == 1) return VerifierResult.Fail;
            if (Game.CurrentGame.CurrentPhase != TurnPhase.Play) return VerifierResult.Fail;
            if (Owner.HandCards().Count == 0) return VerifierResult.Fail;
            if (AdditionalType == null)
            {
                return VerifierResult.Partial;
            }
            if (!CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.ImmediateTool))
            {
                return VerifierResult.Fail;
            }
            if (cards == null)
            {
                return VerifierResult.Partial;
            }
            foreach (var cc in cards)
            {
                if (cc.Place.DeckType != DeckType.Hand)
                {
                    return VerifierResult.Fail;
                }
            }
            if (cards.Count < Owner.HandCards().Count)
            {
                return VerifierResult.Partial;
            }

            card.Subcards.AddRange(cards);
            return VerifierResult.Success;
        }
예제 #5
0
 public override VerifierResult TryTransform(List<Card> cards, List<Player> arg, out CompositeCard card, bool isPlay)
 {
     card = null;
     if (cards == null || cards.Count < 1)
     {
         return VerifierResult.Partial;
     }
     if (cards.Count > 1)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].Owner != Owner || cards[0].Place.DeckType != DeckType.Hand)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].Type is Shan)
     {
         card = new CompositeCard();
         card.Subcards = new List<Card>(cards);
         card.Type = new RegularSha();
         card[CanShuaLiuMang] = 1;
         return VerifierResult.Success;
     }
     else if (cards[0].Type is Sha)
     {
         card = new CompositeCard();
         card.Subcards = new List<Card>(cards);
         card.Type = new Shan();
         card[CanShuaLiuMang] = 1;
         return VerifierResult.Success;
     }
     return VerifierResult.Fail;
 }
예제 #6
0
 public override VerifierResult TryTransform(List<Card> cards, List<Player> arg, out CompositeCard card, bool isPlay)
 {
     card = null;
     if (Owner.HandCards().Count <= Owner.Health)
         return VerifierResult.Fail;
     return base.TryTransform(cards, arg, out card, isPlay);
 }
예제 #7
0
 public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
 {
     card = new CompositeCard();
     card.Type = new RegularSha();
     if (Owner.HandCards().Count < 2) return VerifierResult.Fail;
     if (cards == null || cards.Count == 0)
     {
         return VerifierResult.Partial;
     }
     if (cards.Count > 2)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].Owner != Owner || cards[0].Place.DeckType != DeckType.Hand)
     {
         return VerifierResult.Fail;
     }
     if (cards.Count == 2 && (cards[1].Owner != Owner || cards[1].Place.DeckType != DeckType.Hand))
     {
         return VerifierResult.Fail;
     }
     if (cards.Count == 1)
     {
         return VerifierResult.Partial;
     }
     card.Subcards = new List<Card>(cards);
     return VerifierResult.Success;
 }
예제 #8
0
파일: GuHuo.cs 프로젝트: kissgoodbye/sgs
        public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
        {
            card = null;
            if (cards == null || cards.Count == 0)
            {
                return VerifierResult.Partial;
            }
            if (cards != null && cards.Count != 1)
            {
                return VerifierResult.Fail;
            }
            if (cards[0].Place.DeckType != DeckType.Hand)
            {
                return VerifierResult.Fail;
            }

            card = new CompositeCard();
            card.Subcards = new List<Card>();
            if (AdditionalType == null)
            {
                return VerifierResult.Partial;
            }
            if (!CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.Basic) &&
                !CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.ImmediateTool))
            {
                return VerifierResult.Fail;
            }

            card.Type = AdditionalType;
            card.Subcards.Add(cards[0]);
            return VerifierResult.Success;
        }
예제 #9
0
 public override VerifierResult TryTransform(List<Card> cards, List<Player> arg, out CompositeCard card, bool isPlay)
 {
     card = null;
     if (cards == null || cards.Count == 0)
     {
         return VerifierResult.Partial;
     }
     if (cards.Count > 2)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].Owner != Owner || cards[0].Place.DeckType != DeckType.Hand)
     {
         return VerifierResult.Fail;
     }
     if (cards.Count == 2 && ((cards[1].Owner != Owner || cards[1].Place.DeckType != DeckType.Hand) || cards[1].Suit != cards[0].Suit))
     {
         return VerifierResult.Fail;
     }
     if (cards.Count == 1)
     {
         return VerifierResult.Partial;
     }
     card = new CompositeCard();
     card.Subcards = new List<Card>(cards);
     card.Type = new WanJianQiFa();
     return VerifierResult.Success;
 }
예제 #10
0
 public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
 {
     card = null;
     if (cards == null || cards.Count < 1)
     {
         return VerifierResult.Partial;
     }
     if (cards.Count > 1)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].Owner != Owner)
     {
         return VerifierResult.Fail;
     }
     if (HandCardOnly)
     {
         if (cards[0].Place.DeckType != DeckType.Hand)
         {
             return VerifierResult.Fail;
         }
     }
     if (VerifyInput(cards[0], arg))
     {
         card = new CompositeCard();
         card.Subcards = new List<Card>(cards);
         card.Type = PossibleResult;
         return VerifierResult.Success;
     }
     return VerifierResult.Fail;
 }
예제 #11
0
파일: YanZheng.cs 프로젝트: h1398123/sgs
 public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
 {
     card = null;
     if (Owner.HandCards().Count <= Owner.Health)
         return VerifierResult.Fail;
     return base.TryTransform(cards, arg, out card);
 }
예제 #12
0
파일: QiCe.cs 프로젝트: kingling/sgs
        public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
        {
            card = new CompositeCard();
            card.Subcards = new List<Card>();
            card.Type = AdditionalType;
            card[TieSuoLianHuan.ProhibitReforging] = 1;
            if (Owner[QiCeUsed] == 1) return VerifierResult.Fail;
            if (Game.CurrentGame.CurrentPhase != TurnPhase.Play) return VerifierResult.Fail;
            if (Game.CurrentGame.CurrentPlayer != Owner) return VerifierResult.Fail;
            if (Owner.HandCards().Count == 0) return VerifierResult.Fail;
            if (AdditionalType == null)
            {
                return VerifierResult.Partial;
            }
            if (!CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.ImmediateTool) || AdditionalType is WuXieKeJi)
            {
                return VerifierResult.Fail;
            }
            if (cards != null && cards.Count > 0)
            {
                return VerifierResult.Fail;
            }

            card.Subcards.AddRange(Owner.HandCards());
            return VerifierResult.Success;
        }
예제 #13
0
파일: LiHuo.cs 프로젝트: h1398123/sgs
 public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
 {
     card = null;
     if (cards == null || cards.Count < 1)
     {
         return VerifierResult.Partial;
     }
     if (cards.Count > 1)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].Owner != Owner || cards[0].Place.DeckType != DeckType.Hand)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].Type is RegularSha)
     {
         card = new CompositeCard();
         card.Subcards = new List<Card>(cards);
         card.Type = new HuoSha();
         card[LiHuoSha] = 1;
         return VerifierResult.Success;
     }
     return VerifierResult.Fail;
 }
예제 #14
0
 public override VerifierResult TryTransform(List<Card> cards, List<Player> arg, out CompositeCard card, bool isPlay)
 {
     card = new CompositeCard();
     card.Type = handler;
     card.Subcards = new List<Card>(cards);
     card.Owner = Owner;
     return VerifierResult.Success;
 }
예제 #15
0
 public override void NotifyAction(Player source, List<Player> targets, CompositeCard card)
 {
     if (withoutNotify) return;
     ActionLog log = new ActionLog();
     log.GameAction = GameAction.None;
     log.CardAction = card;
     log.Source = source;
     log.SpecialEffectHint = GenerateSpecialEffectHintIndex(source, targets, card);
     Game.CurrentGame.NotificationProxy.NotifySkillUse(log);
 }
예제 #16
0
 public override void NotifyAction(Core.Players.Player source, List<Core.Players.Player> targets, CompositeCard card)
 {
     if (card.Type.IsReforging(source, this, card.Subcards, targets))
     {
         foreach (var c in card.Subcards)
         {
             c.Log.SkillAction = this;
         }
         return;
     }
     base.NotifyAction(source, targets, card);
 }
예제 #17
0
파일: JiJiang.cs 프로젝트: kingling/sgs
 public override void NotifyAction(Player source, List<Player> targets, CompositeCard card)
 {
     ActionLog log = new ActionLog();
     log.GameAction = GameAction.None;
     log.CardAction = card;
     log.SkillAction = this;
     log.Source = source;
     log.Targets = targets;
     log.ShowCueLine = true;
     log.SpecialEffectHint = GenerateSpecialEffectHintIndex(source, targets, card);
     Game.CurrentGame.NotificationProxy.NotifySkillUse(log);
 }
예제 #18
0
파일: JiuShi.cs 프로젝트: pxoylngx/sgs
        public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
        {
            card = new CompositeCard();
            card.Type = new Jiu();
            if (Owner.IsImprisoned)
            {
                return VerifierResult.Fail;
            }
            if (cards != null && cards.Count != 0)
            {
                return VerifierResult.Fail;
            }

            return VerifierResult.Success;
        }
예제 #19
0
 public override VerifierResult FastVerify(Player source, ISkill skill, List<Card> cards, List<Player> players)
 {
     if (players != null && players.Any(p => p.IsDead))
     {
         return VerifierResult.Fail;
     }
     if (players == null)
     {
         players = new List<Player>();
     }
     CompositeCard sha = new CompositeCard() { Type = type };
     if (!Game.CurrentGame.PlayerCanBeTargeted(source, players, sha))
     {
         return VerifierResult.Fail;
     }
     List<Player> newList = new List<Player>(players);
     if (target != null)
     {
         if (!newList.Contains(target))
         {
             newList.Insert(0, target);
         }
         else
         {
             return VerifierResult.Fail;
         }
     }
     if (cards != null && cards.Count > 0)
     {
         return VerifierResult.Fail;
     }
     if (skill is CardTransformSkill)
     {
         CardTransformSkill sk = skill as CardTransformSkill;
         if (sk.TryTransform(dummyCards, null, out sha) != VerifierResult.Success)
         {
             return VerifierResult.Fail;
         }
         if (helper != null) sha[helper] = 1;
         return new Sha().VerifyCore(source, sha, newList);
     }
     else if (skill != null)
     {
         return VerifierResult.Fail;
     }
     if (helper != null) sha[helper] = 1;
     return new Sha().VerifyCore(source, sha, newList);
 }
예제 #20
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);
     }
 }
예제 #21
0
 public override VerifierResult TryTransform(List<Card> cards, List<Player> arg, out CompositeCard card, bool isPlay)
 {
     card = null;
     if (cards != null && (cards.Count > 2 || cards.Any(c => c.Place.DeckType != DeckType.Hand)))
     {
         return VerifierResult.Fail;
     }
     if (cards == null || cards.Count < 2)
     {
         return VerifierResult.Partial;
     }
     card = new CompositeCard(cards);
     card.Type = new RegularSha();
     card.Owner = Owner;
     card[FuHunSha] = 1;
     return VerifierResult.Success;
 }
예제 #22
0
 /// <summary>
 /// Transform a set of cards.
 /// </summary>
 /// <param name="cards">Cards to be transformed.</param>
 /// <param name="arg">Additional args to help the transformation.</param>
 /// <returns>False if transform is aborted.</returns>
 /// <exception cref="CardTransformFailureException"></exception>
 public bool Transform(List<Card> cards, object arg, out CompositeCard card, List<Player> targets)
 {
     if (TryTransform(cards, arg, out card) != VerifierResult.Success)
     {
         throw new CardTransformFailureException();
     }
     NotifyAction(Owner, targets, card);
     bool ret = DoTransformSideEffect(card, arg, targets);
     if (ret)
     {
         foreach (Card c in card.Subcards)
         {
             c.Type = card.Type;
         }
     }
     return ret;
 }
예제 #23
0
 public override VerifierResult TryTransform(List<Card> cards, List<Player> arg, out CompositeCard card, bool isPlay)
 {
     card = null;
     if (cards == null || cards.Count == 0)
     {
         return VerifierResult.Partial;
     }
     Trace.Assert(Owner != null);
     if (Owner == null) return VerifierResult.Fail;
     int X = Math.Max(Owner.Health, 1);
     if (cards.Count > X)
     {
         return VerifierResult.Fail;
     }
     foreach (var cc in cards)
     {
         if (cc.Owner != Owner || cc.Suit != cards[0].Suit)
         {
             return VerifierResult.Fail;
         }
     }
     if (cards.Count < X)
     {
         return VerifierResult.Partial;
     }
     card = new CompositeCard();
     card.Subcards = new List<Card>(cards);
     if (cards[0].Suit == SuitType.Heart)
     {
         card.Type = new Tao();
     }
     if (cards[0].Suit == SuitType.Diamond)
     {
         card.Type = new HuoSha();
     }
     if (cards[0].Suit == SuitType.Club)
     {
         card.Type = new Shan();
     }
     if (cards[0].Suit == SuitType.Spade)
     {
         card.Type = new WuXieKeJi();
     }
     return VerifierResult.Success;
 }
예제 #24
0
        public override VerifierResult Validate(GameEventArgs arg)
        {
            if (Owner[XieChanUsed] != 0)
            {
                return VerifierResult.Fail;
            }
            List<Card> cards = arg.Cards;
            if (cards != null && cards.Count > 0)
            {
                return VerifierResult.Fail;
            }
            if (Owner.HandCards().Count == 0)
            {
                return VerifierResult.Fail;
            }
            if (arg.Targets != null && arg.Targets.Count > 1)
            {
                return VerifierResult.Fail;
            }
            if (arg.Targets != null && arg.Targets.Count == 1)
            {
                if (arg.Targets[0].HandCards().Count == 0) return VerifierResult.Fail;
                if (arg.Targets[0] == Owner) return VerifierResult.Fail;
                CompositeCard c = new CompositeCard();
                c.Type = new JueDou();
                c.Subcards = null;
                List<Player> dests = new List<Player>();
                dests.Add(arg.Targets[0]);
                if (!Game.CurrentGame.PlayerCanBeTargeted(null, dests, c))
                {
                    return VerifierResult.Fail;
                }
                if (!Game.CurrentGame.PlayerCanUseCard(Owner, c))
                {
                    return VerifierResult.Fail;
                }
            }
            if (Owner.HandCards().Count == 0) return VerifierResult.Fail;

            if (arg.Targets == null || arg.Targets.Count == 0)
            {
                return VerifierResult.Partial;
            }
            return VerifierResult.Success;
        }
예제 #25
0
파일: JiJiu.cs 프로젝트: h1398123/sgs
 public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
 {
     card = new CompositeCard();
     card.Type = new Tao();
     if (Owner == Game.CurrentGame.PhasesOwner)
     {
         return VerifierResult.Fail;
     }
     if (cards == null || cards.Count < 1)
     {
         return VerifierResult.Partial;
     }
     if (cards.Count > 1)
     {
         return VerifierResult.Fail;
     }
     if (cards[0].SuitColor != SuitColorType.Red || cards[0].Owner != Owner)
     {
         return VerifierResult.Fail;
     }
     card.Subcards = new List<Card>(cards);
     return VerifierResult.Success;
 }
예제 #26
0
파일: JiJiang.cs 프로젝트: kingling/sgs
        public override VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card)
        {
            card = null;
            if (Owner[JiJiangFailed] == 1 && Game.CurrentGame.LastAction is JiJiang && Game.CurrentGame.LastAction.Owner == Owner) return VerifierResult.Fail;
            if (cards != null && cards.Count != 0)
            {
                return VerifierResult.Fail;
            }
            List<Player> toProcess = new List<Player>(Game.CurrentGame.AlivePlayers);
            toProcess.Remove(Owner);
            bool noShuHero = true;
            foreach (var player in toProcess)
            {
                if (player.Allegiance == Core.Heroes.Allegiance.Shu)
                {
                    noShuHero = false;
                    break;
                }
            };

            if (noShuHero)
            {
                return VerifierResult.Fail;
            }

            card = new CompositeCard();
            if (cards == null)
            {
                card.Subcards = new List<Card>();
            }
            else
            {
                card.Subcards = new List<Card>(cards);
            }
            card.Type = new Sha();
            return VerifierResult.Success;
        }
예제 #27
0
파일: QiCe.cs 프로젝트: kingling/sgs
 protected override bool DoTransformSideEffect(CompositeCard card, object arg, List<Player> targets)
 {
     Owner[QiCeUsed] = 1;
     Game.CurrentGame.SyncImmutableCardsAll(Owner.HandCards());
     return true;
 }
예제 #28
0
 protected virtual void NotifyAction(Players.Player source, List<Players.Player> targets, CompositeCard card)
 {
     ActionLog log = new ActionLog();
     log.GameAction = GameAction.None;
     log.CardAction = card;
     log.SkillAction = this;
     log.Source = source;
     log.Targets = targets;
     Games.Game.CurrentGame.NotificationProxy.NotifySkillUse(log);
     if (card.Subcards != null)
     {
         foreach (Card c in card.Subcards)
         {
             if (c.Log == null)
             {
                 c.Log = new ActionLog();
             }
             c.Log.SkillAction = this;
         }
     }
 }
예제 #29
0
 protected virtual bool DoTransformSideEffect(CompositeCard card, object arg, List<Player> targets)
 {
     return true;
 }
예제 #30
0
 /// <summary>
 /// 尝试使用当前技能转换一组卡牌。
 /// </summary>
 /// <param name="cards">被转化的卡牌。</param>
 /// <param name="arg">辅助转化的额外参数。</param>
 /// <param name="card">转换成的卡牌。</param>
 /// <returns>转换是否成功。</returns>
 public abstract VerifierResult TryTransform(List<Card> cards, object arg, out CompositeCard card);