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.
49 lines
865 B
Java
49 lines
865 B
Java
package modeles;
|
|
|
|
|
|
public abstract class Objet {
|
|
private String nom;
|
|
private int prix;
|
|
private int usure;
|
|
private Personnage proprietaire;
|
|
|
|
|
|
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é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;
|
|
}
|
|
}
|
|
|