Пример #1
0
        public void Aura_LoopBug()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer          = 1,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;

            var minion1 = (Minion)Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stormwind Champion"));
            var minion2 = (Minion)Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stormwind Champion"));

            game.Process(PlayCardTask.Any(game.CurrentPlayer, minion1));

            Assert.Equal(6, minion1.BaseHealth);

            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            game.Process(PlayCardTask.Any(game.CurrentPlayer, minion2));

            Assert.Equal(7, minion1.BaseHealth);
        }
Пример #2
0
        public void SecretActivation()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.HUNTER,
                Player2HeroClass = CardClass.ROGUE,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var minion1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Knife Juggler"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Snake Trap"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion2));
            game.Process(MinionAttackTask.Any(game.CurrentPlayer, minion2, minion1));
            Assert.Equal(game.CurrentOpponent.Hero.Health > 27 ? 2 : 1, ((Minion)minion1).Health);
        }
Пример #3
0
        public void Flamewaker_BRM_002()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.MAGE,
                Player2HeroClass = CardClass.MAGE,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Flamewaker"));

            game.Process(PlayCardTask.Any(game.CurrentPlayer, testCard));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var minion1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Bloodfen Raptor"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            var minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion2));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            Assert.AreEqual(33, ((Minion)minion1).Health + ((Minion)minion2).Health + game.CurrentOpponent.Hero.Health);
            var spell2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Fireball"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell2, game.CurrentOpponent.Hero));
            Assert.AreEqual(25,
                            (((Minion)minion1).IsDead ? 0 : ((Minion)minion1).Health) +
                            (((Minion)minion2).IsDead ? 0 : ((Minion)minion2).Health) +
                            game.CurrentOpponent.Hero.Health);
        }
Пример #4
0
        public void DruidOfTheFlame_BRM_010()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.DRUID,
                Player2HeroClass = CardClass.DRUID,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Druid of the Flame"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard1, 1));
            var testCard2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Druid of the Flame"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard2, 2));
            Assert.AreEqual(2, game.CurrentPlayer.Board.Count);
            Assert.AreEqual(5, ((Minion)game.CurrentPlayer.Board[0]).AttackDamage);
            Assert.AreEqual(2, ((Minion)game.CurrentPlayer.Board[0]).Health);
            Assert.AreEqual(2, ((Minion)game.CurrentPlayer.Board[1]).AttackDamage);
            Assert.AreEqual(5, ((Minion)game.CurrentPlayer.Board[1]).Health);
        }
Пример #5
0
        public void VolcanicDrake_BRM_025()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.MAGE,
                Player2HeroClass = CardClass.MAGE,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Volcanic Drake"));
            var minion   = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion));
            Assert.AreEqual(1, testCard.Enchants.Count);
            Assert.AreEqual(6, testCard.Cost);
            game.Process(HeroPowerTask.Any(game.CurrentPlayer, minion));
            Assert.AreEqual(5, testCard.Cost);
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            Assert.AreEqual(6, testCard.Cost);
        }
Пример #6
0
        public void MajordomoExecutus_BRM_027()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.MAGE,
                Player2HeroClass = CardClass.PRIEST,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Majordomo Executus"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var spell = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Shadow Word: Death"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell, testCard));
            Assert.AreEqual(8, game.CurrentOpponent.Hero.Health);
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            game.Process(HeroPowerTask.Any(game.CurrentPlayer));
            Assert.AreEqual(22, game.CurrentOpponent.Hero.Health);
        }
Пример #7
0
        public void Aura_LoopBug()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer = 1,
                FillDecks   = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;

            var minion1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stormwind Champion"));
            var minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stormwind Champion"));

            game.Process(PlayCardTask.Any(game.CurrentPlayer, minion1));

            Assert.AreEqual(6, minion1[GameTag.HEALTH]);

            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            game.Process(PlayCardTask.Any(game.CurrentPlayer, minion2));

            Assert.AreEqual(7, minion1[GameTag.HEALTH]);
        }
Пример #8
0
        public void GrimPatron_BRM_019()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.MAGE,
                Player2HeroClass = CardClass.MAGE,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Grim Patron"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var minion1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            var minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Reckless Rocketeer"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion2));
            game.Process(MinionAttackTask.Any(game.CurrentPlayer, minion1, testCard));
            Assert.AreEqual(2, game.CurrentOpponent.Board.Count);
            game.Process(MinionAttackTask.Any(game.CurrentPlayer, minion2, testCard));
            Assert.AreEqual(1, game.CurrentOpponent.Board.Count);
        }
Пример #9
0
        public void TwilightWhelp_BRM_004()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.PRIEST,
                DeckPlayer1      = new List <Card>()
                {
                    Cards.FromName("Azure Drake")
                },
                Player2HeroClass = CardClass.PRIEST,
                DeckPlayer2      = new List <Card>(),
                FillDecks        = false
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Twilight Whelp"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard1));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var testCard2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Twilight Whelp"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard2));
            Assert.AreEqual(3, ((Minion)testCard1).Health);
            Assert.AreEqual(1, ((Minion)testCard2).Health);
        }
Пример #10
0
        public void CantBeTargetedBy()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.MAGE,
            });

            game.StartGame();

            Minion target = game.ProcessCard <Minion>("Faerie Dragon", asZeroCost: true);

            Assert.False(game.CurrentPlayer.Hero.HeroPower.IsValidPlayTarget(target));

            var spell = (Spell)Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Fireball"));

            Assert.False(spell.IsValidPlayTarget(target));

            Minion target2 = game.ProcessCard <Minion>("Stonetusk Boar", asZeroCost: true);

            game.ProcessCard(Generic.DrawCard(game.CurrentPlayer, Cards.FromId("ICC_314t7")), asZeroCost: true);

            Assert.True(target2.CantBeTargetedBySpells);
            Assert.True(target2.CantBeTargetedByHeroPowers);
            Assert.False(game.CurrentPlayer.Hero.HeroPower.IsValidPlayTarget(target2));
            Assert.False(spell.IsValidPlayTarget(target2));
        }
Пример #11
0
        public void SolemnVigil_BRM_001()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.PALADIN,
                Player2HeroClass = CardClass.PALADIN,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Solemn Vigil"));
            var minion1  = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            Assert.AreEqual(1, testCard.Enchants.Count);
            Assert.AreEqual(5, testCard.Cost);
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion2));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            Assert.AreEqual(5, testCard.Cost);
            Assert.AreEqual(6, game.CurrentPlayer.Hand.Count);
            game.Process(MinionAttackTask.Any(game.CurrentPlayer, minion1, minion2));
            Assert.AreEqual(3, testCard.Cost);
            game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard));
            Assert.AreEqual(7, game.CurrentPlayer.Hand.Count);
        }
Пример #12
0
        public void Resurrect_BRM_017()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.PRIEST,
                Player2HeroClass = CardClass.MAGE,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Resurrect"));

            Assert.AreEqual(5, game.CurrentPlayer.Hand.Count);
            game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard));
            Assert.AreEqual(5, game.CurrentPlayer.Hand.Count);
            var minion = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Injured Blademaster"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var spell = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Fireball"));

            Assert.AreEqual(1, game.CurrentOpponent.Board.Count);
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell, minion));
            Assert.AreEqual(0, game.CurrentOpponent.Board.Count);
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard));
            Assert.AreEqual(1, game.CurrentPlayer.Board.Count);
            Assert.AreEqual(minion.Card.Id, game.CurrentPlayer.Board[0].Card.Id);
            Assert.AreEqual(7, ((Minion)game.CurrentPlayer.Board[0]).Health);
        }
Пример #13
0
        public void CoreRager_BRM_014()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.HUNTER,
                DeckPlayer1      = new List <Card>()
                {
                },
                Player2HeroClass = CardClass.HUNTER,
                FillDecks        = false
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Core Rager"));
            var testCard2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Core Rager"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard1));
            Assert.AreEqual(4, ((Minion)testCard1).Health);
            Assert.AreEqual(4, ((Minion)testCard1).AttackDamage);
            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard2));
            Assert.AreEqual(7, ((Minion)testCard2).Health);
            Assert.AreEqual(7, ((Minion)testCard2).AttackDamage);
        }
Пример #14
0
        public void TauntTest()
        {
            var game = new Game(new GameConfig {
                StartPlayer = 1, Player1HeroClass = CardClass.ROGUE, Player2HeroClass = CardClass.WARLOCK, FillDecks = true, FillDecksPredictably = true
            });

            game.StartGame();

            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            game.Process(HeroPowerTask.Any(game.CurrentPlayer));

            Assert.True(game.CurrentPlayer.Hero.IsValidAttackTarget(game.CurrentOpponent.Hero));

            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            IPlayable taunt = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Voidwalker"));

            game.Process(PlayCardTask.Any(game.CurrentPlayer, taunt));

            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            Assert.True(((ICharacter)taunt).HasTaunt);
            Assert.False(game.CurrentPlayer.Hero.IsValidAttackTarget(game.CurrentOpponent.Hero));
            Assert.True(game.CurrentPlayer.Hero.IsValidAttackTarget(taunt as ICharacter));
        }
Пример #15
0
        public void BasicAttackBuffTest1()
        {
            var game =
                new Game(new GameConfig
            {
                StartPlayer          = 1,
                Player1HeroClass     = CardClass.PRIEST,
                Player2HeroClass     = CardClass.HUNTER,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            game.StartGame();

            var minion1 = (ICharacter)Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Bloodfen Raptor"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            IPlayable spell1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Inner Rage"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell1, minion1));
            Assert.Equal(5, ((Minion)minion1).AttackDamage);
            Assert.Equal(1, ((Minion)minion1).Health);
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            IPlayable minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Aldor Peacekeeper"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, minion2, minion1));
            Assert.Equal(1, ((Minion)minion1).AttackDamage);
            Assert.Equal(1, ((Minion)minion1).Health);
        }
Пример #16
0
        public void BlackwingTechnician_BRM_033()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.PRIEST,
                DeckPlayer1      = new List <Card>()
                {
                    Cards.FromName("Azure Drake")
                },
                Player2HeroClass = CardClass.PRIEST,
                DeckPlayer2      = new List <Card>(),
                FillDecks        = false
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Blackwing Technician"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard1));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var testCard2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Blackwing Technician"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard2));
            Assert.AreEqual(3, ((Minion)testCard1).AttackDamage);
            Assert.AreEqual(5, ((Minion)testCard1).Health);
            Assert.AreEqual(2, ((Minion)testCard2).AttackDamage);
            Assert.AreEqual(4, ((Minion)testCard2).Health);
        }
Пример #17
0
        public void BasicHealthBuffTest1()
        {
            var game =
                new Game(new GameConfig
            {
                StartPlayer          = 1,
                Player1HeroClass     = CardClass.PRIEST,
                Player2HeroClass     = CardClass.HUNTER,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            game.StartGame();

            var minion = (ICharacter)Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Bloodfen Raptor"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion));
            IPlayable spell1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Power Word: Shield"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell1, minion));
            Assert.Equal(4, ((Minion)minion).Health);
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            IPlayable spell2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Hunter's Mark"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell2, minion));
            Assert.Equal(1, ((Minion)minion).Health);
        }
Пример #18
0
        public void BasicHealthAuraTest1()
        {
            var game =
                new Game(new GameConfig
            {
                StartPlayer          = 1,
                Player1HeroClass     = CardClass.PALADIN,
                Player2HeroClass     = CardClass.MAGE,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;

            game.StartGame();

            IPlayable minion1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stormwind Champion"));
            IPlayable minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stormwind Champion"));
            IPlayable minion3 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Shattered Sun Cleric"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));             // 6/6

            game.CurrentPlayer.UsedMana = 0;

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion2));             // 7/7

            game.CurrentPlayer.UsedMana = 0;

            game.Process(PlayCardTask.MinionTarget(game.CurrentPlayer, minion3, minion2));

            game.CurrentPlayer.UsedMana = 0;

            game.Process(EndTurnTask.Any(game.CurrentPlayer));                  // (7/7), (8/8), (5/4)

            IPlayable spell1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Flamestrike"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, spell1));               // (7/3), (8/4)

            game.CurrentPlayer.UsedMana = 0;

            IPlayable spell2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Arcane Explosion"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, spell2));


            IPlayable spell3 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Arcane Explosion"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, spell3));

            Assert.Equal(2, ((ICharacter)minion2).Health);              // (7/1), (8/2)

            IPlayable spell4 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Arcane Explosion"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, spell4));

            Assert.Equal(1, ((ICharacter)minion2).Health);              // (7/1)
            Assert.Equal(Zone.PLAY, ((ICharacter)minion2).Zone.Type);
        }
Пример #19
0
        public void BasicHealthAuraTest3()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer          = 1,
                Player1HeroClass     = CardClass.PRIEST,
                Player2HeroClass     = CardClass.WARLOCK,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;

            var       minion1 = (ICharacter)Generic.DrawCard(game.Player1, Cards.FromName("Murloc Raider"));
            var       minion2 = (ICharacter)Generic.DrawCard(game.Player1, Cards.FromName("Murloc Warleader"));
            IPlayable minion3 = Generic.DrawCard(game.Player1, Cards.FromName("Stormwind Champion"));
            IPlayable minion4 = Generic.DrawCard(game.Player1, Cards.FromName("Ironbeak Owl"));
            IPlayable spell1  = Generic.DrawCard(game.Player1, Cards.FromName("Power Word: Shield"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            game.Player1.UsedMana = 0;
            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion2));
            game.Player1.UsedMana = 0;
            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion3));
            game.Player1.UsedMana = 0;
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell1, minion1));

            Assert.Equal(4, minion1.Health);
            Assert.Equal(4, minion2.Health);
            Assert.Equal(6, ((ICharacter)minion3).Health);

            game.Process(PlayCardTask.MinionTarget(game.CurrentPlayer, minion4, minion2));

            Assert.Equal(4, minion1.Health);
            Assert.Equal(4, minion2.Health);
            Assert.Equal(6, ((ICharacter)minion3).Health);
            Assert.Equal(2, ((ICharacter)minion4).Health);

            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            IPlayable spell2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Hellfire"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, spell2));

            Assert.Equal(1, minion1.Health);
            Assert.Equal(1, minion2.Health);
            Assert.Equal(3, ((ICharacter)minion3).Health);
            Assert.True(((ICharacter)minion4).IsDead);
        }
Пример #20
0
        public void CloneSameState()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.SHAMAN,
                Player2HeroClass = CardClass.SHAMAN,
                FillDecks        = true,
                History          = false,
                Logging          = false
            });

            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            game.StartGame();
            Game clone = game.Clone();

            Assert.Equal(game.Hash(), clone.Hash());

            SabberStoneCore.Model.Entities.IPlayable spell1 =
                Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Lightning Bolt"));
            SabberStoneCore.Model.Entities.IPlayable minion1 =
                Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));
            SabberStoneCore.Model.Entities.IPlayable spell2 =
                Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Lightning Bolt"));

            SabberStoneCore.Model.Entities.IPlayable cSpell1 =
                Generic.DrawCard(clone.CurrentPlayer, Cards.FromName("Lightning Bolt"));
            SabberStoneCore.Model.Entities.IPlayable cSpell2 =
                Generic.DrawCard(clone.CurrentPlayer, Cards.FromName("Lightning Bolt"));
            SabberStoneCore.Model.Entities.IPlayable cMinion1 =
                Generic.DrawCard(clone.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell1, game.CurrentOpponent.Hero));
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell2, game.CurrentOpponent.Hero));
            game.Process(PlayCardTask.Any(game.CurrentPlayer, minion1));

            clone.Process(PlayCardTask.Any(clone.CurrentPlayer, cMinion1));
            clone.Process(PlayCardTask.SpellTarget(clone.CurrentPlayer, cSpell2, clone.CurrentOpponent.Hero));
            clone.Process(PlayCardTask.SpellTarget(clone.CurrentPlayer, cSpell1, clone.CurrentOpponent.Hero));

            GameTag[] ignored = new GameTag[] { GameTag.LAST_CARD_PLAYED, GameTag.ENTITY_ID };

            string gameHash  = game.Hash(ignored);
            string cloneHash = clone.Hash(ignored);

            Assert.Equal(gameHash, cloneHash);
        }
Пример #21
0
        public void DrawWithRandom()
        {
            Game game = new Game(new GameConfig
            {
                DrawWithRandom       = true,
                RandomSeed           = 33,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.StartGame();

            Game clone = game.Clone(resetRandomSeed: false);

            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);
            Assert.Equal(Generic.Draw(game.CurrentPlayer).Id, Generic.Draw(clone.CurrentPlayer).Id);

            game.SetRandomSeed(55);

            int[] gameSequence =
            {
                Generic.Draw(game.CurrentPlayer).Id,
                Generic.Draw(game.CurrentPlayer).Id,
                Generic.Draw(game.CurrentPlayer).Id,
                Generic.Draw(game.CurrentPlayer).Id,
                Generic.Draw(game.CurrentPlayer).Id,
            };
            int[] cloneSequence =
            {
                Generic.Draw(clone.CurrentPlayer).Id,
                Generic.Draw(clone.CurrentPlayer).Id,
                Generic.Draw(clone.CurrentPlayer).Id,
                Generic.Draw(clone.CurrentPlayer).Id,
                Generic.Draw(clone.CurrentPlayer).Id
            };
            Assert.False(gameSequence.SequenceEqual(cloneSequence));
        }
Пример #22
0
        public void SecretActivation()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer          = 1,
                Player1HeroClass     = CardClass.HUNTER,
                Player2HeroClass     = CardClass.ROGUE,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;

            IPlayable minion1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Knife Juggler"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            IPlayable testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Snake Trap"));             // Spawns 3

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            IPlayable minion2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Stonetusk Boar"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion2));
            game.Process(MinionAttackTask.Any(game.CurrentPlayer, minion2, minion1));

            Assert.Equal(4, game.CurrentOpponent.BoardZone.Count);
            if (game.CurrentPlayer.BoardZone.Count == 0)
            {
                // Minion was destroyed, so it's moved to graveyard with tags reset.
                Assert.Equal(1, game.CurrentPlayer.GraveyardZone.Count);
                Assert.Equal(game.CurrentOpponent.Hero.BaseHealth, game.CurrentOpponent.Hero.Health);
                Assert.Equal(game.CurrentPlayer.Hero.BaseHealth - 2, game.CurrentPlayer.Hero.Health);
            }
            else
            {
                // Minion was NOT destroyed, so it continued it's attack.
                Assert.Equal(0, game.CurrentPlayer.GraveyardZone.Count);
                Assert.Equal(game.CurrentOpponent.Hero.BaseHealth - 1, game.CurrentOpponent.Hero.Health);
                Assert.Equal(game.CurrentPlayer.Hero.BaseHealth - 3, game.CurrentPlayer.Hero.Health);
            }
        }
Пример #23
0
        public void BasicHealthAuraTest2()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer          = 1,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;

            var       minion1 = (ICharacter)Generic.DrawCard(game.Player1, Cards.FromName("Murloc Raider"));
            IPlayable minion2 = Generic.DrawCard(game.Player1, Cards.FromName("Ironbeak Owl"));
            IPlayable spell1  = Generic.DrawCard(game.Player1, Cards.FromName("Power Word: Shield"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion1));
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell1, minion1));

            Assert.Equal(3, minion1.Health);

            game.Process(PlayCardTask.MinionTarget(game.CurrentPlayer, minion2, minion1));

            Assert.Equal(1, minion1.Health);

            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            game.Process(EndTurnTask.Any(game.CurrentPlayer));

            var       minion3 = (ICharacter)Generic.DrawCard(game.Player1, Cards.FromName("Bloodfen Raptor"));
            IPlayable minion4 = Generic.DrawCard(game.Player1, Cards.FromName("Ironbeak Owl"));
            IPlayable spell2  = Generic.DrawCard(game.Player1, Cards.FromName("Power Word: Shield"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion3));
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell2, minion3));

            Assert.Equal(4, minion3.Health);

            ((Minion)minion3).Damage = 3;

            game.Process(PlayCardTask.MinionTarget(game.CurrentPlayer, minion4, minion3));

            Assert.Equal(1, minion3.Health);
        }
Пример #24
0
        public void FireguardDestroyer_BRM_012()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.SHAMAN,
                Player2HeroClass = CardClass.SHAMAN,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Fireguard Destroyer"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard));
            Assert.AreEqual(true, ((Minion)testCard).AttackDamage >= 4);
            Assert.AreEqual(true, ((Minion)testCard).AttackDamage < 8);
        }
Пример #25
0
        public void BlackwingCorruptor_BRM_034()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.PRIEST,
                DeckPlayer1      = new List <Card>()
                {
                    Cards.FromName("Azure Drake"),
                    Cards.FromName("Blackwing Corruptor"),
                    Cards.FromName("Stonetusk Boar"),
                    Cards.FromName("Stonetusk Boar"),
                    Cards.FromName("Bloodfen Raptor"),
                    Cards.FromName("Bloodfen Raptor")
                },
                Player2HeroClass = CardClass.PRIEST,
                DeckPlayer2      = new List <Card>()
                {
                    Cards.FromName("Blackwing Corruptor"),
                    Cards.FromName("Stonetusk Boar"),
                    Cards.FromName("Stonetusk Boar"),
                    Cards.FromName("Bloodfen Raptor"),
                    Cards.FromName("Bloodfen Raptor")
                },
                FillDecks = false,
                Shuffle   = false
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Blackwing Corruptor"));

            game.Process(PlayCardTask.MinionTarget(game.CurrentPlayer, testCard1, game.CurrentOpponent.Hero));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            var testCard2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Blackwing Corruptor"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard2));
            Assert.AreEqual(1, game.Player1.Board.Count);
            Assert.AreEqual(1, game.Player2.Board.Count);
            Assert.AreEqual(30, game.Player1.Hero.Health);
            Assert.AreEqual(27, game.Player2.Hero.Health);
        }
Пример #26
0
        public void QuickShot_BRM_013()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.HUNTER,
                DeckPlayer1      = new List <Card>()
                {
                },
                Player2HeroClass = CardClass.HUNTER,
                DeckPlayer2      = new List <Card>()
                {
                    Cards.FromName("Alleycat"),
                    Cards.FromName("Alleycat"),
                    Cards.FromName("Kill Command"),
                    Cards.FromName("Kill Command"),
                    Cards.FromName("Unleash the Hounds"),
                    Cards.FromName("Unleash the Hounds"),
                    Cards.FromName("Houndmaster"),
                    Cards.FromName("Houndmaster"),
                    Cards.FromName("Savannah Highmane"),
                    Cards.FromName("Savannah Highmane"),
                },
                FillDecks = false
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Quick Shot"));
            var testCard2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Quick Shot"));

            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, testCard1, game.CurrentOpponent.Hero));
            Assert.AreEqual(27, game.CurrentOpponent.Hero.Health);
            Assert.AreEqual(0, game.CurrentPlayer.NumCardsDrawnThisTurn);
            Assert.AreEqual(20, game.CurrentPlayer.Hero.Health);
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, testCard2, game.CurrentOpponent.Hero));
            Assert.AreEqual(0, game.CurrentPlayer.NumCardsDrawnThisTurn);
            Assert.AreEqual(24, game.CurrentOpponent.Hero.Health);
            Assert.AreEqual(15, game.CurrentPlayer.Hero.Health);
        }
Пример #27
0
        public void SecretOnlyOnce()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.HUNTER,
                Player2HeroClass = CardClass.ROGUE,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard1 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Snake Trap"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard1));
            var testCard2 = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Snake Trap"));

            game.Process(PlayCardTask.Spell(game.CurrentPlayer, testCard2));
            Assert.Equal(1, game.CurrentPlayer.SecretZone.Count);
        }
Пример #28
0
        public void Nefarian_BRM_030()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.MAGE,
                Player2HeroClass = CardClass.DRUID,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Nefarian"));

            Assert.AreEqual(5, game.CurrentPlayer.Hand.Count);
            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard));
            Assert.AreEqual(6, game.CurrentPlayer.Hand.Count);
            Assert.AreEqual(CardClass.DRUID, game.CurrentPlayer.Hand[5].Card.Class);
            Assert.AreEqual(CardClass.DRUID, game.CurrentPlayer.Hand[4].Card.Class);
        }
Пример #29
0
        public void GangUp_BRM_007()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer      = 1,
                Player1HeroClass = CardClass.ROGUE,
                Player2HeroClass = CardClass.ROGUE,
                FillDecks        = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            var testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Gang Up"));
            var minion   = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Bloodfen Raptor"));

            game.Process(PlayCardTask.Minion(game.CurrentPlayer, minion));
            Assert.AreEqual(26, game.CurrentPlayer.Deck.Count);
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, testCard, minion));
            Assert.AreEqual(29, game.CurrentPlayer.Deck.Count);
        }
Пример #30
0
        public void NerubianEgg_FP1_007()
        {
            var game = new Game(new GameConfig
            {
                StartPlayer          = 1,
                Player1HeroClass     = CardClass.MAGE,
                Player2HeroClass     = CardClass.MAGE,
                FillDecks            = true,
                FillDecksPredictably = true
            });

            game.StartGame();
            game.Player1.BaseMana = 10;
            game.Player2.BaseMana = 10;
            SabberStoneCore.Model.Entities.IPlayable testCard = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Nerubian Egg"));
            game.Process(PlayCardTask.Minion(game.CurrentPlayer, testCard));
            game.Process(EndTurnTask.Any(game.CurrentPlayer));
            SabberStoneCore.Model.Entities.IPlayable spell = Generic.DrawCard(game.CurrentPlayer, Cards.FromName("Fireball"));
            game.Process(PlayCardTask.SpellTarget(game.CurrentPlayer, spell, testCard));
            Assert.Equal(1, game.CurrentOpponent.BoardZone.Count);
            Assert.Equal("FP1_007t", game.CurrentOpponent.BoardZone[0].Card.Id);
        }