Exemple #1
0
        public ItemCard(JToken creature)
        {
            // Assign values
            Name        = (string)creature["Title"];
            Image       = (string)creature["Image"];
            Description = Util.WikiDecode((string)creature["Description"]);
            Ability     = AbilityCard.GetByName((string)creature["Ability"], out AbilityCard ability) ? ability : null;
            Cost        = Int32.TryParse((string)creature["Cost"], out int cost) ? cost : 0;

            // Convert category into enum
            switch (((string)creature["Category"]).ToLower())
            {
            case "weapon":
                Category = ItemCategory.Weapon;
                break;

            case "armor":
                Category = ItemCategory.Armor;
                break;

            case "accessory":
                Category = ItemCategory.Accessory;
                break;

            case "consumable":
                Category = ItemCategory.Consumable;
                break;

            default:
                Category = ItemCategory.None;
                break;
            }
        }
Exemple #2
0
        public static bool GetByName(string name, out AbilityCard result)
        {
            bool exists = List.SearchCard(name, out AbilityCard _result);

            result = _result;
            return(exists);
        }
Exemple #3
0
 public HeroCard(JToken hero)
 {
     Name    = (string)hero["Title"];
     Color   = ((string)hero["Color"]).ToLower();
     Icon    = (string)hero["Icon"];
     Image   = (string)hero["Image"];
     Ability = AbilityCard.GetByName((string)hero["Ability"], out AbilityCard ability) ? ability : null;
     Attack  = Int32.TryParse((string)hero["Attack"], out int attack) ? attack : 0;
     Armor   = Int32.TryParse((string)hero["Armor"], out int armor) ? armor : 0;
     Health  = Int32.TryParse((string)hero["Health"], out int health) ? health : 0;
 }
Exemple #4
0
 public CreatureCard(JToken creature)
 {
     Name        = (string)creature["Title"];
     Color       = ((string)creature["Color"]).ToLower();
     Image       = (string)creature["Image"];
     Hero        = HeroCard.GetByName((string)creature["Hero"], out HeroCard hero) ? hero : null;
     Ability     = AbilityCard.GetByName((string)creature["Ability"], out AbilityCard ability) ? ability : null;
     Attack      = Int32.TryParse((string)creature["Attack"], out int attack) ? attack : 0;
     Armor       = Int32.TryParse((string)creature["Armor"], out int armor) ? armor : 0;
     Health      = Int32.TryParse((string)creature["Health"], out int health) ? health : 0;
     Description = Util.WikiDecode((string)creature["Description"]);
 }
Exemple #5
0
        public ImprovementCard(JToken improvement)
        {
            Name        = (string)improvement["Title"];
            Color       = ((string)improvement["Color"]).ToLower();
            Mana        = Int32.TryParse((string)improvement["Mana"], out int mana) ? mana : 0;
            Image       = (string)improvement["Image"];
            Icon        = (string)improvement["Icon"];
            Hero        = HeroCard.GetByName((string)improvement["Hero"], out HeroCard hero) ? hero : null;
            Description = Util.WikiDecode((string)improvement["Description"]);
            Ability     = AbilityCard.GetByName((string)improvement["Ability"], out AbilityCard ability) ? ability : null;

            switch (((string)improvement["Lane"]).ToLower())
            {
            case "any":
                Lane = LaneType.Any;
                break;

            default:
                Lane = LaneType.Single;
                break;
            }
        }