2023-05-19 17:13:41 +02:00
|
|
|
public class Heros extends Case {
|
|
|
|
|
|
|
|
private Arme arme;
|
|
|
|
private int pv;
|
|
|
|
|
2023-06-23 13:40:21 +02:00
|
|
|
public Heros(int x, int y, String t, int pdv) {
|
|
|
|
super(x, y, t);
|
|
|
|
this.pv = pdv;
|
|
|
|
this.arme = new Arme(0, x, y, "arme");
|
2023-05-19 17:13:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-06-23 13:40:21 +02:00
|
|
|
public void setArme(int atk, String type){
|
2023-05-19 17:13:41 +02:00
|
|
|
this.arme.value=atk;
|
2023-06-23 13:40:21 +02:00
|
|
|
this.arme.type=type;
|
2023-05-19 17:13:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean rencontrer(Case c) {
|
|
|
|
if (c.type.equals("or")) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (c.type.equals("arme")) {
|
|
|
|
return true;
|
|
|
|
}
|
2023-06-23 13:40:21 +02:00
|
|
|
if (c.type.equals("armefeu")) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (c.type.equals("armeglace")) {
|
|
|
|
return true;
|
|
|
|
}
|
2023-05-19 17:13:41 +02:00
|
|
|
if (c.type.equals("potion")) {
|
2023-06-23 13:40:21 +02:00
|
|
|
if (this.type.equals("mage")){
|
|
|
|
this.pv += c.getValue();
|
|
|
|
}
|
2023-05-19 17:13:41 +02:00
|
|
|
this.pv += c.getValue();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (c.type.equals("monstre")) {
|
|
|
|
if (this.arme.value > 0) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2023-06-23 13:40:21 +02:00
|
|
|
if (c.type.equals("monstrefeu")) {
|
|
|
|
if (this.arme.value > 0) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (c.type.equals("monstreglace")) {
|
|
|
|
if (this.arme.value > 0) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2023-05-19 17:13:41 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|