Exemple #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;
 }
Exemple #2
0
        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;
        }
Exemple #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;
        }
Exemple #4
0
        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;
        }
Exemple #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;
 }
Exemple #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);
 }
Exemple #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;
 }
Exemple #8
0
        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;
        }
Exemple #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;
 }
 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;
 }
Exemple #11
0
 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);
 }
Exemple #12
0
        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;
        }
Exemple #13
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 || 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;
 }
 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;
 }
 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);
 }
Exemple #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);
 }
Exemple #17
0
 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);
 }
Exemple #18
0
        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;
        }
 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);
 }
Exemple #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);
     }
 }
Exemple #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;
 }
Exemple #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;
 }
Exemple #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;
 }
Exemple #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;
        }
Exemple #25
0
 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;
 }
Exemple #26
0
        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;
        }
Exemple #27
0
 protected override bool DoTransformSideEffect(CompositeCard card, object arg, List<Player> targets)
 {
     Owner[QiCeUsed] = 1;
     Game.CurrentGame.SyncImmutableCardsAll(Owner.HandCards());
     return true;
 }
Exemple #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;
         }
     }
 }
Exemple #29
0
 protected virtual bool DoTransformSideEffect(CompositeCard card, object arg, List<Player> targets)
 {
     return true;
 }
Exemple #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);