-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassantShadow.java
More file actions
36 lines (29 loc) · 869 Bytes
/
PassantShadow.java
File metadata and controls
36 lines (29 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* A PassantShadow is simply a phantom piece that exists only for one turn
* that allows pawns to capture via en passant.
*/
@SuppressWarnings("serial")
public class PassantShadow extends Piece{
//The pawn to which the shadow is tied
Pawn pass;
public PassantShadow(Shade clr, int[] startCoords, Chessboard cb,
Pawn p) throws IllegalArgumentException {
super(clr, startCoords, cb, "");
pass = p;
}
//A method killing this shadow as well as the it shadows
public void kill(){
alive = false;
c.getSquare(coords).clear();
pass.kill();
}
//A method killing this shadow as a means of tying loose ends
public void remove(){
alive = false;
}
//A special override of the main revive function to revive the pawn to which it is tied, as well.
public void revive(){
alive = true;
c.getSquare(coords).place(this);
pass.revive();
}
}