//----------------------------------------------------------------------------------------------- private void sendCmd(int src, int dest, int item) { var dat = game.net.CreateStoryCode.MidnightSelect(src, dest, item); dat.src = src; { var o = new MidNight(); o.run(dat); } }
private void sendCmd2(int src, int dest, ITEM [] srcitem, ITEM[] destitem) { var dat = game.net.CreateStoryCode.MidnightSelectItem(src, dest, srcitem, destitem); dat.src = src; { var o = new MidNight(); o.run(dat); } }
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); } }
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 NextTurn() { Logger.info("story.NextTurn():run."); AStory story = null; AStory story2 = null; if (GameFactory.getGame().shareData.field.state == FIELD_STATE.EARLY_MORNING) { story = new EarlyMorning(); story2 = new Morning(); } else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.MORNING) { story = new Morning(); story2 = new Noon(); } else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.NOON) { story = new Noon(); story2 = new Night(); } else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.NIGHT) { story = new Night(); story2 = new MidNight(); } else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.MIDNIGHT) { story = new MidNight(); story2 = new EarlyMorning(); } // 次のターンを実施 if (story.end()) { if (GameFactory.getGame().shareData.field.state == FIELD_STATE.MIDNIGHT) { GameFactory.getGame().shareData.field.state = FIELD_STATE.EARLY_MORNING; } else { GameFactory.getGame().shareData.field.state += 1; } story2.init(); } // send if (!GameFactory.debug) { // update view GameFactory.getUnityManager().updateDraw(true); } }
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 }); } }
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 }); } }