예제 #1
0
        public static IEnumerable <CardDefinition> ParseSection(string s)
        {
            var list = new List <CardDefinition>();

            foreach (Match match in cardRegex.Matches(s))
            {
                int count = match.Groups["count"].Success ? int.Parse(match.Groups["count"].Value) : 1;
                var name  = match.Groups["name"].Value.Trim();
                if (name == string.Empty)
                {
                    continue;
                }
                var cardDef = CardDefinition.Get(name);
                if (list.Contains(cardDef))
                {
                    throw new FormatException(string.Format("{0} listed on multiple lines.", cardDef));
                }
                list.AddRange(Enumerable.Repeat(cardDef, count));
            }
            return(list);
        }
예제 #2
0
 public static int DisplayIndex(this CardDefinition a)
 {
     return(a.Types.Select(t => _formatOrder.IndexOf(t)).Min());
 }
예제 #3
0
 public static int DisplayCompare(this CardDefinition a, CardDefinition b)
 {
     return(a.DisplayIndex().CompareTo(b.DisplayIndex()));
 }
예제 #4
0
 public Card(Player owner, CardDefinition definition)
 {
     this.Owner      = owner;
     this.Definition = definition;
     this.FaceDown   = false;
 }