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); } }
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 }); } }
public void killTest() { for (int i = 0; i < 1000; i++) { Game gm = GameTest.createGame(); MidNightSub sub = new MidNightSub(); setKnife(gm, 1, 2, ITEM.KNIFE); sub.kill(gm.shareData.players.getPlayer(1)); GameTest.assertLive(1); GameTest.assertMurderer(1, 2); GameTest.assertDead(2, DEAD_REASON.KNIFE, 1); GameTest.assertLive(3); 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 }); } }