Пример #1
0
        public void freezeTest()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });
            THHPlayer defaultPlayer = game.createPlayer(0, "玩家0", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 30));
            THHPlayer elusivePlayer = game.createPlayer(1, "玩家1", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 28)
                                                        .Concat(Enumerable.Repeat(game.getCardDefine <TestFreeze>(), 2)));

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <DefaultServant>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdUse(game, defaultPlayer.hand.First(c => c.define.id == DefaultServant.ID), 0);
            //玩家0拍白板一张

            game.skipTurnUntil(() => elusivePlayer.gem >= game.getCardDefine <TestFreeze>().cost&& game.currentPlayer == elusivePlayer);
            elusivePlayer.cmdUse(game, elusivePlayer.hand.First(c => c.define.id == TestFreeze.ID), 0, defaultPlayer.field);
            //玩家1释放冰环

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <DefaultServant>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdAttack(game, defaultPlayer.field[0], elusivePlayer.master); //被冻结的随从无法攻击
            defaultPlayer.cmdTurnEnd(game);                                              //回合结束,随从解冻

            elusivePlayer.cmdTurnEnd(game);

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <DefaultServant>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdAttack(game, defaultPlayer.field[0], elusivePlayer.master);//已解除冰冻的随从可以攻击
            Assert.AreEqual(29, elusivePlayer.master.getCurrentLife(game));

            game.Dispose();
        }
Пример #2
0
        public void ElusiveTest()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });
            THHPlayer defaultPlayer = game.createPlayer(0, "玩家0", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 28)
                                                        .Concat(Enumerable.Repeat(game.getCardDefine <TestSpellCard>(), 2)));
            THHPlayer elusivePlayer = game.createPlayer(1, "玩家1", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 29)
                                                        .Concat(Enumerable.Repeat(game.getCardDefine <ElusiveServant>(), 1)));

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <DefaultServant>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdUse(game, defaultPlayer.hand.First(c => c.define.id == DefaultServant.ID), 0);

            game.skipTurnUntil(() => elusivePlayer.gem >= game.getCardDefine <ElusiveServant>().cost&& game.currentPlayer == elusivePlayer);
            elusivePlayer.cmdUse(game, elusivePlayer.hand.First(c => c.define.id == ElusiveServant.ID), 0);

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <TestSpellCard>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdUse(game, defaultPlayer.hand.First(c => c.define.id == TestSpellCard.ID), 0, defaultPlayer.field[0]);
            Assert.AreEqual(6, defaultPlayer.field[0].getCurrentLife(game)); //没有魔免的可以被法术指定
            defaultPlayer.cmdUse(game, defaultPlayer.hand.First(c => c.define.id == TestSpellCard.ID), 0, elusivePlayer.field[0]);
            Assert.AreEqual(3, elusivePlayer.field[0].getCurrentLife(game)); //魔免无法被法术指定

            game.skipTurnUntil(() => elusivePlayer.gem >= game.getCardDefine <TestDamageSkill>().cost&& game.currentPlayer == elusivePlayer);
            elusivePlayer.cmdUse(game, elusivePlayer.skill, 0, defaultPlayer.field[0]);
            Assert.AreEqual(5, defaultPlayer.field[0].getCurrentLife(game));//没有魔免的可以被技能指定
            elusivePlayer.cmdTurnEnd(game);

            game.skipTurnUntil(() => elusivePlayer.gem >= game.getCardDefine <TestDamageSkill>().cost&& game.currentPlayer == elusivePlayer);
            elusivePlayer.cmdUse(game, elusivePlayer.skill, 0, elusivePlayer.field[0]);
            Assert.AreEqual(3, elusivePlayer.field[0].getCurrentLife(game));//魔免无法被技能指定

            game.Dispose();
        }
Пример #3
0
        public IEnumerator fireBallTest()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });

            game.createPlayer(0, "玩家0", game.getCardDefine <TestMaster>(), Enumerable.Repeat(game.getCardDefine <FireBall>() as CardDefine, 30));
            game.createPlayer(1, "玩家1", game.getCardDefine <TestMaster>(), Enumerable.Repeat(game.getCardDefine <FireBall>() as CardDefine, 30));

            game.skipTurnUntil(() => game.players[0].hand.count > 0);
            Assert.False(game.players[0].hand[0].isUsable(game, game.players[0], out _));
            game.skipTurnUntil(() => game.players[0].gem == 4);
            Assert.True(game.players[0].hand[0].isUsable(game, game.players[0], out _));
            Assert.True(game.players[0].hand[0].isValidTarget(game, game.players[1].master));
            game.players[0].cmdUse(game, game.players[0].hand[0], 0, game.players[1].master);
            yield return(new WaitUntil(() => game.triggers.getRecordedEvents().Any(e => e is THHCard.DamageEventArg)));

            Assert.NotNull(game.triggers.getRecordedEvents().OfType <THHCard.DamageEventArg>().Last());
        }
        public void PatchouliSilentSeleneTest()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });
            THHPlayer defaultPlayer = game.createPlayer(0, "玩家0", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <MissingSpecter>() as CardDefine, 30));
            THHPlayer elusivePlayer = game.createPlayer(1, "玩家1", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <SilentSelene>() as CardDefine, 28)
                                                        .Concat(Enumerable.Repeat(game.getCardDefine <BestMagic>(), 2)));

            game.skipTurnUntil(() => game.currentPlayer == defaultPlayer && defaultPlayer.gem >= game.getCardDefine <MissingSpecter>().cost);
            defaultPlayer.cmdUse(game, defaultPlayer.hand.getCard <MissingSpecter>());

            game.skipTurnUntil(() => game.currentPlayer == elusivePlayer && elusivePlayer.gem >= 10);
            elusivePlayer.cmdUse(game, elusivePlayer.hand.getCard <BestMagic>());//使用秘藏魔法减费
            Assert.True(game.players[0].hand.Where(c => c.define is SilentSelene).All(c => c.getCost(game) == 7));
            elusivePlayer.cmdUse(game, elusivePlayer.hand.getCard <SilentSelene>());

            game.Dispose();
        }
        public void PatchouliTrilithonShakeTest()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });
            THHPlayer defaultPlayer = game.createPlayer(0, "玩家0", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 30));
            THHPlayer elusivePlayer = game.createPlayer(1, "玩家1", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 28)
                                                        .Concat(Enumerable.Repeat(game.getCardDefine <RockElement>(), 2)));

            defaultPlayer.cmdTurnEnd(game);

            game.skipTurnUntil(() => elusivePlayer.gem >= game.getCardDefine <RockElement>().cost&& game.currentPlayer == elusivePlayer);
            elusivePlayer.cmdUse(game, elusivePlayer.hand.First(c => c.define.id == RockElement.ID), 0);

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <DefaultServant>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdUse(game, defaultPlayer.hand.First(c => c.define.id == DefaultServant.ID), 0);

            game.skipTurnUntil(() => elusivePlayer.gem >= game.getCardDefine <TrilithonShake>().cost&& game.currentPlayer == elusivePlayer);
            elusivePlayer.cmdAttack(game, elusivePlayer.field[0], defaultPlayer.field[0]);
            game.Dispose();
        }
Пример #6
0
        public void poisiousTest_ServantEffect()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });
            THHPlayer defaultPlayer = game.createPlayer(0, "玩家0", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 30));
            THHPlayer elusivePlayer = game.createPlayer(1, "玩家1", game.getCardDefine <TestMaster2>(), Enumerable.Repeat(game.getCardDefine <DefaultServant>() as CardDefine, 28)
                                                        .Concat(Enumerable.Repeat(game.getCardDefine <Priestess>(), 2)));

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <DefaultServant>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdUse(game, defaultPlayer.hand.First(c => c.define.id == DefaultServant.ID), 0);
            //玩家0拍白板一张

            game.skipTurnUntil(() => elusivePlayer.gem >= game.getCardDefine <Priestess>().cost&& game.currentPlayer == elusivePlayer);
            elusivePlayer.cmdUse(game, elusivePlayer.hand.First(c => c.define.id == Priestess.ID), 0);
            //玩家1拍女祭司

            game.skipTurnUntil(() => defaultPlayer.gem >= game.getCardDefine <DefaultServant>().cost&& game.currentPlayer == defaultPlayer);
            defaultPlayer.cmdUse(game, defaultPlayer.hand.First(c => c.define.id == DefaultServant.ID), 1);

            game.Dispose();
        }
Пример #7
0
        public IEnumerator sorcererApprenticeTest()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });

            game.createPlayer(0, "玩家0", game.getCardDefine <TestMaster>(),
                              Enumerable.Repeat(game.getCardDefine <FireBall>(), 29).Cast <CardDefine>()
                              .Concat(Enumerable.Repeat(game.getCardDefine <SorcererApprentice>(), 1).Cast <CardDefine>()));
            game.createPlayer(1, "玩家1", game.getCardDefine <TestMaster>(),
                              Enumerable.Repeat(game.getCardDefine <FireBall>(), 29).Cast <CardDefine>()
                              .Concat(Enumerable.Repeat(game.getCardDefine <SorcererApprentice>(), 1).Cast <CardDefine>()));

            game.skipTurnUntil(() =>
                               game.currentPlayer == game.players[0] &&
                               game.players[0].gem >= game.getCardDefine <SorcererApprentice>().cost&&
                               game.players[0].hand.Any(c => c.define is SorcererApprentice));
            Assert.True(game.players[0].hand.Where(c => c.define is FireBall).All(c => c.getCost(game) == 4)); //火球术全是4费
            var task = game.players[0].cmdUse(game, game.players[0].hand.getCard <SorcererApprentice>());      //使用哀绿

            yield return(TestHelper.waitTask(task));

            Assert.True(game.players[0].field.Any(c => c.define is SorcererApprentice));
            Assert.True(game.players[0].hand.Where(c => c.define is FireBall).All(c => c.getCost(game) == 3)); //火球术全是3费
            task = game.players[0].draw(game);                                                                 //抽一张火球
            yield return(TestHelper.waitTask(task));

            Card card = game.players[0].hand.right;

            Assert.AreEqual(3, card.getCost(game));
            task = card.pile.moveTo(game, card, game.players[0].grave);//把火球送入墓地
            yield return(TestHelper.waitTask(task));

            Assert.AreEqual(4, card.getCost(game));
            yield return(game.players[0].field[0].die(game).wait());//杀死哀绿

            Assert.True(game.players[0].hand.getCards <FireBall>().All(c => c.getCost(game) == 4));
            yield return(game.players[0].draw(game).wait());//再抽一张火球术

            Assert.True(game.players[0].hand.getCards <FireBall>().All(c => c.getCost(game) == 4));
        }
Пример #8
0
 public static void skipUntilCanUse(this THHGame game, THHPlayer you, Card card)
 {
     game.skipTurnUntil(() => game.currentPlayer == you && you.gem >= card.getCost(game));
 }
Пример #9
0
 public static void skipUntilCanUse <T>(this THHGame game, THHPlayer you) where T : CardDefine
 {
     game.skipTurnUntil(() => game.currentPlayer == you && you.gem >= game.getCardDefine <T>().getProp <int>(nameof(ServantCardDefine.cost)));
 }