示例#1
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);
        }
示例#2
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);
        }