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)); } }
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)); }
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)); }
internal override bool CanExecute(VisibleBoard board, DrawActions possibleActions) { return(possibleActions.HasFlag(DrawActions.KyuushuKyuuhai)); }
internal override bool CanExecute(VisibleBoard board, DrawActions possibleActions) { return(possibleActions.HasFlag(DrawActions.Riichi) && HasTile(board, _tile) && board.Watashi.Hand.ShantenAfterDiscard(_tile.TileType) == 0); }