public DummyShaVerifier(Player t, CardHandler shaType, CardAttribute helper = null)
 {
     target = t;
     type = shaType;
     this.helper = helper;
     dummyCards = new List<Card>() { new Card() { Type = shaType, Place = new DeckPlace(null, DeckType.None) } };
 }
Example #2
0
File: Card.cs Project: pxoylngx/sgs
 public Card(SuitType t, int r, CardHandler c)
 {
     Suit = t;
     Rank = r;
     Type = c;
     attributes = null;
     Log = new UI.ActionLog();
 }
Example #3
0
 public Card(SuitType t, int r, CardHandler c)
 {
     Suit       = t;
     Rank       = r;
     Type       = c;
     attributes = null;
     Log        = new UI.ActionLog();
 }
Example #4
0
 public MieJiVerifier(Player p, ICard c, CardHandler handler)
 {
     existingCard = c;
     existingTarget = p;
     this.handler = handler;
     MaxCards = 0;
     MinCards = 0;
     MaxPlayers = Int16.MaxValue;
     MinPlayers = 1;
 }
Example #5
0
 public static IList<Inline> RichTranslate(CardHandler cardType)
 {
     IList<Inline> list = new List<Inline>();
     if (cardType == null) return list;
     string typeString = Application.Current.TryFindResource(string.Format("Card.{0}.Name", cardType.CardType)) as string;
     if (typeString != null)
     {
         list.Add(new Run(string.Format("【{0}】", typeString)) { Foreground = new SolidColorBrush(Colors.Yellow) });
     }
     return list;
 }
 public SingleCardDiscardVerifier(CardMatcher m = null, CardHandler handler = null)
 {
     Match = m;
     if (handler != null)
     {
         possibleMatch = new List<CardHandler>();
         possibleMatch.Add(handler);
     }
     else
     {
         possibleMatch = null;
     }
 }
 public SingleCardUsageVerifier(CardMatcher m, bool isUseCard, CardHandler handler = null)
 {
     Match = m;
     if (handler != null)
     {
         possibleMatch = new List<CardHandler>();
         possibleMatch.Add(handler);
     }
     else
     {
         possibleMatch = null;
     }
     this.isUseCard = isUseCard;
 }
Example #8
0
 public ReadOnlyCard(ICard card)
 {
     type = card.Type;
     place = card.Place;
     rank = card.Rank;
     suit = card.Suit;
     owner = card.Owner;
     suitColor = card.SuitColor;
     if (card.Attributes == null)
     {
         attributes = new Dictionary<CardAttribute, int>();
     }
     else
     {
         attributes = new Dictionary<CardAttribute, int>(card.Attributes);
     }
 }
Example #9
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);
     }
 }
Example #10
0
 public CardWrapper(Player p, CardHandler h, bool Notify = true)
 {
     Owner = p;
     handler = h;
     withoutNotify = !Notify;
 }
Example #11
0
 public static void TranslateCardType(ref Type type, ref String horse, CardHandler handler)
 {
     if (handler is RoleCardHandler || handler is Heroes.HeroCardHandler || handler == null)
     {
         type = null;
         horse = null;
         return;
     }
     type = handler.GetType();
     if (handler is OffensiveHorse || handler is DefensiveHorse) horse = handler.CardType;
     else horse = null;
 }
Example #12
0
 public CardWrapper(Player p, CardHandler h)
 {
     Owner = p;
     handler = h;
 }
Example #13
0
 public QiaoShuiVerifier(List<Player> p, ICard c, CardHandler handler)
 {
     existingCard = c;
     existingTargets = p;
     this.handler = handler;
     MaxCards = 0;
     MinCards = 0;
     MaxPlayers = 1;
     MinPlayers = 1;
 }
 public static CardCategory BaseCategory(this CardHandler cardType)
 {
     return(BaseCategoryOf(cardType.Category));
 }
Example #15
0
 public static int Serialize(CardHandler handler)
 {
     return idOfCardHandler[handler.Name];
 }
Example #16
0
        public static void EncodeCardHandler(CardHandler handler, out string typeName, out string horse)
        {
            if (handler is RoleCardHandler || handler is Heroes.HeroCardHandler || handler == null)
            {
                typeName = string.Empty;
                horse = string.Empty;
                return;
            }

            typeName = handler.GetType().AssemblyQualifiedName;

            if (handler is OffensiveHorse || handler is DefensiveHorse) horse = handler.CardType;
            else horse = string.Empty;
        }
Example #17
0
File: Card.cs Project: h1398123/sgs
 public void CopyFrom(Card c)
 {
     Suit = c.Suit;
     Rank = c.Rank;
     Type = (CardHandler)c.Type.Clone();
     Trace.Assert(Type != null);
     RevealOnce = false;
     Place = c.Place;
     Id = c.Id;
     Attributes = c.Attributes;
 }
Example #18
0
 public static string Translate(CardHandler cardHandler)
 {
     if (cardHandler == null) return string.Empty;
     string key = string.Format("Card.{0}.Name", cardHandler.Name);
     string name = Application.Current.TryFindResource(key) as string;
     if (name == null) return string.Empty;
     return name;
 }
Example #19
0
File: Card.cs Project: pxoylngx/sgs
 public void CopyFrom(Card c)
 {
     Suit = c.Suit;
     Rank = c.Rank;
     Type = c.Type;
     RevealOnce = false;
     Place = c.Place;
     Id = c.Id;
     Attributes = c.Attributes;
 }
 public static bool IsCardCategory(this CardHandler cardType, CardCategory belongsTo)
 {
     return(IsCardCategory(cardType.Category, belongsTo));
 }