コード例 #1
0
        public void plusMurdererTest2()
        {
            Game gm = GameTest.createGame();

            GameTest.setItem(gm, "p1", ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);
            MidNightSub sub = new MidNightSub();
            var         p1  = gm.shareData.players.getPlayer(1);

            gm.shareData.field.dementDay = 4;
            p1.murderer     = true;
            p1.murdererTurn = 5;

            sub.plusMurderer(p1);

            Assert.AreEqual(true, p1.fdead);
            Assert.AreEqual(DEAD_REASON.HAKKYO, p1.deadReason);

            Assert.AreEqual(gm.shareData.players.getPlayer(1).getItemIndex(ITEM.MURDERE_KNIFE), -1);
            if (gm.shareData.players.getPlayer(2).getItemIndex(ITEM.MURDERE_KNIFE) != -1 ||
                gm.shareData.players.getPlayer(3).getItemIndex(ITEM.MURDERE_KNIFE) != -1 ||
                gm.shareData.players.getPlayer(4).getItemIndex(ITEM.MURDERE_KNIFE) != -1
                )
            {
            }
            else
            {
                Assert.Fail();
            }
        }
コード例 #2
0
        public void MidNight1Test8()
        {
            for (int i = 0; i < 100; i++)
            {
                Game gm = GameTest.createGame();
                { var o = new MidNight(); o.init(); }

                GameTest.setItem(gm, "p1", ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);
                GameTest.setItem(gm, "p2", ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);

                var p1 = GameFactory.getGame().shareData.players.getPlayer(1);
                p1.murderer     = true;
                p1.murdererTurn = 2;

                sendCmd(1, 0, -1);
                sendCmd(2, 0, -1);
                sendCmd(3, 0, -1);
                sendCmd(4, 0, -1);

                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(1).state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT_WAIT);
                var p2 = GameFactory.getGame().shareData.players.getPlayer(GameFactory.getGame().shareData.players.getPlayer(1).discoverer);
                Assert.AreEqual(p2.state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT);

                GameTest.assertDead(1, DEAD_REASON.HAKKYO, 0);
                GameTest.assertLive(2);
                GameTest.assertLive(3);
                GameTest.assertLive(4);
            }
        }
コード例 #3
0
        public void MidNight1Test7()
        {
            for (int i = 0; i < 100; i++)
            {
                Game gm = GameTest.createGame();
                { var o = new MidNight(); o.init(); }


                GameTest.setItem(gm, "p1", ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);
                GameTest.setItem(gm, "p2", ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);

                sendCmd(1, 0, -1);
                sendCmd(2, 1, 1);
                sendCmd(3, 0, -1);
                sendCmd(4, 0, -1);

                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(1).state, PLAYER_STATE.MIDNIGHT_KILL_ITEM_SELECT_WAIT);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(2).state, PLAYER_STATE.MIDNIGHT_KILL_ITEM_SELECT);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(3).state, PLAYER_STATE.MIDNIGHT_SELECT_OK);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(4).state, PLAYER_STATE.MIDNIGHT_SELECT_OK);

                Assert.AreNotEqual(GameFactory.getGame().shareData.players.getPlayer(2).getItemIndex(ITEM.MURDERE_KNIFE), -1);
                GameTest.assertMurderer(2, 1);
                GameTest.assertLive(3);
                GameTest.assertLive(4);
                GameTest.assertDead(1, DEAD_REASON.KNIFE, 2);
            }
        }
コード例 #4
0
        public void killTest3()
        {
            for (int i = 0; i < 1000; i++)
            {
                Game        gm  = GameTest.createGame();
                MidNightSub sub = new MidNightSub();

                setKnife(gm, 1, 2, ITEM.KNIFE);
                setKnife(gm, 2, 3, ITEM.KNIFE);
                sub.kill(gm.shareData.players.getPlayer(2));
                sub.kill(gm.shareData.players.getPlayer(1));

                GameTest.assertLive(1);
                GameTest.assertDead(2, DEAD_REASON.KNIFE, 1);
                GameTest.assertDead(3, DEAD_REASON.KNIFE, 2);
                GameTest.assertLive(4);

                if (gm.shareData.players.getPlayer(1).getItem(0) == ITEM.MURDERE_KNIFE)
                {
                    gm.shareData.players.getPlayer(1).setItem(0, ITEM.NONE);
                }
                GameTest.assertItem(1, new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
                GameTest.assertItem(2, new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
            }
        }
コード例 #5
0
ファイル: NightTests.cs プロジェクト: nanosphere/gensou02SLG
        public void NightTest3()
        {
            Game gm = GameTest.createGame();

            gm.shareData.players.getPlayer(2).fdead = true;
            { var o = new Night(); o.init(); }



            sendCmd(1, true, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(3, true, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(4, true, PLAYER_STATE.NIGHT_VOTE);

            Assert.AreEqual(gm.shareData.field.yes, 3);
            Assert.AreEqual(gm.shareData.field.no, 0);

            Assert.AreEqual(gm.shareData.players.getPlayer(1).state, db.PLAYER_STATE.NIGHT_VOTE);
            Assert.AreEqual(gm.shareData.players.getPlayer(2).state, db.PLAYER_STATE.NIGHT_VOTE_END);
            Assert.AreEqual(gm.shareData.players.getPlayer(3).state, db.PLAYER_STATE.NIGHT_VOTE);
            Assert.AreEqual(gm.shareData.players.getPlayer(4).state, db.PLAYER_STATE.NIGHT_VOTE);

            sendCmd2(1, 2, PLAYER_STATE.NIGHT_VOTE_OK);
            sendCmd2(3, 4, PLAYER_STATE.NIGHT_VOTE_OK);
            sendCmd2(4, 4, PLAYER_STATE.NIGHT_VOTE_END);

            Assert.AreEqual(gm.shareData.players.getPlayer(1).dayNightVote, 0);
            Assert.AreEqual(gm.shareData.players.getPlayer(2).dayNightVote, 0);
            Assert.AreEqual(gm.shareData.players.getPlayer(3).dayNightVote, 0);
            Assert.AreEqual(gm.shareData.players.getPlayer(4).dayNightVote, 2);

            Assert.AreEqual(gm.shareData.field.captivity, 4);

            // end
            Assert.IsTrue(gm.shareData.players.isAllPlayerState(PLAYER_STATE.NIGHT_VOTE_END));
        }
コード例 #6
0
        public void MidNight1Test4()
        {
            for (int i = 0; i < 500; i++)
            {
                Game gm = GameTest.createGame();
                { var o = new MidNight(); o.init(); }


                GameTest.setItem(gm, "p1", ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);
                GameTest.setItem(gm, "p2", ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);
                GameTest.setItem(gm, "p3", ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE);
                GameTest.setItem(gm, "p4", ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE);

                sendCmd(1, 2, 2);
                sendCmd(2, 1, 2);
                sendCmd(3, 0, -1);
                sendCmd(4, 0, -1);

                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(1).state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT_WAIT);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(2).state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT_WAIT);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(3).state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(4).state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT);

                Assert.AreNotEqual(
                    GameFactory.getGame().shareData.players.getPlayer(3).dayDiscovere,
                    GameFactory.getGame().shareData.players.getPlayer(4).dayDiscovere);

                if (!(GameFactory.getGame().shareData.players.getPlayer(3).getItemIndex(ITEM.MURDERE_KNIFE) != -1 ||
                      GameFactory.getGame().shareData.players.getPlayer(4).getItemIndex(ITEM.MURDERE_KNIFE) != -1
                      ))
                {
                    Assert.Fail();
                }

                sendCmd2(3, GameFactory.getGame().shareData.players.getPlayer(3).dayDiscovere,
                         new ITEM[] { ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE },
                         new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE }
                         );
                sendCmd2(4, GameFactory.getGame().shareData.players.getPlayer(4).dayDiscovere,
                         new ITEM[] { ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE },
                         new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE }
                         );

                Assert.IsTrue(gm.shareData.players.isAllPlayerState(PLAYER_STATE.MIDNIGHT_END));

                GameTest.assertLive(3);
                GameTest.assertLive(4);
                GameTest.assertDead(1, DEAD_REASON.KNIFE, 2);
                GameTest.assertDead(2, DEAD_REASON.KNIFE, 1);

                GameTest.assertItem(1, new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
                GameTest.assertItem(2, new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
                GameTest.assertItem(3, new ITEM[] { ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
                GameTest.assertItem(4, new ITEM[] { ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
            }
        }
コード例 #7
0
        public void NextTurnTest()
        {
            Game gm = GameTest.createGame();

            new NextTurn();
            Assert.AreEqual(FIELD_STATE.MORNING, GameFactory.getGame().shareData.field.state);

            new NextTurn();
            Assert.AreEqual(FIELD_STATE.NOON, GameFactory.getGame().shareData.field.state);
        }
コード例 #8
0
        public void MidNight1Test()
        {
            for (int i = 0; i < 100; i++)
            {
                Game gm = GameTest.createGame();
                { var o = new MidNight(); o.init(); }

                GameTest.setItem(gm, "p1", ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);
                GameTest.setItem(gm, "p2", ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK);

                sendCmd(1, 2, 0);
                sendCmd(2, 0, -1);
                sendCmd(3, 0, -1);
                sendCmd(4, 0, -1);

                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(1).state, PLAYER_STATE.MIDNIGHT_KILL_ITEM_SELECT);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(2).state, PLAYER_STATE.MIDNIGHT_KILL_ITEM_SELECT_WAIT);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(3).state, PLAYER_STATE.MIDNIGHT_SELECT_OK);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(4).state, PLAYER_STATE.MIDNIGHT_SELECT_OK);

                sendCmd2(1, 2,
                         new ITEM[] { ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE },
                         new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE }
                         );

                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(1).state, PLAYER_STATE.MIDNIGHT_END);
                Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(2).state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT_WAIT);
                if (GameFactory.getGame().shareData.players.getPlayer(3).state == PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT)
                {
                    Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(4).state, PLAYER_STATE.MIDNIGHT_END);
                }
                else
                {
                    Assert.AreEqual(GameFactory.getGame().shareData.players.getPlayer(4).state, PLAYER_STATE.MIDNIGHT_SELECT_OK_DISCOVERER_ITEM_SELECT);
                }

                sendCmd2(GameFactory.getGame().shareData.players.getPlayer(2).discoverer, 2,
                         new ITEM[] { ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE },
                         new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE }
                         );

                Assert.IsTrue(gm.shareData.players.isAllPlayerState(PLAYER_STATE.MIDNIGHT_END));

                GameTest.assertLive(1);
                GameTest.assertMurderer(1, 2);
                GameTest.assertDead(2, DEAD_REASON.MURDERER_KNIFE, 1);
                GameTest.assertLive(3);

                GameTest.assertItem(1, new ITEM[] { ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
                GameTest.assertItem(2, new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
                GameTest.assertItem(GameFactory.getGame().shareData.players.getPlayer(2).discoverer,
                                    new ITEM[] { ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
            }
        }
コード例 #9
0
        public void getRandomFirstDscovererTest()
        {
            for (int i = 0; i < 100; i++)
            {
                Game        gm  = GameTest.createGame();
                MidNightSub sub = new MidNightSub();
                gm.shareData.players.getPlayer(1).dead(DEAD_REASON.HAKKYO, 0);

                var p1 = sub.getRandomFirstDscoverer();
                Assert.AreNotEqual(1, p1.id);
            }
        }
コード例 #10
0
        public void plusMurdererTest()
        {
            Game        gm  = GameTest.createGame();
            MidNightSub sub = new MidNightSub();
            var         p1  = gm.shareData.players.getPlayer(1);

            gm.shareData.field.dementDay = 2;

            p1.murderer     = true;
            p1.murdererTurn = 1;

            sub.plusMurderer(p1);

            Assert.AreEqual(false, p1.fdead);
            Assert.AreEqual(2, p1.murdererTurn);
        }
コード例 #11
0
        public void unuseKnifeTest()
        {
            Game        gm  = GameTest.createGame();
            MidNightSub sub = new MidNightSub();

            setKnife(gm, 1, 2, ITEM.KNIFE);
            setKnife(gm, 2, 3, ITEM.KNIFE);
            setKnife(gm, 3, 4, ITEM.KNIFE);
            gm.shareData.players.getPlayer(1).usedItem();
            gm.shareData.players.getPlayer(2).usedItem();
            gm.shareData.players.getPlayer(3).usedItem();

            Assert.AreEqual(3, gm.shareData.players.getUseItemPlayers(ITEM.KNIFE).Count);
            sub.unuseKnife(2);
            Assert.AreEqual(2, gm.shareData.players.getUseItemPlayers(ITEM.KNIFE).Count);
        }
コード例 #12
0
ファイル: NightTests.cs プロジェクト: nanosphere/gensou02SLG
        public void NightTest2()
        {
            Game gm = GameTest.createGame();

            { var o = new Night(); o.init(); }

            sendCmd(1, true, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(2, true, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(3, false, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(4, false, PLAYER_STATE.NIGHT_SELECT_END);

            Assert.AreEqual(gm.shareData.field.yes, 2);
            Assert.AreEqual(gm.shareData.field.no, 2);

            Assert.AreEqual(gm.shareData.players.getPlayer(1).state, db.PLAYER_STATE.NIGHT_SELECT_END);
            Assert.AreEqual(gm.shareData.players.getPlayer(2).state, db.PLAYER_STATE.NIGHT_SELECT_END);
            Assert.AreEqual(gm.shareData.players.getPlayer(3).state, db.PLAYER_STATE.NIGHT_SELECT_END);
            Assert.AreEqual(gm.shareData.players.getPlayer(4).state, db.PLAYER_STATE.NIGHT_SELECT_END);
        }
コード例 #13
0
        public void killKnifeLoopTest2()
        {
            for (int i = 0; i < 100; i++)
            {
                Game        gm  = GameTest.createGame();
                MidNightSub sub = new MidNightSub();

                setKnife(gm, 1, 2, ITEM.KNIFE);
                setKnife(gm, 2, 1, ITEM.KNIFE);
                sub.killKnifeLoop();

                GameTest.assertDead(1, DEAD_REASON.KNIFE, 2);
                GameTest.assertDead(2, DEAD_REASON.KNIFE, 1);
                GameTest.assertLive(3);
                GameTest.assertLive(4);

                GameTest.assertItem(1, new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
                GameTest.assertItem(2, new ITEM[] { ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE });
            }
        }
コード例 #14
0
        public void usedKensikitTest()
        {
            Game        gm  = GameTest.createGame();
            MidNightSub sub = new MidNightSub();

            GameTest.setItem(gm, "p1", ITEM.KENSIKIT, ITEM.NONE, ITEM.NONE, ITEM.NONE);

            var p1 = gm.shareData.players.getPlayer(1);
            var p2 = gm.shareData.players.getPlayer(2);

            p1.net_item = 0;
            p1.net_opp  = 2;
            p1.usedItem();

            var p1r = sub.usedKensikit(p1);

            Assert.AreEqual(p1r.reason, DEAD_REASON.LIVE);
            Assert.AreEqual(p1r.target.id, 2);
            Assert.AreEqual(sub.usedKensikit(p2), null);
            Assert.AreEqual(p1.getItem(0), ITEM.NONE);
        }
コード例 #15
0
        public void NoonTest()
        {
            Game gm = GameTest.createGame();

            { var o = new Noon(); o.init(); }


            GameTest.setItem(gm, "p1", ITEM.MURDERE_KNIFE, ITEM.KNIFE, ITEM.KNIFE, ITEM.KNIFE);
            GameTest.setItem(gm, "p2", ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK, ITEM.CHEAN_LOCK);
            GameTest.setItem(gm, "p3", ITEM.KENSIKIT, ITEM.KENSIKIT, ITEM.KENSIKIT, ITEM.KENSIKIT);

            sendCmd(1, 2, PLAYER_STATE.NOON_WAIT_ACK, PLAYER_STATE.NOON_REQUEST_RETURN);
            sendCmd2(2, 1, true, PLAYER_STATE.NOON_ITEM, PLAYER_STATE.NOON_ITEM);
            sendCmd3(1, 1, PLAYER_STATE.NOON_ITEM_OK);
            Assert.AreEqual(gm.shareData.players.getPlayer("p2").state, db.PLAYER_STATE.NOON_ITEM);
            sendCmd3(2, 1, PLAYER_STATE.NONE);
            Assert.AreEqual(gm.shareData.players.getPlayer("p2").state, db.PLAYER_STATE.NONE);

            Assert.AreEqual(gm.shareData.players.getPlayer("p1").items[0], ITEM.MURDERE_KNIFE);
            Assert.AreEqual(gm.shareData.players.getPlayer("p1").items[1], ITEM.CHEAN_LOCK);
            Assert.AreEqual(gm.shareData.players.getPlayer("p1").items[2], ITEM.KNIFE);
            Assert.AreEqual(gm.shareData.players.getPlayer("p1").items[3], ITEM.KNIFE);

            Assert.AreEqual(gm.shareData.players.getPlayer("p2").items[0], ITEM.CHEAN_LOCK);
            Assert.AreEqual(gm.shareData.players.getPlayer("p2").items[1], ITEM.KNIFE);
            Assert.AreEqual(gm.shareData.players.getPlayer("p2").items[2], ITEM.CHEAN_LOCK);
            Assert.AreEqual(gm.shareData.players.getPlayer("p2").items[3], ITEM.CHEAN_LOCK);

            Assert.AreEqual(gm.shareData.players.getPlayer("p3").items[0], ITEM.KENSIKIT);
            Assert.AreEqual(gm.shareData.players.getPlayer("p3").items[1], ITEM.KENSIKIT);
            Assert.AreEqual(gm.shareData.players.getPlayer("p3").items[2], ITEM.KENSIKIT);
            Assert.AreEqual(gm.shareData.players.getPlayer("p3").items[3], ITEM.KENSIKIT);

            // end
            sendCmd4(1);
            sendCmd4(2);
            sendCmd4(3);
            sendCmd4(4);
            Assert.IsTrue(gm.shareData.players.isAllPlayerState(PLAYER_STATE.NOON_END));
        }
コード例 #16
0
        public void usedTantikiTest()
        {
            Game        gm  = GameTest.createGame();
            MidNightSub sub = new MidNightSub();

            GameTest.setItem(gm, "p1", ITEM.KENTIKI, ITEM.NONE, ITEM.NONE, ITEM.NONE);
            GameTest.setItem(gm, "p2", ITEM.MURDERE_KNIFE, ITEM.MURDERE_KNIFE, ITEM.MURDERE_KNIFE, ITEM.MURDERE_KNIFE);

            var p1 = gm.shareData.players.getPlayer(1);
            var p2 = gm.shareData.players.getPlayer(2);

            p1.net_item = 0;
            p1.net_opp  = 2;
            p1.usedItem();

            var p1r = sub.usedTantiki(p1);

            Assert.AreEqual(p1r.item, ITEM.KNIFE);
            Assert.AreEqual(p1r.count, 4);
            Assert.AreEqual(p1r.target.id, 2);
            Assert.AreEqual(sub.usedTantiki(p2), null);
            Assert.AreEqual(p1.getItem(0), ITEM.NONE);
        }
コード例 #17
0
ファイル: NightTests.cs プロジェクト: nanosphere/gensou02SLG
        public void NightTest()
        {
            Game gm = GameTest.createGame();

            {
                AStory night = new Night();
                night.init();
            }

            sendCmd(1, true, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(2, true, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(3, true, PLAYER_STATE.NIGHT_SELECT_OK);
            sendCmd(4, false, PLAYER_STATE.NIGHT_VOTE);

            Assert.AreEqual(gm.shareData.field.yes, 3);
            Assert.AreEqual(gm.shareData.field.no, 1);

            Assert.AreEqual(gm.shareData.players.getPlayer(1).state, db.PLAYER_STATE.NIGHT_VOTE);
            Assert.AreEqual(gm.shareData.players.getPlayer(2).state, db.PLAYER_STATE.NIGHT_VOTE);
            Assert.AreEqual(gm.shareData.players.getPlayer(3).state, db.PLAYER_STATE.NIGHT_VOTE);
            Assert.AreEqual(gm.shareData.players.getPlayer(4).state, db.PLAYER_STATE.NIGHT_VOTE);

            sendCmd2(1, 2, PLAYER_STATE.NIGHT_VOTE_OK);
            sendCmd2(2, 0, PLAYER_STATE.NIGHT_VOTE_OK);
            sendCmd2(3, 2, PLAYER_STATE.NIGHT_VOTE_OK);
            sendCmd2(4, 1, PLAYER_STATE.NIGHT_VOTE_END);

            Assert.AreEqual(gm.shareData.players.getPlayer(1).dayNightVote, 1);
            Assert.AreEqual(gm.shareData.players.getPlayer(2).dayNightVote, 2);
            Assert.AreEqual(gm.shareData.players.getPlayer(3).dayNightVote, 0);
            Assert.AreEqual(gm.shareData.players.getPlayer(4).dayNightVote, 0);

            Assert.AreEqual(gm.shareData.field.captivity, 2);

            // end
            Assert.IsTrue(gm.shareData.players.isAllPlayerState(PLAYER_STATE.NIGHT_VOTE_END));
        }
コード例 #18
0
        public void randMurdererKnifeMoveTest()
        {
            for (int i = 0; i < 100; i++)
            {
                Game        gm  = GameTest.createGame();
                MidNightSub sub = new MidNightSub();
                GameTest.setItem(gm, "p1", ITEM.NONE, ITEM.NONE, ITEM.NONE, ITEM.NONE);
                gm.shareData.players.getPlayer(1).dead(DEAD_REASON.HAKKYO, 0);

                sub.randMurdererKnifeMove();

                Player p = null;
                foreach (var p2 in gm.shareData.players.players)
                {
                    if (p2.getItemIndex(ITEM.MURDERE_KNIFE) != -1)
                    {
                        p = p2;
                        break;
                    }
                }
                Assert.AreNotEqual(null, p);
                Assert.AreNotEqual(1, p.id);
            }
        }