예제 #1
0
        public override Card GetCard(Player owner)
        {
            var card = new Card(owner, new[] { CardType.Enchantment }, new[] { "Aura" }, false);

            card._attrs = MtgCard;

            card.Cost = ManaCost.Parse(card, "{1}{B}");

            // TODO: Enchant creature card in a graveyard

            // When Animate Dead enters the battlefield, if it’s on the battlefield, it loses “enchant creature card in a graveyard” and
            // gains “enchant creature put onto the battlefield with Animate Dead.” Return enchanted creature card to the battlefield
            // under your control and attach Animate Dead to it. When Animate Dead leaves the battlefield, that creature’s controller
            // sacrifices it.

            // Enchanted creature gets - 1 / -0.

            card.OnCast = (g, c) =>
            {
                var target = c.Controller.ChooseTarget(c, new List <ITarget>(c.Controller.Graveyard.Where(_c => _c.IsACreature && _c.CanBeTargetedBy(c)))) as Card;
                c.SetVar("Target", target);
                c.AddEffect(new AnimateDeadEffect(c, target));
            };

            card.OnResolve = (g, c) =>
            {
                var target = c.GetVar <Card>("Target");
                // TODO: Move creature card from graveyard to battlefield
            };

            return(card);
        }
예제 #2
0
        public void OneVariableTest()
        {
            var mc = ManaCost.Parse("{X}");

            Assert.AreEqual(1, mc.Fragments.Count);
            Assert.AreEqual(typeof(VariableManaCostFragment), mc.Fragments[0].GetType());
        }
예제 #3
0
        public void ManaCost_FiveColors_InconsistentBraces()         // Progenitus
        {
            ManaCost mc = ManaCost.Parse("WWUU{B}BR{R}{G}G");

            Assert.AreEqual(mc.ConvertedManaCost, 10);
            Assert.AreEqual("WWUUBBRRGG", mc.ToString());
        }
예제 #4
0
        public void ManaCost_PhyrexianGreenWithX()         // Corrosive Gale
        {
            ManaCost mc = ManaCost.Parse("X{GP}");

            Assert.AreEqual(mc.ConvertedManaCost, 1);
            Assert.AreEqual("X{P/G}", mc.ToString());
        }
예제 #5
0
        public void ManaCost_TwoGenericOrColored()
        {
            ManaCost mc = ManaCost.Parse("{2/W}{2/U}{2/B}{2/R}{2/G}");

            Assert.AreEqual(mc.ConvertedManaCost, 10);
            Assert.AreEqual("{2/W}{2/U}{2/B}{2/R}{2/G}", mc.ToString());
        }
예제 #6
0
        public void ManaCost_HybridGW()         // Dawnglow Infusion
        {
            ManaCost mc = ManaCost.Parse("{X}{G/W}");

            Assert.AreEqual(mc.ConvertedManaCost, 1);
            Assert.AreEqual("{X}{G/W}", mc.ToString(true));
        }
예제 #7
0
        public void ManaCost_GenericTwelve()
        {
            ManaCost mc = ManaCost.Parse("{12}");

            Assert.AreEqual(mc.ConvertedManaCost, 12);
            Assert.AreEqual("12", mc.ToString());
        }
예제 #8
0
        public void ManaCost_XUU_NoBrackets()
        {
            ManaCost mc = ManaCost.Parse("{X}{U}{U}");

            Assert.AreEqual(mc.ConvertedManaCost, 2);
            Assert.AreEqual("XUU", mc.ToString());
        }
예제 #9
0
        public void ManaCost_1W()
        {
            ManaCost mc = ManaCost.Parse("{1}{W}");

            Assert.AreEqual(mc.ConvertedManaCost, 2);
            Assert.AreEqual("1W", mc.ToString());
        }
예제 #10
0
        public void ManaCost_Zero()
        {
            ManaCost mc = ManaCost.Parse("{0}");

            Assert.AreEqual(0, mc.ConvertedManaCost);
            Assert.AreEqual("0", mc.ToString());
        }
예제 #11
0
        public void ManaCost_Colorless_Generic()         // Kozilek, the Great Distortion
        {
            ManaCost mc = ManaCost.Parse("8CC");

            Assert.AreEqual(mc.ConvertedManaCost, 10);
            Assert.AreEqual("{8}{C}{C}", mc.ToString(true));
        }
예제 #12
0
        public void ManaCost_NoCost()
        {
            ManaCost mc = ManaCost.Parse("");

            Assert.IsTrue(mc.HasNoCost);
            Assert.AreEqual("(no cost)", mc.ToString());
        }
예제 #13
0
        public override Card GetCard(Player owner)
        {
            Func <Game, Card, int> basePowerFunc = (g, c) =>
            {
                var cardTypes = new List <CardType>();
                foreach (var graveyard in g.Players().Select(p => p.Graveyard))
                {
                    foreach (var c2 in graveyard)
                    {
                        foreach (var cardType in c2.Types)
                        {
                            if (!cardTypes.Contains(cardType))
                            {
                                cardTypes.Add(cardType);
                            }
                        }
                    }
                }
                return(cardTypes.Count);
            };

            Func <Game, Card, int> baseToughnessFunc = (g, c) =>
            {
                return(1 + c.BasePowerFunc(g, c));
            };

            var card = new Card(owner, new[] { CardType.Creature }, new[] { "Lhurgoyf" }, false, basePowerFunc, baseToughnessFunc, false, false);

            card._attrs = MtgCardAttribute.GetAttribute(GetType());

            card.Cost = ManaCost.Parse(card, "{1}{G}");

            return(card);
        }
예제 #14
0
        public override Card GetCard(Player owner)
        {
            var card = new Card(owner, new[] { CardType.Sorcery }, null, false);

            card._attrs = MtgCardAttribute.GetAttribute(GetType());
            card.Cost   = ManaCost.Parse(card, "{X}{U}{U}");

            // This must be a new delegate every time. Otherwise we mess up the card reference.
            (card.Cost as ManaCost).ValueforXChosen += (x => card.SetVar("X", x));

            card.OnCast = (g, c) =>
            {
                var target = c.Controller.ChoosePlayer("Choose Target Player", g.Players().Where(p => true));// p.CanBeTargetedBy(c)))
                c.SetVar("Target", target);
            };

            card.OnResolve = (g, c) =>
            {
                var target = c.GetVar <Player>("Target");
                var X      = c.GetVar <int>("X");
                target.Draw(X);
            };

            return(card);
        }
예제 #15
0
        public void ManaCost_GenericTen()
        {
            ManaCost mc = ManaCost.Parse("10");

            Assert.IsFalse(mc.HasNoCost);
            Assert.AreEqual(mc.ConvertedManaCost, 10);
            Assert.AreEqual("{10}", mc.ToString(true));
        }
예제 #16
0
        public override Card GetCard(Player owner)
        {
            var card = new Card(owner, new CardType[] { CardType.Creature }, new string[] { "Elemental" }, false, 8, 8, false, false);

            card._attrs = MtgCardAttribute.GetAttribute(GetType());
            card.Cost   = ManaCost.Parse(card, "{W}{U}{B}{R}{G}");

            return(card);
        }
예제 #17
0
        public void SpectralProcessionTest()
        {
            var mc = ManaCost.Parse("{2/W}{2/W}{2/W}");

            Assert.AreEqual(1, mc.Fragments.Count);
            Assert.AreEqual(1, mc.Fragments.OfType <MonoColoredManaCostFragment>().Count());
            Assert.AreEqual(3, mc.Fragments.OfType <MonoColoredManaCostFragment>().First().Amount);
            Assert.AreEqual(Color.White, mc.Fragments.OfType <MonoColoredManaCostFragment>().First().Color);
        }
예제 #18
0
        public void TerminateTest()
        {
            var mc = ManaCost.Parse("{B}{R}");

            Assert.AreEqual(2, mc.Fragments.Count);
            Assert.AreEqual(2, mc.Fragments.OfType <ColoredManaCostFragment>().Count());
            Assert.AreEqual(1, mc.Fragments.OfType <ColoredManaCostFragment>().Where(f => f.Color == Color.Black).First().Amount);
            Assert.AreEqual(1, mc.Fragments.OfType <ColoredManaCostFragment>().Where(f => f.Color == Color.Red).First().Amount);
        }
예제 #19
0
 public void OneGenericTest()
 {
     for (int i = 0; i < 20; i++)
     {
         var mc = ManaCost.Parse("{" + i + "}");
         Assert.AreEqual(1, mc.Fragments.Count);
         Assert.AreEqual(typeof(GenericManaCostFragment), mc.Fragments[0].GetType());
         Assert.AreEqual(i, (mc.Fragments[0] as GenericManaCostFragment).Amount);
     }
 }
예제 #20
0
        public void ScryingSheetsTest()
        {
            var mc = ManaCost.Parse("{1}{S}");

            Assert.AreEqual(2, mc.Fragments.Count);
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().Count());
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().First().Amount);
            Assert.AreEqual(1, mc.Fragments.OfType <SnowColoredManaCostFragment>().Count());
            Assert.AreEqual(1, mc.Fragments.OfType <SnowColoredManaCostFragment>().First().Amount);
        }
예제 #21
0
        public override Card GetCard(Player owner)
        {
            var card = new Card(owner, new[] { CardType.Creature }, new[] { "Dinosaur" }, false, 10, 10, false, false);

            card._attrs = MtgCardAttribute.GetAttribute(GetType());

            card.Cost = ManaCost.Parse(card, "{G}{G}{G}{G}{G}");

            return(card);
        }
예제 #22
0
        public void BorosReckonerTest()
        {
            var mc = ManaCost.Parse("{R/W}{R/W}{R/W}");

            Assert.AreEqual(1, mc.Fragments.Count);
            Assert.AreEqual(1, mc.Fragments.OfType <HybridManaCostFragment>().Count());
            Assert.AreEqual(3, mc.Fragments.OfType <HybridManaCostFragment>().First().Amount);
            Assert.AreEqual(Color.Red, mc.Fragments.OfType <HybridManaCostFragment>().First().ColorA);
            Assert.AreEqual(Color.White, mc.Fragments.OfType <HybridManaCostFragment>().First().ColorB);
        }
예제 #23
0
        public override Card GetCard(Player owner)
        {
            var card = new Card(owner, new[] { CardType.Creature }, new[] { "Human", "Soldier" }, false, 1, 1, false, false);

            card._attrs = MtgCardAttribute.GetAttribute(GetType());

            card.Cost = ManaCost.Parse(card, "{1}{W}");
            card.AddStaticAbility(StaticAbility.DoubleStrike);

            return(card);
        }
예제 #24
0
        public override Card GetCard(Player owner)
        {
            var card = new Card(owner, new[] { CardType.Sorcery }, null, false);

            card._attrs = CardAttrs;
            card.Cost   = ManaCost.Parse(card, "{G}{G}");

            // TODO: Until end of turn, any time you could activate a mana ability, you may pay 1 life. If you do, add {C}.

            return(card);
        }
예제 #25
0
        public void ForceOfNatureTest()
        {
            var mc = ManaCost.Parse("{2}{G}{G}{G}{G}");

            Assert.AreEqual(2, mc.Fragments.Count);
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().Count());
            Assert.AreEqual(2, mc.Fragments.OfType <GenericManaCostFragment>().First().Amount);
            Assert.AreEqual(1, mc.Fragments.OfType <ColoredManaCostFragment>().Count());
            Assert.AreEqual(4, mc.Fragments.OfType <ColoredManaCostFragment>().First().Amount);
            Assert.AreEqual(Color.Green, mc.Fragments.OfType <ColoredManaCostFragment>().First().Color);
        }
예제 #26
0
        public void IncinerateTest()
        {
            var mc = ManaCost.Parse("{1}{R}");

            Assert.AreEqual(2, mc.Fragments.Count);
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().Count());
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().First().Amount);
            Assert.AreEqual(1, mc.Fragments.OfType <ColoredManaCostFragment>().Count());
            Assert.AreEqual(1, mc.Fragments.OfType <ColoredManaCostFragment>().First().Amount);
            Assert.AreEqual(Color.Red, mc.Fragments.OfType <ColoredManaCostFragment>().First().Color);
        }
예제 #27
0
 public void OneColoredTest()
 {
     foreach (var symbol in new string[] { "W", "U", "B", "G", "R" })
     {
         var mc = ManaCost.Parse("{" + symbol + "}");
         Assert.AreEqual(1, mc.Fragments.Count);
         Assert.AreEqual(typeof(ColoredManaCostFragment), mc.Fragments[0].GetType());
         Assert.AreEqual(1, (mc.Fragments[0] as ColoredManaCostFragment).Amount);
         Assert.AreEqual(symbol.ToColor(), (mc.Fragments[0] as ColoredManaCostFragment).Color);
     }
 }
예제 #28
0
        public void DismemberTest()
        {
            var mc = ManaCost.Parse("{1}{B/P}{B/P}");

            Assert.AreEqual(2, mc.Fragments.Count);
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().Count());
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().First().Amount);
            Assert.AreEqual(1, mc.Fragments.OfType <PhyrexianColoredManaCostFragment>().Count());
            Assert.AreEqual(2, mc.Fragments.OfType <PhyrexianColoredManaCostFragment>().First().Amount);
            Assert.AreEqual(Color.Black, mc.Fragments.OfType <PhyrexianColoredManaCostFragment>().First().Color);
        }
예제 #29
0
        public void BirthingPodTest()
        {
            var mc = ManaCost.Parse("{3}{G/P}");

            Assert.AreEqual(2, mc.Fragments.Count);
            Assert.AreEqual(1, mc.Fragments.OfType <GenericManaCostFragment>().Count());
            Assert.AreEqual(3, mc.Fragments.OfType <GenericManaCostFragment>().First().Amount);
            Assert.AreEqual(1, mc.Fragments.OfType <PhyrexianColoredManaCostFragment>().Count());
            Assert.AreEqual(1, mc.Fragments.OfType <PhyrexianColoredManaCostFragment>().First().Amount);
            Assert.AreEqual(Color.Green, mc.Fragments.OfType <PhyrexianColoredManaCostFragment>().First().Color);
        }
예제 #30
0
        public override Card GetCard(Player owner)
        {
            var card = new Card(owner, new[] { CardType.Creature }, new[] { "Spider" }, false, 2, 4, false, false);

            card._attrs = MtgCardAttribute.GetAttribute(GetType());

            card.Cost = ManaCost.Parse(card, "{3}{G}");
            card.AddStaticAbility(StaticAbility.Reach);

            return(card);
        }