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
|
|
|
|
|
|
|
|
2019-05-12 21:43:29 +02:00
|
|
|
private String couleur = "";
|
2019-05-09 19:58:45 +02:00
|
|
|
//private String lettre = "..";
|
|
|
|
private String nom = "..";
|
2019-03-20 14:14:08 +01:00
|
|
|
private boolean enVie = true;
|
2019-05-03 23:11:52 +02:00
|
|
|
private Position position;
|
2019-05-04 21:08:15 +02:00
|
|
|
private Position ini;
|
2019-05-09 10:26:09 +02:00
|
|
|
private boolean verif = false;
|
2019-03-20 14:14:08 +01:00
|
|
|
|
|
|
|
//constructeur par defaut qui devrait probablement remplacer vide
|
|
|
|
|
|
|
|
public Piece()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// constructeur
|
2019-05-03 19:19:37 +02:00
|
|
|
public Piece(Position pos)
|
|
|
|
{
|
|
|
|
position = pos;
|
|
|
|
}
|
2019-03-20 14:14:08 +01:00
|
|
|
|
2019-05-03 23:53:45 +02:00
|
|
|
|
2019-05-04 21:08:15 +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;
|
2019-05-09 19:58:45 +02:00
|
|
|
this.nom = l;
|
2019-05-03 19:19:37 +02:00
|
|
|
//this.emplacementIni = emp;
|
2019-05-03 18:32:02 +02:00
|
|
|
this.position = pos;
|
2019-05-04 21:08:15 +02:00
|
|
|
this.ini=pos;
|
|
|
|
|
2019-03-20 14:14:08 +01:00
|
|
|
}
|
2019-04-23 17:03:08 +02:00
|
|
|
|
2019-05-09 10:26:09 +02: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
|
|
|
|
|
2019-05-09 19:58:45 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-05-04 21:08:15 +02:00
|
|
|
public Position getIni() {
|
|
|
|
return ini;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setIni(Position ini) {
|
|
|
|
this.ini = ini;
|
|
|
|
}
|
|
|
|
|
2019-05-09 10:54:41 +02:00
|
|
|
public boolean deplacable(Echiquier e,Piece p)
|
2019-05-03 18:32:02 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-23 17:03:08 +02:00
|
|
|
|
2019-03-20 14:14:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|