Exemplo n.º 1
0
            public static List <Pos> CanKill(Figure thfg, Pos cell, byte owner, IList <Figure> pieces)
            {
                if (thfg.Owner == owner)
                {
                    return(null);
                }

                switch (thfg.Type)
                {
                case FigureType.Pawn:
                    return(Figurest.CanKillPawnMovement(thfg, cell, thfg.Owner));

                case FigureType.King:
                    return(Figurest.CanKillKingMovement(thfg, cell, thfg.Owner));

                case FigureType.Queen:
                    return(Figurest.CanKillQueenMovement(thfg, cell, pieces));

                case FigureType.Rook:
                    return(Figurest.CanKillRookMovement(thfg, cell, pieces));

                case FigureType.Knight:
                    return(Figurest.CanKillKnightMovement(thfg, cell));

                case FigureType.Bishop:
                    return(Figurest.CanKillBishopMovement(thfg, cell, pieces));
                }
                return(null);
            }
Exemplo n.º 2
0
            public static List <Pos> CanKillKingMovement(Figure thfg, Pos cell, byte owner)
            {
                List <Pos> res = Figurest.CanKillPawnMovement(thfg, cell, 2);

                if (res != null)
                {
                    return(res);
                }
                res = Figurest.CanMovePawnMovement(thfg, cell, 2);
                if (res != null)
                {
                    return(res);
                }
                if (cell.Y == thfg.Cell.Y && cell.X == thfg.Cell.X + 1)
                {
                    return(new List <Pos>());
                }
                if (cell.Y == thfg.Cell.Y && cell.X == thfg.Cell.X - 1)
                {
                    return(new List <Pos>());
                }

                return(null);
            }