Пример #1
0
        public void PatchouliAgniShineTest()
        {
            TouhouCardEngine.CardDefine[][] decks = new TouhouCardEngine.CardDefine[][]
            {
                Enumerable.Repeat(new RashFairy(), 30).ToArray(),
                Enumerable.Repeat(new AgniShine(), 30).ToArray()
            };
            THHGame game = TestGameflow.initStandardGame(null, new int[] { 0, 1 },
                                                         Enumerable.Repeat(new Patchouli(), 2).ToArray(),
                                                         decks,
                                                         new GameOption()
            {
            });

            game.run();
            game.sortedPlayers[0].cmdInitReplace(game);
            game.sortedPlayers[1].cmdInitReplace(game);
            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0);
            game.sortedPlayers[0].cmdTurnEnd(game);
            game.sortedPlayers[1].cmdTurnEnd(game);
            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0);
            game.sortedPlayers[0].cmdTurnEnd(game);
            game.sortedPlayers[1].cmdTurnEnd(game);
            game.sortedPlayers[0].cmdTurnEnd(game);
            game.sortedPlayers[1].cmdTurnEnd(game);
            game.sortedPlayers[0].cmdTurnEnd(game);
            game.sortedPlayers[1].cmdTurnEnd(game);
            game.sortedPlayers[0].cmdTurnEnd(game);

            game.sortedPlayers[1].cmdUse(game, game.sortedPlayers[1].hand[0], 0);
            THHCard.DamageEventArg damage = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.DamageEventArg) as THHCard.DamageEventArg;
            Assert.AreEqual(0, game.sortedPlayers[0].field.count);
            Assert.AreEqual(4, damage.value);
        }
Пример #2
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();
        }
        public void drizzleFairyTest()
        {
            THHGame game = TestGameflow.initGameWithoutPlayers(null, new GameOption()
            {
                shuffle = false
            });

            game.createPlayer(0, "玩家0", game.getCardDefine <Reimu>(), Enumerable.Repeat(game.getCardDefine <DrizzleFairy>() as CardDefine, 29)
                              .Concat(Enumerable.Repeat(game.getCardDefine <FantasySeal>(), 1)));
            game.createPlayer(1, "玩家1", game.getCardDefine <Reimu>(), Enumerable.Repeat(game.getCardDefine <DrizzleFairy>() as CardDefine, 29)
                              .Concat(Enumerable.Repeat(game.getCardDefine <FantasySeal>(), 1)));
            game.run();
            game.sortedPlayers[0].cmdInitReplace(game);
            game.sortedPlayers[1].cmdInitReplace(game);

            //第一回合
            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[1], 0);

            game.sortedPlayers[0].cmdTurnEnd(game);

            game.sortedPlayers[1].cmdUse(game, game.sortedPlayers[1].hand[1], 0);

            game.sortedPlayers[1].cmdTurnEnd(game);
            //第二回合
            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[1], 0);
            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[1], 0);

            game.sortedPlayers[0].cmdTurnEnd(game);
            game.sortedPlayers[1].cmdTurnEnd(game);
            //第三回合,共计4个妖精
            game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[1], 0);

            game.sortedPlayers[0].cmdTurnEnd(game);
            game.sortedPlayers[1].cmdTurnEnd(game);
            //第四回合
            game.sortedPlayers[0].cmdTurnEnd(game);

            game.sortedPlayers[1].cmdUse(game, game.sortedPlayers[1].hand[0], 0);

            //对3个随从造成3点伤害
            THHCard.DamageEventArg damage = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.DamageEventArg) as THHCard.DamageEventArg;
            Assert.AreEqual(3, damage.cards.Length);
            Assert.AreEqual(3, damage.value);
            Assert.AreEqual(1, game.sortedPlayers[0].field.count);
        }
Пример #4
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();
        }