Example #1
0
        static Cards()
        {
            // Fetch all cards.
            var cardLoader = new CardLoader();

            Card[] cards = cardLoader.Load();

            //string json = File.ReadAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardData.json");
            //string json = File.ReadAllText(Environment.CurrentDirectory + @"\cardData.json");
            //var cards = JsonConvert.DeserializeObject<IEnumerable<Card>>(Resources.cardDataJson);
            //File.WriteAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardDataJson.txt", JsonConvert.SerializeObject(cards, Formatting.Indented));
            // Set as card definitions

            Data = new CardContainer();
            Data.Load(cards);

            //Log.Debug("Standard:");
            //Enum.GetValues(typeof(CardClass)).Cast<CardClass>().ToList().ForEach(heroClass =>
            for (int i = 0; i < HeroClasses.Length; i++)
            {
                CardClass heroClass = HeroClasses[i];
                Standard.Add(heroClass, All.Where(c =>
                                                  c.Collectible &&
                                                  (c.Class == heroClass ||
                                                   c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                                   c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER ||
                                                                              c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                                   c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID ||
                                                                              c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                                   c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE ||
                                                                              c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                                  c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly());
                //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards.");
                //});
            }

            //Log.Debug("AllStandard:");
            AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly();

            //Log.Debug("Wild:");
            Enum.GetValues(typeof(CardClass)).Cast <CardClass>().ToList().ForEach(heroClass =>
            {
                Wild.Add(heroClass, All.Where(c =>
                                              c.Collectible &&
                                              (c.Class == heroClass ||
                                               c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                               c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                               c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                               c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                              c.Type != CardType.HERO).ToList().AsReadOnly());
                //Log.Debug($"-> [{heroClass}] - {Wild[heroClass].Count} cards.");
            });

            //Log.Debug("AllWild:");
            AllWild = All.Where(c => c.Collectible && c.Type != CardType.HERO).ToList().AsReadOnly();

            StandardCostMinionCards = AllStandard.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList());
            WildCostMinionCards     = AllWild.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList());
        }
Example #2
0
        static Cards()
        {
            var cardLoader = new CardLoader();
            var cards      = cardLoader.Load();

            //string json = File.ReadAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardData.json");
            //string json = File.ReadAllText(Environment.CurrentDirectory + @"\cardData.json");
            //var cards = JsonConvert.DeserializeObject<IEnumerable<Card>>(Resources.cardDataJson);
            //File.WriteAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardDataJson.txt", JsonConvert.SerializeObject(cards, Formatting.Indented));
            // Set as card definitions

            Data = new CardDefinitions();
            Data.Load(cards);

            //Log.Info($"Loaded {All.Count()} cards.");

            // Wild
            //Log.Debug("Wild:");
            foreach (var heroClass in Enum.GetValues(typeof(CardClass)).Cast <CardClass>())
            {
                Wild.Add(heroClass, All.Where(c =>
                                              c.Collectible &&
                                              (c.Class == heroClass ||
                                               c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                               c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                               c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                               c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                              c.Type != CardType.HERO).ToList());
                //Log.Debug($"-> [{heroClass}] - {Wild[heroClass].Count} cards.");
            }

            //Log.Debug("Standard:");
            foreach (var heroClass in Enum.GetValues(typeof(CardClass)).Cast <CardClass>())
            {
                Standard.Add(heroClass, All.Where(c =>
                                                  c.Collectible &&
                                                  (c.Class == heroClass ||
                                                   c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                                   c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                                   c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                                   c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                                  c.Type != CardType.HERO && StandardSets.Contains(c.Set)
                                                  ).ToList());
                //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards.");
            }

            //Log.Debug("AllStandard:");
            AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList();

            //Log.Debug("AllWild:");
            AllWild = All.Where(c => c.Collectible && c.Type != CardType.HERO).ToList();
        }
Example #3
0
        static Cards()
        {
            // Load cards for selected game
            var gameNamespace = "Brimstone.Games." + Settings.Game;
            var cardLoader    = Activator.CreateInstance(Type.GetType(gameNamespace + ".CardLoader")) as ICardLoader;
            var cards         = cardLoader.Load();

            // Set as card definitions
            data = new CardDefinitions();
            data.Load(cards, gameNamespace);

            // Common sets
            // TODO: Add Standard sets
            foreach (var heroClass in Enum.GetValues(typeof(HeroClass)).Cast <HeroClass>())
            {
                Wild.Add(heroClass, All.Where(
                             c => c.Collectible && (c.Class == (CardClass)heroClass || c.Class == CardClass.NEUTRAL) && c.Type != CardType.HERO).ToList());
            }
        }
Example #4
0
        static Cards()
        {
            // Fetch all cards.
            var cardLoader = new CardLoader();

            Card[] cards = cardLoader.Load();

            //string json = File.ReadAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardData.json");
            //string json = File.ReadAllText(Environment.CurrentDirectory + @"\cardData.json");
            //var cards = JsonConvert.DeserializeObject<IEnumerable<Card>>(Resources.cardDataJson);
            //File.WriteAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardDataJson.txt", JsonConvert.SerializeObject(cards, Formatting.Indented));
            // Set as card definitions

            Data = new CardContainer();
            Data.Load(cards);

            //Log.Debug("Standard:");
            //Enum.GetValues(typeof(CardClass)).Cast<CardClass>().ToList().ForEach(heroClass =>
            for (int i = 0; i < HeroClasses.Length; i++)
            {
                CardClass heroClass = HeroClasses[i];
                Standard.Add(heroClass, All.Where(c =>
                                                  c.Collectible &&
                                                  (c.Class == heroClass ||
                                                   c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                                   c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER ||
                                                                              c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                                   c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID ||
                                                                              c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                                   c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE ||
                                                                              c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                                  c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly());
                //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards.");
                //});
            }

            //Log.Debug("AllStandard:");
            AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly();

            //Log.Debug("Wild:");
            Enum.GetValues(typeof(CardClass)).Cast <CardClass>().ToList().ForEach(heroClass =>
            {
                Wild.Add(heroClass, All.Where(c =>
                                              c.Collectible &&
                                              (c.Class == heroClass ||
                                               c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                               c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                               c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                               c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                              c.Type != CardType.HERO).ToList().AsReadOnly());
                //Log.Debug($"-> [{heroClass}] - {Wild[heroClass].Count} cards.");
            });

            //Log.Debug("AllWild:");
            AllWild = All.Where(c => c.Collectible && c.Type != CardType.HERO).ToList().AsReadOnly();

            StandardCostMinionCards = AllStandard.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList());
            WildCostMinionCards     = AllWild.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList());

            // Temporary fix for Lotus Assassin
            Data.Cards["CFM_634"].Stealth = true;
            Data.Cards["CFM_634"].Tags.Add(GameTag.STEALTH, 1);

            // Basic Totems
            BasicTotems = new[]
            {
                FromId("NEW1_009"),                     // Healing Totem
                FromId("CS2_050"),                      // Searing Totem
                FromId("CS2_051"),                      // Stoneclaw Totem
                FromId("CS2_052")                       // Wraith of Air Totem
            };

            // filtered out cards ... cosmetic purpose
            Data.Cards.Remove("HERO_01c");             // HERO Deathwing
        }