public void EncodeWeaponCardTest()
        {
            var encoder = new MtgEncodeFormatEncoder();

            var output         = encoder.EncodeCard(testWeapon);
            var expectedOutput =
                "|3weapon|4warrior|6common|7&^^^^|8&^^^^|9&^^|2$DR$: deal &^ damage to all minions.|1death's bite|";

            Assert.AreEqual(expectedOutput, output);
        }
        public void EncodeMinionCardTest()
        {
            var encoder = new MtgEncodeFormatEncoder();

            var output         = encoder.EncodeCard(testMinion);
            var expectedOutput =
                "|3minion|4paladin|5none|6legendary|7&^^^^^^^^|8&^^^^^^|9&^^^^^^|2$DV$. $T$. $DR$: equip a &^^^^^/&^^^ ashbringer.|1tirion fordring|";

            Assert.AreEqual(expectedOutput, output);
        }
        public void EncodeSpellCardTest()
        {
            var encoder = new MtgEncodeFormatEncoder();

            var output         = encoder.EncodeCard(testSpell);
            var expectedOutput =
                "|3spell|4mage|6common|7&^^^^|2deal $&^^^^^^ damage.|1fireball|";

            Assert.AreEqual(expectedOutput, output);
        }
Example #4
0
        public void ThreadEntry()
        {
            _encoder.IncludeFlavorText = IncludeFlavorText;

            do
            {
                _cardCollection.Cards.Shuffle();

                foreach (var card in _cardCollection.Cards)
                {
                    if (!(card.Type == "MINION" || card.Type == "SPELL" || card.Type == "WEAPON"))
                    {
                        //Console.WriteLine(card.Type);
                        continue;
                    }

                    //See if names should be replaced, roll dice, replace name.
                    if (card.Type != "HERO" && NameReplacement && NameCollection.ReplaceName())
                    {
                        string newName;
                        try
                        {
                            newName = NameCollection.RandomName(card.CardClass, card.Type);
                        }
                        catch (Exception e)
                        {
                            _consoleLog.VerboseWriteLine($"Error trying to find a new card name for {card.Name}[{card.CardClass}-{card.Type}]: {e.Message}");
                            newName = "None";
                        }

                        if (newName != "None")
                        {
                            card.Name = newName;
                        }
                    }

                    var outputLine = _encoder.EncodeCard(card);

                    if (string.IsNullOrWhiteSpace(outputLine))
                    {
                        continue;
                    }

                    if (ShuffleFields)
                    {
                        outputLine = ShuffleCardFields(outputLine);
                    }

                    _stream.Write(outputLine + "\n\n");
                }
            } while (LoopForever);


            _stream.Close();
        }