public static void Test3Dragons() { var handTiles = new List <Tile> { new Tile(Suit.S, 4), new Tile(Suit.S, 5), new Tile(Suit.S, 6), new Tile(Suit.Z, 2), new Tile(Suit.Z, 2), new Tile(Suit.Z, 5), new Tile(Suit.Z, 5) }; var openMelds = new List <Meld> { new Meld(false, new Tile(Suit.Z, 6), new Tile(Suit.Z, 6), new Tile(Suit.Z, 6), new Tile(Suit.Z, 6)), new Meld(true, new Tile(Suit.Z, 7), new Tile(Suit.Z, 7), new Tile(Suit.Z, 7)) }; var settings = new GameSetting(); var handStatus = HandStatus.Tsumo; var roundStatus = new RoundStatus { PlayerIndex = 0, OyaPlayerIndex = 1, FieldCount = 0, TotalPlayer = 2 }; var pointInfo = MahjongLogic.GetPointInfo(handTiles.ToArray(), openMelds.ToArray(), new Tile(Suit.Z, 2), handStatus, roundStatus, settings, false); Debug.Log($"Point: {pointInfo}"); }
/// <summary> /// Note: lingshang and haidi should be obtained in baseHandStatus /// </summary> /// <param name="playerIndex"></param> /// <param name="CurrentRoundStatus"></param> /// <param name="winningTile"></param> /// <param name="baseHandStatus"></param> /// <returns></returns> public static PointInfo GetPointInfo(int playerIndex, ServerRoundStatus CurrentRoundStatus, Tile winningTile, HandStatus baseHandStatus, Tile[] doraTiles, Tile[] uraDoraTiles, int beiDora, GameSetting yakuSettings) { var zhenting = CurrentRoundStatus.IsZhenting(playerIndex); if (zhenting && !baseHandStatus.HasFlag(HandStatus.Tsumo)) { return(new PointInfo()); } var handData = CurrentRoundStatus.HandData(playerIndex); var handStatus = baseHandStatus; if (MahjongLogic.TestMenqing(handData.Melds)) { handStatus |= HandStatus.Menqing; } // test richi if (CurrentRoundStatus.RichiStatus(playerIndex)) { handStatus |= HandStatus.Richi; // test one-shot if (yakuSettings.HasOneShot && CurrentRoundStatus.OneShotStatus(playerIndex)) { handStatus |= HandStatus.OneShot; } // test WRichi if (CurrentRoundStatus.FirstTurn) { handStatus |= HandStatus.WRichi; } } // test first turn if (CurrentRoundStatus.FirstTurn) { handStatus |= HandStatus.FirstTurn; } var roundStatus = new RoundStatus { PlayerIndex = playerIndex, OyaPlayerIndex = CurrentRoundStatus.OyaPlayerIndex, CurrentExtraRound = CurrentRoundStatus.Extra, RichiSticks = CurrentRoundStatus.RichiSticks, FieldCount = CurrentRoundStatus.Field, TotalPlayer = CurrentRoundStatus.TotalPlayers }; var isQTJ = CurrentRoundStatus.GameSettings.GameMode == GameMode.QTJ; return(MahjongLogic.GetPointInfo(handData.HandTiles, handData.Melds, winningTile, handStatus, roundStatus, yakuSettings, isQTJ, doraTiles, uraDoraTiles, beiDora)); }
public static PointInfo GetPointInfo(string handString, string winningString, bool richi, bool tsumo, bool isQTJ) { var handStatus = HandStatus.Menqing; if (richi) { handStatus |= HandStatus.Richi; } if (tsumo) { handStatus |= HandStatus.Tsumo; } var roundStatus = new RoundStatus(); var tiles = ParseTiles(handString); var winningTiles = ParseTiles(winningString); var gameSettings = new GameSetting(); var point = MahjongLogic.GetPointInfo(tiles.ToArray(), new Meld[0], winningTiles[0], handStatus, roundStatus, gameSettings, isQTJ); return(point); }