You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package modeles;
|
|
|
|
|
|
/**
|
|
|
* @author flavien
|
|
|
*
|
|
|
*/
|
|
|
public abstract class Objet {
|
|
|
private String nom;
|
|
|
private int prix;
|
|
|
private int usure;
|
|
|
private Personnage proprietaire;
|
|
|
|
|
|
public Objet() {}
|
|
|
public Objet(String nm, int valeur, int resistance) {
|
|
|
this.nom=nm;
|
|
|
this.prix=valeur;
|
|
|
this.usure=resistance;
|
|
|
}
|
|
|
|
|
|
public int getPrix() {
|
|
|
return this.prix;
|
|
|
}
|
|
|
|
|
|
public String getNom() {
|
|
|
return this.nom;
|
|
|
}
|
|
|
|
|
|
public int getUsure() {
|
|
|
return this.usure;
|
|
|
}
|
|
|
|
|
|
public void utilisation() { // diminue la r<>sistance de l'objet
|
|
|
this.usure--;
|
|
|
if (this.usure == 0) System.out.println(this.nom+"s'est cass<73>e !");
|
|
|
}
|
|
|
|
|
|
public abstract String getType();
|
|
|
|
|
|
public Personnage getProprietaire() {
|
|
|
return this.proprietaire;
|
|
|
}
|
|
|
|
|
|
public void setProprietaire(Personnage perso) {
|
|
|
this.proprietaire=perso;
|
|
|
}
|
|
|
|
|
|
public void lacher() {
|
|
|
this.proprietaire=null;
|
|
|
}
|
|
|
}
|