2021-12-01 19:55:46 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2021-11-30 22:02:55 +00:00
|
|
|
public class Action {
|
2021-12-01 19:55:46 +00:00
|
|
|
Condition visible;
|
2021-12-01 07:58:07 +00:00
|
|
|
List<Connaissance> connaissances;
|
|
|
|
List<Objet> objetsRecus;
|
|
|
|
List<Objet> objetsConso;
|
|
|
|
Condition finInterraction;
|
2021-12-01 19:55:46 +00:00
|
|
|
List<Description> descriptions;
|
2021-11-30 22:02:55 +00:00
|
|
|
|
|
|
|
public Action(
|
2021-12-01 19:55:46 +00:00
|
|
|
Condition visible,
|
2021-12-01 08:48:38 +00:00
|
|
|
List<Connaissance> connaissances,
|
|
|
|
List<Objet> objetsRecus,
|
2021-12-01 07:58:07 +00:00
|
|
|
List<Objet> objetsConso,
|
2021-12-01 19:55:46 +00:00
|
|
|
Condition finInterraction,
|
|
|
|
List<Description> descriptions) {
|
2021-11-30 22:02:55 +00:00
|
|
|
this.visible = visible;
|
2021-12-01 19:55:46 +00:00
|
|
|
this.connaissances = connaissances;
|
2021-12-01 08:48:38 +00:00
|
|
|
this.objetsRecus = objetsRecus;
|
2021-11-30 22:02:55 +00:00
|
|
|
this.objetsConso = objetsConso;
|
2021-12-01 07:58:07 +00:00
|
|
|
this.finInterraction = finInterraction;
|
2021-12-01 19:55:46 +00:00
|
|
|
this.descriptions = descriptions;
|
|
|
|
}
|
|
|
|
|
2021-12-02 13:23:06 +00:00
|
|
|
void actionner() {
|
|
|
|
for (Connaissance c : this.connaissances) {
|
|
|
|
if (!Jeu.explorateur.connaissances.contains(c)) {
|
|
|
|
Jeu.explorateur.connaissances.add(c);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Objet o : this.objetsRecus) {
|
|
|
|
Jeu.explorateur.objets.add(o);
|
|
|
|
}
|
|
|
|
for (Objet o : this.objetsConso) {
|
|
|
|
Jeu.explorateur.objets.remove(o);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-01 19:55:46 +00:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
for (Description d : this.descriptions) {
|
|
|
|
if (d.condition.evaluer()) {
|
|
|
|
return d.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "No desc";
|
2021-11-30 22:02:55 +00:00
|
|
|
}
|
|
|
|
}
|