Exemplo n.º 1
0
        private void NewButton_Click(object sender, RoutedEventArgs e)
        {
            var newDeck = new ArchetypeDeck();

            newDeck.Name = "New Deck";
            _viewModel.Decks.Add(newDeck);
        }
Exemplo n.º 2
0
        public void DisplayName_Equals_Name_IfStandardDeck()
        {
            var deck = new ArchetypeDeck(new Deck(Guid.NewGuid(), "Test", false, "Druid", true));

            Assert.AreEqual($"Test", deck.DisplayName);
            deck.Name = "Renamed";
            Assert.AreEqual($"Renamed", deck.DisplayName);
        }
Exemplo n.º 3
0
        public void DisplayName_Includes_Wild_IfWildOnlyDeck()
        {
            var deck = new ArchetypeDeck("Test", PlayerClass.DRUID, false);

            Assert.AreEqual($"Test ({Strings.MetaWild})", deck.DisplayName);
            deck.Name = "Renamed";
            Assert.AreEqual($"Renamed ({Strings.MetaWild})", deck.DisplayName);
        }
Exemplo n.º 4
0
        public void DefaultConstructorHasDefaultProps()
        {
            var deck = new ArchetypeDeck();

            Assert.IsNull(deck.Name);
            Assert.IsNull(deck.Style);
            Assert.AreEqual(PlayerClass.ANY, deck.Klass);
            Assert.AreEqual(GameFormat.ANY, deck.Format);
            Assert.IsTrue(deck.Cards.Count == 0);
        }
Exemplo n.º 5
0
        internal static ArchetypeDeck CreateDeck(string name, Klass klass, bool standard, string str)
        {
            var deck = new ArchetypeDeck();

            deck.Name       = name;
            deck.Klass      = klass;
            deck.IsStandard = standard;
            deck.Cards      = CreateCards(str);
            return(deck);
        }
Exemplo n.º 6
0
        public void Similarity_Of_NonEmpty_With_Empty_Is_Zero()
        {
            var deck = new ArchetypeDeck();

            deck.Cards = new List <Card>()
            {
                new Card("A", "card", 1, null)
            };
            Assert.AreEqual(0, deck.Similarity(new ArchetypeDeck()));
        }
Exemplo n.º 7
0
        private void DeckList_SelectionChanged(object sender, RoutedEventArgs e)
        {
            ListBox box = sender as ListBox;

            if (box != null)
            {
                SelectedDeck = _viewModel.GetDeck(box.SelectedItem);
            }

            RaiseDeckSelectEvent();
        }
Exemplo n.º 8
0
        public ArchetypeDeckViewModel(ArchetypeDeck deck)
        {
            _deck = deck;

            _cards = new ObservableCollection <HDTCard>(_deck.Cards.Select(x => new HDTCard(HearthDb.Cards.Collectible[x.Id])));

            _culture = new CultureInfo(Config.Instance.SelectedLanguage.Insert(2, "-"));

            _viableCards = new List <HDTCard>();
            UpdateViableList();
        }
Exemplo n.º 9
0
        public void TestToNoteString()
        {
            var deck = new ArchetypeDeck(
                "Control Warrior",
                PlayerClass.WARRIOR,
                GameFormat.STANDARD,
                ArchetypeStyles.CONTROL,
                new List <Card>()
                );

            Assert.AreEqual("Control Warrior : WARRIOR.CONTROL", deck.ToNoteString());
        }
Exemplo n.º 10
0
        public ArchetypeDeck GetDeck(object obj)
        {
            if (obj == null)
            {
                return(null);
            }

            ArchetypeDeck d = obj as ArchetypeDeck;

            if (d == null)
            {
                return(null);
            }

            return(Decks.FirstOrDefault(x => x.Id == d.Id));
        }
Exemplo n.º 11
0
        public void ParamConstructorAssignsProps()
        {
            var deck = new ArchetypeDeck(
                "Control Warrior",
                PlayerClass.WARRIOR,
                GameFormat.STANDARD,
                ArchetypeStyles.CONTROL,
                new List <Card>()
                );

            Assert.AreEqual("Control Warrior", deck.Name);
            Assert.AreEqual(ArchetypeStyles.CONTROL, deck.Style);
            Assert.AreEqual(PlayerClass.WARRIOR, deck.Klass);
            Assert.AreEqual(GameFormat.STANDARD, deck.Format);
            Assert.IsTrue(deck.Cards.Count == 0);
        }
Exemplo n.º 12
0
        public List <ArchetypeDeck> GetAllArchetypeDecks()
        {
            var decks = DeckList.Instance.Decks
                        .Where(d => d.TagList.ToLowerInvariant().Contains("archetype"))
                        .ToList();
            var archetypes = new List <ArchetypeDeck>();

            foreach (var d in decks)
            {
                // get the newest version of the deck
                var v = d.VersionsIncludingSelf.OrderByDescending(x => x).FirstOrDefault();
                d.SelectVersion(v);
                if (d == null)
                {
                    continue;
                }
                var ad = new ArchetypeDeck(d.Name, KlassKonverter.FromString(d.Class), d.StandardViable);
                ad.Cards = d.Cards
                           .Select(x => new Models.Card(x.Id, x.LocalizedName, x.Count, x.Background.Clone()))
                           .ToList();
                archetypes.Add(ad);
            }
            return(archetypes);
        }
Exemplo n.º 13
0
        public void Similarity_Of_NonEmpty_With_Empty_Is_One()
        {
            var deck = new ArchetypeDeck();

            Assert.AreEqual(1, deck.Similarity(new ArchetypeDeck()));
        }
Exemplo n.º 14
0
        public void Similarity_With_Null_Returns_Zero()
        {
            var deck = new ArchetypeDeck();

            Assert.AreEqual(0, deck.Similarity(null));
        }