Esempio n. 1
0
        public DrawResponse OnDraw(VisibleBoard board, Tile tile, DrawActions suggestedActions)
        {
            if (suggestedActions.HasFlag(DrawActions.Tsumo))
            {
                return(DrawResponse.Tsumo());
            }

            if (suggestedActions.HasFlag(DrawActions.Riichi))
            {
                var tileTypeId = board.Watashi.Hand.GetHighestUkeIreDiscard();
                var discard    = board.Watashi.ConcealedTiles.First(i => i.TileType.TileTypeId == tileTypeId);
                return(DrawResponse.Riichi(discard));
            }

            if (suggestedActions.HasFlag(DrawActions.KyuushuKyuuhai) && (board.Watashi.Hand.Shanten > 2 || board.Seats.Any(s => s.DeclaredRiichi)))
            {
                return(DrawResponse.KyuushuKyuuhai());
            }

            {
                var tileTypeId = board.Watashi.Hand.GetHighestUkeIreDiscard();
                // Prefer tsumogiri
                if (tile.TileType.TileTypeId == tileTypeId)
                {
                    return(DrawResponse.Discard(tile));
                }

                var discard = board.Watashi.ConcealedTiles.First(i => i.TileType.TileTypeId == tileTypeId);
                return(DrawResponse.Discard(discard));
            }
        }
Esempio n. 2
0
 internal override bool CanExecute(VisibleBoard board, DrawActions possibleActions)
 {
     return(possibleActions.HasFlag(DrawActions.Kan) &&
            !board.Watashi.DeclaredRiichi &&
            HasTile(board, _tile) &&
            board.Watashi.Melds.Any(m => m.MeldType == MeldType.Koutsu && m.LowestTile.TileType == _tile.TileType));
 }
Esempio n. 3
0
            internal override bool CanExecute(VisibleBoard board, DrawActions possibleActions)
            {
                if (!possibleActions.HasFlag(DrawActions.Kan) || board.Watashi.ConcealedTiles.Count(t => t.TileType == _tileType) != 4 || board.Watashi.CurrentDraw == null)
                {
                    return(false);
                }

                return(!board.Watashi.DeclaredRiichi || !board.Watashi.Hand.IsUkeIreChangedByAnkan(board.Watashi.CurrentDraw.TileType, _tileType));
            }
Esempio n. 4
0
 internal override bool CanExecute(VisibleBoard board, DrawActions possibleActions)
 {
     return(possibleActions.HasFlag(DrawActions.KyuushuKyuuhai));
 }
Esempio n. 5
0
 internal override bool CanExecute(VisibleBoard board, DrawActions possibleActions)
 {
     return(possibleActions.HasFlag(DrawActions.Riichi) &&
            HasTile(board, _tile) &&
            board.Watashi.Hand.ShantenAfterDiscard(_tile.TileType) == 0);
 }