Beispiel #1
0
        private void OnCapture(Piece capturedPiece)
        {
            var captureMove = new CaptureMove(Field, capturedPiece.Field, this, capturedPiece);
            var e           = new CaptureEvent(captureMove);

            Capture?.Invoke(this, e);
        }
Beispiel #2
0
 public bool InCheck(BoardState boardState, Alliance alliance)
 {
     foreach (Tile tile in boardState.Tiles)
     {
         if (!tile.IsVacant)
         {
             bool EnemyPiece = !(tile.Piece.Alliance == alliance);
             if (EnemyPiece)
             {
                 ReadOnlyCollection <Move> CandidateMoves = tile.Piece.GetCandidateMoves(boardState);
                 foreach (Move CandidateMove in CandidateMoves)
                 {
                     if (CandidateMove is CaptureMove)
                     {
                         CaptureMove captureMove = CandidateMove as CaptureMove;
                         if (captureMove.CapturedPiece is King)
                         {
                             King TargetKing = captureMove.CapturedPiece as King;
                             if (TargetKing.Alliance == alliance)
                             {
                                 return(true);
                             }
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }
Beispiel #3
0
 public PromotionCaptureMove(CaptureMove move) : base(move.Piece, move.To, move.CapturedPiece)
 {
 }
Beispiel #4
0
 public CaptureEventArgs(CaptureMove captureMove)
     : base(captureMove)
 {
 }