53 lines
996 B
Java
53 lines
996 B
Java
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;
|
|
}
|
|
}
|