private void TestTsumo(int playerIndex, Tile tile, IList <InTurnOperation> operations) { var baseHandStatus = HandStatus.Tsumo; // test haidi if (MahjongSet.TilesRemain == gameSettings.MountainReservedTiles) { baseHandStatus |= HandStatus.Haidi; } // test lingshang if (IsLingShang) { baseHandStatus |= HandStatus.Lingshang; } var allTiles = MahjongSet.AllTiles; var doraTiles = MahjongSet.DoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var uraDoraTiles = MahjongSet.UraDoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var beiDora = CurrentRoundStatus.GetBeiDora(playerIndex); tsumoPointInfo = ServerMahjongLogic.GetPointInfo( playerIndex, CurrentRoundStatus, tile, baseHandStatus, doraTiles, uraDoraTiles, beiDora, gameSettings); // test if enough if (gameSettings.CheckConstraint(tsumoPointInfo)) { operations.Add(new InTurnOperation { Type = InTurnOperationType.Tsumo, Tile = justDraw }); } }
private void TestRong(int playerIndex, Tile discardTile, IList <OutTurnOperation> operations) { var baseHandStatus = HandStatus.Nothing; // test haidi if (MahjongSet.Data.TilesDrawn == gameSettings.MountainReservedTiles) { baseHandStatus |= HandStatus.Haidi; } // test lingshang -- not gonna happen var allTiles = MahjongSet.AllTiles; var doraTiles = MahjongSet.DoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var uraDoraTiles = MahjongSet.UraDoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var beiDora = CurrentRoundStatus.GetBeiDora(playerIndex); var point = ServerMahjongLogic.GetPointInfo( playerIndex, CurrentRoundStatus, discardTile, baseHandStatus, doraTiles, uraDoraTiles, beiDora, gameSettings); // test if enough if (gameSettings.CheckConstraint(point)) { operations.Add(new OutTurnOperation { Type = OutTurnOperationType.Rong, Tile = discardTile, HandData = CurrentRoundStatus.HandData(playerIndex) }); } }
private PointInfo GetRongInfo(int playerIndex, Tile discard) { var baseHandStatus = HandStatus.Nothing; // test haidi if (MahjongSet.TilesRemain == gameSettings.MountainReservedTiles) { baseHandStatus |= HandStatus.Haidi; } // test rob kong if (IsRobKong) { baseHandStatus |= HandStatus.RobKong; } // test lingshang -- not gonna happen var allTiles = MahjongSet.AllTiles; var doraTiles = MahjongSet.DoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var uraDoraTiles = MahjongSet.UraDoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var beiDora = CurrentRoundStatus.GetBeiDora(playerIndex); var point = ServerMahjongLogic.GetPointInfo( playerIndex, CurrentRoundStatus, discard, baseHandStatus, doraTiles, uraDoraTiles, beiDora, gameSettings); Debug.Log($"TurnEndState: pointInfo: {point}"); return(point); }
private PointInfo GetRongInfo(int playerIndex, Tile tile) { var baseHandStatus = HandStatus.RobKong; var allTiles = MahjongSet.AllTiles; var doraTiles = MahjongSet.DoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var uraDoraTiles = MahjongSet.UraDoraIndicators.Select( indicator => MahjongLogic.GetDoraTile(indicator, allTiles)).ToArray(); var beiDora = CurrentRoundStatus.GetBeiDora(playerIndex); var point = ServerMahjongLogic.GetPointInfo( playerIndex, CurrentRoundStatus, tile, baseHandStatus, doraTiles, uraDoraTiles, beiDora, gameSettings); return(point); }
public static void TestDora() { var allTiles = MahjongConstants.TwoPlayerTiles; var indicator = new Tile(Suit.Z, 2); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.Z, 7); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.Z, 4); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.S, 7); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.S, 9); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.S, 1); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.M, 1); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.M, 4); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); indicator = new Tile(Suit.M, 9); Debug.Log($"When indicator is {indicator}, dora is {MahjongLogic.GetDoraTile(indicator, allTiles)}"); }