예제 #1
0
        public IEnumerator burnTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(new WaitForSeconds(.1f));

            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);
            yield return(new WaitForSeconds(.1f));

            for (int i = 0; i < 7; i++)
            {
                game.sortedPlayers[0].cmdTurnEnd(game);
                yield return(new WaitForSeconds(.1f));

                game.sortedPlayers[1].cmdTurnEnd(game);
                yield return(new WaitForSeconds(.1f));
            }

            THHPlayer.BurnEventArg burn = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHPlayer.BurnEventArg) as THHPlayer.BurnEventArg;
            Assert.NotNull(burn);
            Assert.AreEqual(game.sortedPlayers[0], burn.player);
            Assert.AreEqual(game.sortedPlayers[0].grave[0], burn.card);
            game.Dispose();
        }
예제 #2
0
        public IEnumerator initReplaceRefuseTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(new WaitForSeconds(.1f));

            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0);
            yield return(new WaitForSeconds(.1f));

            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);

            var args = game.triggers.getRecordedEvents().Where(e => e is THHPlayer.InitReplaceEventArg);

            Assert.AreEqual(args.Count(), 2);
            Assert.AreEqual(((THHPlayer.InitReplaceEventArg)args.ElementAt(0)).player, game.players[0]);
            Assert.AreEqual(((THHPlayer.InitReplaceEventArg)args.ElementAt(1)).player, game.players[1]);

            game.Dispose();
        }
예제 #3
0
        public IEnumerator useTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(new WaitForSeconds(.1f));

            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0);
            yield return(new WaitForSeconds(.1f));

            THHPlayer.UseEventArg use = game.triggers.getRecordedEvents().FirstOrDefault(e => e is THHPlayer.UseEventArg) as THHPlayer.UseEventArg;
            Assert.NotNull(use);
            Assert.AreEqual(game.sortedPlayers[0], use.player);
            Assert.AreEqual(game.sortedPlayers[0].field[0], use.card);
            Assert.AreEqual(TestServant.ID, use.card.define.id);
            Assert.AreEqual(0, use.position);
            Assert.AreEqual(0, use.targets.Length);
            THHPlayer.SetGemEventArg setGem = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHPlayer.SetGemEventArg) as THHPlayer.SetGemEventArg;
            Assert.AreEqual(0, setGem.value);
            THHPlayer.MoveEventArg summon = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHPlayer.MoveEventArg) as THHPlayer.MoveEventArg;
            Assert.NotNull(summon);
            Assert.AreEqual(game.sortedPlayers[0], summon.player);
            Assert.AreEqual(TestServant.ID, summon.card.define.id);
            Assert.AreEqual(0, summon.position);
            game.Dispose();
        }
예제 #4
0
        public IEnumerator winTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(new WaitForSeconds(.1f));

            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0);
            yield return(new WaitForSeconds(.1f));

            for (int i = 0; i < 15; i++)
            {
                game.sortedPlayers[0].cmdTurnEnd(game);
                yield return(new WaitForSeconds(.1f));

                game.sortedPlayers[1].cmdTurnEnd(game);
                yield return(new WaitForSeconds(.1f));

                game.sortedPlayers[0].cmdAttack(game, game.sortedPlayers[0].field[0], game.sortedPlayers[1].master);
                yield return(new WaitForSeconds(.1f));
            }
            THHCard.AttackEventArg attack = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.AttackEventArg) as THHCard.AttackEventArg;
            Assert.NotNull(attack);
            THHGame.GameEndEventArg gameEnd = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHGame.GameEndEventArg) as THHGame.GameEndEventArg;
            Assert.AreEqual(game.sortedPlayers[0], gameEnd.winners[0]);
            game.Dispose();
        }
예제 #5
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();
        }
예제 #6
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();
        }
예제 #7
0
        public IEnumerator fatigueTest()
        {
            THHGame game = TestGameflow.initStandardGame(deckCount: 10);

            _ = game.run();
            yield return(new WaitForSeconds(.1f));

            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);
            yield return(new WaitForSeconds(.1f));

            for (int i = 0; i < 7; i++)
            {
                game.sortedPlayers[0].cmdTurnEnd(game);
                yield return(new WaitForSeconds(.1f));

                game.sortedPlayers[1].cmdTurnEnd(game);
                yield return(new WaitForSeconds(.1f));
            }
            THHPlayer.FatigueEventArg fatigue = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHPlayer.FatigueEventArg) as THHPlayer.FatigueEventArg;
            Assert.NotNull(fatigue);
            Assert.AreEqual(game.sortedPlayers[0], fatigue.player);
            THHCard.DamageEventArg damage = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.DamageEventArg) as THHCard.DamageEventArg;
            Assert.NotNull(damage);
            Assert.AreEqual(game.sortedPlayers[0].master, damage.cards[0]);
            Assert.AreEqual(1, damage.value);

            game.Dispose();
        }
예제 #8
0
        public IEnumerator remoteGameflowTest()
        {
            THHGame g1 = TestGameflow.initStandardGame(name: "客户端0", playersId: new int[] { 0, 1 }, option: new GameOption()
            {
                sortedPlayers = new int[] { 0, 1 }
            });
            HostManager host = new GameObject(nameof(HostManager)).AddComponent <HostManager>();

            host.logger = g1.logger;
            host.start();
            ClientManager c1 = new GameObject(nameof(ClientManager)).AddComponent <ClientManager>();

            c1.logger = g1.logger;
            c1.start();
            Task task = c1.join(Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), host.port);

            (g1.answers as AnswerManager).client = c1;

            THHGame g2 = TestGameflow.initStandardGame(name: "客户端1", playersId: new int[] { 0, 1 }, option: new GameOption()
            {
                sortedPlayers = new int[] { 0, 1 }
            });
            ClientManager c2 = new GameObject(nameof(ClientManager)).AddComponent <ClientManager>();

            c2.logger = g2.logger;
            c2.start();
            task = c2.join(Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), host.port);
            (g2.answers as AnswerManager).client = c2;
            yield return(new WaitUntil(() => task.IsCompleted));

            _ = g1.run();
            _ = g2.run();
            yield return(new WaitForSeconds(.5f));

            g1.players[0].cmdInitReplace(g1, g1.players[0].init[0, 1]);
            yield return(new WaitForSeconds(.5f));

            g2.players[1].cmdInitReplace(g2);
            yield return(new WaitForSeconds(.5f));

            g1.players[0].cmdUse(g1, g1.players[0].hand[0], 0);
            yield return(new WaitForSeconds(.5f));

            g1.players[0].cmdTurnEnd(g1);
            yield return(new WaitForSeconds(.5f));

            g2.players[1].cmdTurnEnd(g2);
            yield return(new WaitForSeconds(.5f));

            g1.players[0].cmdAttack(g1, g1.players[0].field[0], g1.players[1].master);
            yield return(new WaitForSeconds(.5f));

            g1.Dispose();
            g2.Dispose();
        }
예제 #9
0
        public IEnumerator surrenderTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            game.run();
            //yield return new WaitUntil(() =>
            //{
            //    return game.answers.getLastRequest(game.players[0].id) is InitReplaceRequest;
            //});
            yield return(game.players[0].cmdSurrender(game).wait());

            THHGame.GameEndEventArg gameEnd = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHGame.GameEndEventArg) as THHGame.GameEndEventArg;
            Assert.AreEqual(game.players[1], gameEnd.winners[0]);
            game.Dispose();
            yield break;
        }
예제 #10
0
        public IEnumerator turnEndTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            game.run();
            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);
            game.sortedPlayers[0].cmdTurnEnd(game);

            THHGame.TurnEndEventArg turnEnd = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHGame.TurnEndEventArg) as THHGame.TurnEndEventArg;
            Assert.NotNull(turnEnd);
            Assert.AreEqual(game.sortedPlayers[0], turnEnd.player);
            THHGame.TurnStartEventArg turnStart = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHGame.TurnStartEventArg) as THHGame.TurnStartEventArg;
            Assert.NotNull(turnStart);
            Assert.AreEqual(game.sortedPlayers[1], turnStart.player);
            game.Dispose();
            yield break;
        }
예제 #11
0
        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();
        }
예제 #12
0
        public IEnumerator initTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(new WaitForSeconds(.1f));

            THHGame.InitEventArg init = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHGame.InitEventArg) as THHGame.InitEventArg;
            Assert.NotNull(init);
            Assert.AreEqual(TestMaster.ID, game.players[0].master.define.id);
            Assert.AreEqual(30, game.players[0].master.getCurrentLife());
            Assert.AreEqual(TestMaster.ID, game.players[1].master.define.id);
            Assert.AreEqual(30, game.players[1].master.getCurrentLife());
            Assert.AreEqual(2, game.sortedPlayers.Length);
            bool isFirstPlayer = game.getPlayerIndex(game.sortedPlayers[0]) == 0;

            Assert.AreEqual(isFirstPlayer ? 3 : 4, game.players[0].init.count);
            Assert.AreEqual(isFirstPlayer ? 4 : 3, game.players[1].init.count);
            game.Dispose();
        }
예제 #13
0
        public IEnumerator initReplaceTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(new WaitForSeconds(.1f));

            game.players[0].cmdInitReplace(game, game.players[0].init[0]);
            game.players[1].cmdInitReplace(game, game.players[1].init[0, 1]);
            yield return(new WaitForSeconds(.1f));

            //替换手牌
            Assert.AreEqual(8, game.triggers.getRecordedEvents().Length);
            THHPlayer.InitReplaceEventArg initReplace = game.triggers.getRecordedEvents()[1] as THHPlayer.InitReplaceEventArg;
            Assert.NotNull(initReplace);
            Assert.AreEqual(game.players[0], initReplace.player);
            Assert.AreEqual(1, initReplace.replacedCards.Length);
            initReplace = game.triggers.getRecordedEvents()[2] as THHPlayer.InitReplaceEventArg;
            Assert.NotNull(initReplace);
            Assert.AreEqual(game.players[1], initReplace.player);
            Assert.AreEqual(2, initReplace.replacedCards.Length);
            //游戏开始
            THHGame.StartEventArg start = game.triggers.getRecordedEvents()[3] as THHGame.StartEventArg;
            Assert.NotNull(start);
            //玩家回合开始
            THHGame.TurnStartEventArg turnStart = game.triggers.getRecordedEvents()[4] as THHGame.TurnStartEventArg;
            Assert.NotNull(turnStart);
            Assert.AreEqual(game.sortedPlayers[0], turnStart.player);
            //增加法力水晶并充满
            THHPlayer.SetMaxGemEventArg setMaxGem = game.triggers.getRecordedEvents()[5] as THHPlayer.SetMaxGemEventArg;
            Assert.NotNull(setMaxGem);
            Assert.AreEqual(1, setMaxGem.value);
            THHPlayer.SetGemEventArg setGem = game.triggers.getRecordedEvents()[6] as THHPlayer.SetGemEventArg;
            Assert.NotNull(setGem);
            Assert.AreEqual(1, setGem.value);
            //抽一张卡
            THHPlayer.DrawEventArg draw = game.triggers.getRecordedEvents()[7] as THHPlayer.DrawEventArg;
            Assert.NotNull(draw);
            Assert.AreEqual(game.sortedPlayers[0], draw.player);
            game.Dispose();
        }
예제 #14
0
        public IEnumerator attackTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(new WaitForSeconds(.2f));

            game.players[0].cmdInitReplace(game);
            game.players[1].cmdInitReplace(game);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[0].cmdTurnEnd(game);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[1].cmdUse(game, game.sortedPlayers[1].hand[0], 0);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[1].cmdTurnEnd(game);
            yield return(new WaitForSeconds(.1f));

            game.sortedPlayers[0].cmdAttack(game, game.sortedPlayers[0].field[0], game.sortedPlayers[1].field[0]);
            yield return(new WaitForSeconds(.1f));

            THHCard.AttackEventArg attack = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.AttackEventArg) as THHCard.AttackEventArg;
            Assert.NotNull(attack);
            THHCard.DamageEventArg d1 = attack.children[0] as THHCard.DamageEventArg;
            Assert.NotNull(d1);
            Assert.AreEqual(2, d1.value);
            THHCard.DamageEventArg d2 = attack.children[1] as THHCard.DamageEventArg;
            Assert.NotNull(d2);
            Assert.AreEqual(2, d2.value);
            THHCard.DeathEventArg d3 = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.DeathEventArg) as THHCard.DeathEventArg;
            Assert.NotNull(d3);
            Assert.AreEqual(2, d3.infoDic.Count);

            game.Dispose();
        }
예제 #15
0
        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();
        }
예제 #16
0
        public IEnumerator initReplaceTest()
        {
            THHGame game = TestGameflow.initStandardGame();

            _ = game.run();
            yield return(game.players[0].cmdInitReplace(game, game.players[0].init[0]).wait());

            yield return(game.players[1].cmdInitReplace(game, game.players[1].init[0, 1]).wait());

            //替换手牌
            IEventArg[] events = game.triggers.getRecordedEvents();
            THHPlayer.InitReplaceEventArg initReplace = events.OfType <THHPlayer.InitReplaceEventArg>().First();
            Assert.NotNull(initReplace);
            Assert.AreEqual(game.players[0], initReplace.player);
            Assert.AreEqual(1, initReplace.replacedCards.Length);
            initReplace = events.OfType <THHPlayer.InitReplaceEventArg>().Skip(1).First();
            Assert.NotNull(initReplace);
            Assert.AreEqual(game.players[1], initReplace.player);
            Assert.AreEqual(2, initReplace.replacedCards.Length);
            //游戏开始
            THHGame.StartEventArg start = events.OfType <THHGame.StartEventArg>().First();
            Assert.NotNull(start);
            //玩家回合开始
            THHGame.TurnStartEventArg turnStart = events.OfType <THHGame.TurnStartEventArg>().First();
            Assert.NotNull(turnStart);
            Assert.AreEqual(game.sortedPlayers[0], turnStart.player);
            //增加法力水晶并充满
            THHPlayer.SetMaxGemEventArg setMaxGem = events.skipUntil(e => e is THHGame.TurnStartEventArg).OfType <THHPlayer.SetMaxGemEventArg>().First();
            Assert.NotNull(setMaxGem);
            Assert.AreEqual(1, setMaxGem.value);
            THHPlayer.SetGemEventArg setGem = events.OfType <THHPlayer.SetGemEventArg>().First();
            Assert.NotNull(setGem);
            Assert.AreEqual(1, setGem.value);
            //抽一张卡
            THHPlayer.DrawEventArg draw = events.OfType <THHPlayer.DrawEventArg>().First();
            Assert.NotNull(draw);
            Assert.AreEqual(game.sortedPlayers[0], draw.player);
            game.Dispose();
        }
예제 #17
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();
        }