Ejemplo n.º 1
0
        // addtion 为 true 时, 返回结果包括 马腿 象眼 炮架.
        public HashSet <PiecePoint> GetActionPoints(ChessBoard board, ChessPiece piece, bool addition = false)
        {
            if (ActionWayData != null)
            {
                return(GetActionPoints(
                           board,
                           piece,
                           ActionWayData.WayDirections,
                           ActionWayData.EyeDirections,
                           ActionWayData.IsStepPiece,
                           ActionWayData.IsCannon,
                           ActionWayData.IsKing,
                           addition));
            }

            var actionPoints = new HashSet <PiecePoint>();
            var baseTypes    = piece.BaseTypes ?? new PieceType[0];

            foreach (var type in baseTypes)
            {
                var actionWay = ActionWayRule.GetActionWay(type);
                actionPoints.UnionWith(actionWay.GetActionPoints(board, piece, addition));
            }
            return(actionPoints);
        }
Ejemplo n.º 2
0
        public HashSet <PiecePoint> GetActionPoints(ChessBoard board, bool addition = false)
        {
            var actionWay = ActionWayRule.GetActionWay(PieceType);

            return(actionWay.GetActionPoints(board, this, addition));
        }