SAe/SAe2.1/commentente/SAé/Heros.java

53 lines
996 B
Java
Raw Normal View History

2023-05-19 17:13:41 +02:00
public class Heros extends Case {
private Arme arme;
private int pv;
public Heros(int x, int y) {
super(x, y, "hero");
this.pv = 250;
this.arme = new Arme(0, x, y);
}
public String getLabelPv() {
return String.valueOf(this.pv);
}
public int getPv(){
return this.pv;
}
public void setPv(int pdv){
this.pv=pdv;
}
public Arme getArme(){
return this.arme;
}
public void setArme(int atk){
this.arme.value=atk;
}
public boolean rencontrer(Case c) {
if (c.type.equals("or")) {
return true;
}
if (c.type.equals("arme")) {
return true;
}
if (c.type.equals("potion")) {
this.pv += c.getValue();
return true;
}
if (c.type.equals("monstre")) {
if (this.arme.value > 0) {
return false;
} else {
return true;
}
}
return false;
}
}