コード例 #1
0
ファイル: PlayerDrawTileState.cs プロジェクト: isaveu/Mahjong
        private void TestRichi(int playerIndex, Tile[] handTiles, Meld[] openMelds, IList <InTurnOperation> operations)
        {
            var alreadyRichied = CurrentRoundStatus.RichiStatus(playerIndex);

            if (alreadyRichied)
            {
                return;
            }
            var availability = gameSettings.AllowRichiWhenPointsLow || CurrentRoundStatus.GetPoints(playerIndex) >= gameSettings.RichiMortgagePoints;

            if (!availability)
            {
                return;
            }
            IList <Tile> availableTiles;

            if (MahjongLogic.TestRichi(handTiles, openMelds, justDraw, gameSettings.AllowRichiWhenNotReady, out availableTiles))
            {
                operations.Add(new InTurnOperation
                {
                    Type = InTurnOperationType.Richi,
                    RichiAvailableTiles = availableTiles.ToArray()
                });
            }
        }
コード例 #2
0
ファイル: ConsoleCommands.cs プロジェクト: isaveu/Mahjong
        public static bool TestRichi(string tileString, string lastDraw)
        {
            var          tiles = ParseTiles(tileString);
            var          tile  = ParseTiles(lastDraw)[0];
            IList <Tile> availables;
            var          result = MahjongLogic.TestRichi(tiles, new List <Meld>(), tile, false, out availables);

            Debug.Log($"Candidates: {string.Join(",", availables)}");
            return(result);
        }