Exemplo n.º 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());
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
    public void Load(StreamReader file, CardLoader loader, Player p)
    {
        string line;

        while ((line = file.ReadLine()) != null)
        {
            string[] data = line.Split(',');
            for (int i = 0; i < int.Parse(data[1]); ++i)
            {
                Card c = loader.Load(data[0], p);
                if (c != null)
                {
                    cards.Add(c);
                }
                /**/ else
                {
                    Debug.Log("Card " + data[0] + " failed to load to deck.");
                }
            }
            /**/ Debug.Log(cards[cards.Count - 1].Name + " added to deck");
        }
    }
Exemplo n.º 4
0
 public SpawnerCard(XmlNode xml, Player p) :
     base(xml, p)
 {
     this.ability = loader.Load(xml.Attributes["ability"].Value, p) as CharacterCard;
 }
Exemplo n.º 5
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
        }