86 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
package pp.mdga.game;
 | 
						|
 | 
						|
/**
 | 
						|
 * This class will be used to hold all Piece relevant data.
 | 
						|
 */
 | 
						|
public class Piece {
 | 
						|
    private ShieldState shield;
 | 
						|
    private PieceState state;
 | 
						|
    private final Color color;
 | 
						|
 | 
						|
    /**
 | 
						|
     * This constructor is used to create a new Piece
 | 
						|
     *
 | 
						|
     * @param color the color of the piece
 | 
						|
     * @param state the state of the piece
 | 
						|
     */
 | 
						|
    public Piece(Color color, PieceState state) {
 | 
						|
        this.color = color;
 | 
						|
        this.state = state;
 | 
						|
        shield = ShieldState.NONE;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * This method is used to get the color of the piece
 | 
						|
     *
 | 
						|
     * @return the color of the piece
 | 
						|
     */
 | 
						|
    public void setShield(ShieldState shield) {
 | 
						|
        this.shield = shield;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * This method is used to get the color of the piece
 | 
						|
     *
 | 
						|
     * @return the color of the piece
 | 
						|
     */
 | 
						|
    public ShieldState getShield() {
 | 
						|
        return shield;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * This method is used to get the color of the piece
 | 
						|
     *
 | 
						|
     * @param state the state of the piece
 | 
						|
     */
 | 
						|
    public void setState(PieceState state) {
 | 
						|
        this.state = state;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * This method is used to get the color of the piece
 | 
						|
     *
 | 
						|
     * @return the color of the piece
 | 
						|
     */
 | 
						|
    public PieceState getState() {
 | 
						|
        return state;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * This method is used to get the color of the piece
 | 
						|
     *
 | 
						|
     * @return the color of the piece
 | 
						|
     */
 | 
						|
    public boolean isShielded() {
 | 
						|
        return shield == ShieldState.ACTIVE;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * This method is used to get the color of the piece
 | 
						|
     *
 | 
						|
     * @return the color of the piece
 | 
						|
     */
 | 
						|
    public boolean isSuppressed() {
 | 
						|
        return shield == ShieldState.SUPPRESSED;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * This method is used to get the color of the piece
 | 
						|
     *
 | 
						|
     * @return the color of the piece
 | 
						|
     */
 | 
						|
    public Color getColor() {
 | 
						|
        return color;
 | 
						|
    }
 | 
						|
}
 |