Sliding pieces moves are now illegal if it's after the enemy
This commit is contained in:
@@ -22,6 +22,14 @@ final class Rook: Piece, LinearMoves {
|
||||
}
|
||||
if last == nil {
|
||||
legalPositions.append(position)
|
||||
if let square = delegate?.getSquareInfo(on: position),
|
||||
let piece = square.piece
|
||||
{
|
||||
if piece.color != color {
|
||||
delegate?.notify(.piecePinned(from: self, on: piece))
|
||||
last = position
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user