Esempio n. 1
0
        public YgoCard Clone()
        {
            YgoCard clone = new YgoCard()
            {
                Name           = this.Name,
                ATK            = this.ATK,
                DEF            = this.DEF,
                Frame          = this.Frame,
                Attribute      = this.Attribute,
                Level          = this.Level,
                Creator        = this.Creator,
                Rarity         = this.Rarity,
                Type           = this.Type,
                Sticker        = this.Sticker,
                ArtworkByte    = this.ArtworkByte,
                Set            = this.Set,
                ScaleLeft      = this.ScaleLeft,
                ScaleRight     = this.ScaleRight,
                Description    = this.Description,
                Edition        = this.Edition,
                IsPendulum     = this.IsPendulum,
                Number         = this.Number,
                PendulumEffect = this.PendulumEffect,
                Property       = this.Property,
                Rank           = this.Rank
            };

            foreach (ABILITY ability in this.Abilities)
            {
                clone.Abilities.Add(ability);
            }
            return(clone);
        }
Esempio n. 2
0
 /// <summary>
 /// Check the card whether it is Spell/Trap, or not
 /// </summary>
 /// <param name="card"></param>
 /// <returns></returns>
 public static bool IsMagic(this YgoCard card)
 {
     if (card != null)
     {
         if (card.Frame == FRAME.Spell && card.Attribute == ATTRIBUTE.SPELL)
         {
             return(true);
         }
         if (card.Frame == FRAME.Trap && card.Attribute == ATTRIBUTE.TRAP)
         {
             return(true);
         }
     }
     //if (card.Attribute == ATTRIBUTE.UNKNOWN) { return false; }
     return(false);
 }
Esempio n. 3
0
 /// <summary>
 /// Check the card whether it is Monster or not
 /// </summary>
 /// <param name="card"></param>
 /// <returns></returns>
 public static bool IsMonster(this YgoCard card)
 {
     return(card != null && !card.IsMagic());
 }
Esempio n. 4
0
 /// <summary>
 /// Check the card whether it is this Frame or not
 /// </summary>
 /// <param name="card"></param>
 /// <param name="frame"></param>
 /// <returns></returns>
 public static bool IsFrame(this YgoCard card, FRAME frame)
 {
     return(frame == card.Frame);
 }
Esempio n. 5
0
        /// <summary>
        /// Save the card data to "fileName" path (with extension)
        /// </summary>
        /// <param name="card"></param>
        /// <param name="fileName"></param>
        public static void SaveTo(this YgoCard card, string fileName)
        {
            string data = JsonConvert.SerializeObject(card, Formatting.Indented);

            File.WriteAllText(fileName, data);
        }