Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="latestTile">The <see cref="LatestTile"/> value.</param>
        /// <param name="drawType">The <see cref="DrawType"/> value.</param>
        /// <param name="dominantWind">The <see cref="DominantWind"/> value.</param>
        /// <param name="playerWind">The <see cref="PlayerWind"/> value.</param>
        /// <param name="isFirstOrLast">Optionnal; indicates a win at the first turn without any call made (<c>True</c>) or at the last tile of the round (<c>Null</c>); default value is <c>False</c>.</param>
        /// <param name="isRiichi">Optionnal; indicates if riichi (<c>True</c>) or riichi at first turn without any call made (<c>Null</c>); default value is <c>False</c>.</param>
        /// <param name="isIppatsu">Optionnal; indicates if it's a win by ippatsu (<paramref name="isRiichi"/> can't be <c>False</c> in such case); default value is <c>False</c>.</param>
        /// <param name="useRenhou">Optionnal; the <see cref="_useRenhou"/> value; default value is <c>False</c>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="latestTile"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentException"><see cref="Messages.InvalidContextIppatsuValue"/></exception>
        public WinContextPivot(TilePivot latestTile, DrawTypePivot drawType, WindPivot dominantWind, WindPivot playerWind,
                               bool?isFirstOrLast = false, bool?isRiichi = false, bool isIppatsu = false, bool useRenhou = false)
        {
            if (isRiichi == false && isIppatsu)
            {
                throw new ArgumentException(Messages.InvalidContextIppatsuValue, nameof(isIppatsu));
            }

            LatestTile        = latestTile ?? throw new ArgumentNullException(nameof(latestTile));
            IsRoundLastTile   = isFirstOrLast == null;
            IsRiichi          = isRiichi != false;
            IsFirstTurnRiichi = isRiichi == null;
            IsIppatsu         = isIppatsu;
            DominantWind      = dominantWind;
            PlayerWind        = playerWind;
            IsFirstTurnDraw   = isFirstOrLast == true;
            DrawType          = drawType;
            _useRenhou        = useRenhou;
            IsNagashiMangan   = false;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Extension; checks if the specified <see cref="DrawTypePivot"/> is a self draw.
 /// </summary>
 /// <param name="drawType">The <see cref="DrawTypePivot"/>.</param>
 /// <returns><c>True</c> if self draw; <c>False</c> otherwise.</returns>
 public static bool IsSelfDraw(this DrawTypePivot drawType)
 {
     return(drawType == DrawTypePivot.Wall || drawType == DrawTypePivot.Compensation);
 }