Ejemplo n.º 1
0
 public Deck(DeckType type, HearthDb.Deckstrings.Deck deck)
 {
     Type   = type;
     Name   = deck.Name;
     DeckId = deck.DeckId;
     Cards  = CardSorting.Sort(deck.GetCards().Select(card => new Card(card.Key, card.Value)));
     Class  = deck.GetHero().Class;
 }
Ejemplo n.º 2
0
        public PlayedDeck(string InputDeck)
        {
            HearthDb.Deckstrings.Deck       deck   = HearthDb.Deckstrings.DeckSerializer.Deserialize(InputDeck);
            Dictionary <HearthDb.Card, int> DbDeck = deck.GetCards();
            var pEnum = DbDeck.GetEnumerator();

            for (; pEnum.MoveNext();)
            {
                m_Cards.Add(new Hearthstone_Deck_Tracker.Hearthstone.Card(pEnum.Current.Key), pEnum.Current.Value);
            }
            m_Class = deck.GetHero().Class;
        }
        public static Deck FromHearthDbDeck(HearthDb.Deckstrings.Deck hDbDeck)
        {
            var deck = new Deck
            {
                Name  = hDbDeck.Name,
                Class = Database.GetCardFromDbfId(hDbDeck.HeroDbfId, false).PlayerClass
            };

            foreach (var c in hDbDeck.GetCards())
            {
                deck.Cards.Add(new Card(c.Key)
                {
                    Count = c.Value
                });
            }
            return(deck);
        }
Ejemplo n.º 4
0
        public void TestPlayAllDeck()
        {
            //создаем деку и разыгрывает карты из нее
            //в итоге не должно остаться карт в после разыгрывания деки

            HearthDb.Deckstrings.Deck deck = HearthDb.Deckstrings.DeckSerializer.Deserialize("AAECAf0ECvsMoM4Cws4Cm9MCnOICo+sCpvACt/ECw/gCxvgCCk3JA+wHm8IC08UClscCm8sC1+ECluQC4vgCAA==");
            GameAnalyzer gameAnalyzer      = new GameAnalyzer();
            var          pEnum             = deck.GetCards().GetEnumerator();
            Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int> FindDeck = new Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int>();

            gameAnalyzer.OnGameStart();
            for (int i = 0; pEnum.MoveNext(); i++)
            {
                for (int cardNo = 0; cardNo < pEnum.Current.Value; cardNo++) //карта в 2х экземплярах
                {
                    gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(pEnum.Current.Key));
                }
                gameAnalyzer.GetBestDeck().CopyToDict(FindDeck, true);
            }
            Assert.AreEqual(FindDeck.Count, 0);
        }
Ejemplo n.º 5
0
        static void TestDeck()
        {
            HearthDb.Deckstrings.Deck deck = HearthDb.Deckstrings.DeckSerializer.Deserialize("AAECAf0ECvsMoM4Cws4Cm9MCnOICo+sCpvACt/ECw/gCxvgCCk3JA+wHm8IC08UClscCm8sC1+ECluQC4vgCAA==");
            GameAnalyzer gameAnalyzer      = new GameAnalyzer();
            var          pEnum             = deck.GetCards().GetEnumerator();
            Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int> FindDeck = new Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int>();

            gameAnalyzer.OnGameStart();
            for (int i = 0; pEnum.MoveNext(); i++)
            {
                for (int cardNo = 0; cardNo < pEnum.Current.Value; cardNo++)
                {
                    gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(pEnum.Current.Key));
                }
                gameAnalyzer.GetBestDeck().CopyToDict(FindDeck, true);
                if (i > 10)
                {
                    break;
                }
            }
            gameAnalyzer.OnGameEnd();
            //gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(HearthDb.Cards.Collectible[HearthDb.CardIds.Collectible.Druid.AddledGrizzly]));
            //FindDeck = gameAnalyzer.GetBestDeck();
        }