108 lines
1.5 KiB
Java
Raw Normal View History

2019-03-20 14:14:08 +01:00
package piecesEchiquier;
2019-05-09 11:08:09 +02:00
public class Piece {
2019-03-20 14:14:08 +01:00
private String couleur = "";
//private String lettre = "..";
private String nom = "..";
2019-03-20 14:14:08 +01:00
private boolean enVie = true;
private Position position;
private Position ini;
private boolean verif = false;
2019-03-20 14:14:08 +01:00
//constructeur par defaut qui devrait probablement remplacer vide
public Piece()
{
}
// constructeur
public Piece(Position pos)
{
position = pos;
}
2019-03-20 14:14:08 +01:00
2019-05-03 23:53:45 +02:00
public Piece(String couleur,String l, Position pos)
2019-03-20 14:14:08 +01:00
{
2019-05-03 18:32:02 +02:00
this.couleur = couleur;
this.nom = l;
//this.emplacementIni = emp;
2019-05-03 18:32:02 +02:00
this.position = pos;
this.ini=pos;
2019-03-20 14:14:08 +01:00
}
public boolean aBouge()
{
if(this.getIni() != this.getPosition())
{
verif=true;
}
if(this.getIni() == this.getPosition() && verif == false)
{
verif=false;
}
return verif;
}
2019-03-20 14:14:08 +01:00
// gets & sets
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
2019-03-20 14:14:08 +01:00
////////////
public boolean isEnVie() {
return enVie;
}
public void setEnVie(boolean enVie) {
this.enVie = enVie;
}
///////////
2019-05-03 18:32:02 +02:00
public String getCouleur() {
2019-03-20 14:14:08 +01:00
return couleur;
}
2019-05-03 18:32:02 +02:00
public void setCouleur(String couleur) {
2019-03-20 14:14:08 +01:00
this.couleur = couleur;
}
2019-05-03 18:32:02 +02:00
public Position getPosition() {
return position;
}
public void setPosition(Position position) {
this.position = position;
}
public Position getIni() {
return ini;
}
public void setIni(Position ini) {
this.ini = ini;
}
public boolean deplacable(Echiquier e,Piece p)
2019-05-03 18:32:02 +02:00
{
return true;
}
2019-03-20 14:14:08 +01:00
}