2020-04-17 11:26:23 +02:00
|
|
|
package main;
|
|
|
|
|
2020-04-22 14:42:21 +02:00
|
|
|
import java.util.ArrayList;
|
2020-04-21 18:01:18 +02:00
|
|
|
import java.util.List;
|
2020-04-17 11:26:23 +02:00
|
|
|
|
2020-04-22 14:09:39 +02:00
|
|
|
import carte.Equipement;
|
2020-04-21 18:01:18 +02:00
|
|
|
|
2020-04-17 11:26:23 +02:00
|
|
|
public class GestionnaireEquipements {
|
2020-04-22 14:42:21 +02:00
|
|
|
|
|
|
|
private Joueur j;
|
|
|
|
private List<Equipement> equipements;
|
2020-04-21 18:01:18 +02:00
|
|
|
|
2020-04-22 14:42:21 +02:00
|
|
|
public GestionnaireEquipements(Joueur j) {
|
|
|
|
this.j = j;
|
|
|
|
this.equipements = new ArrayList<Equipement>();
|
2020-04-21 18:01:18 +02:00
|
|
|
}
|
2020-04-22 14:42:21 +02:00
|
|
|
|
|
|
|
public void ajouterEquipement(Equipement e) {
|
|
|
|
this.equipements.add(e);
|
|
|
|
e.utiliser(this.j);
|
|
|
|
this.j.addToStat(Joueur.PLAYER_NB_EQUIPEMENTS, 1);
|
2020-04-17 11:26:23 +02:00
|
|
|
}
|
2020-04-22 14:42:21 +02:00
|
|
|
|
|
|
|
public void retirerEquipement(Equipement e) {
|
|
|
|
if(this.equipements.contains(e)) {
|
|
|
|
e.reverse(j);
|
|
|
|
this.equipements.remove(e);
|
|
|
|
this.j.addToStat(Joueur.PLAYER_NB_EQUIPEMENTS, -1);
|
|
|
|
}
|
2020-04-21 18:01:18 +02:00
|
|
|
}
|
2020-04-22 14:42:21 +02:00
|
|
|
|
|
|
|
public void reverseEffect(Equipement e) {
|
|
|
|
e.reverse(j);
|
2020-04-21 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
2020-04-22 14:42:21 +02:00
|
|
|
public List<Equipement> getEquipements() {
|
|
|
|
return equipements;
|
2020-04-22 14:09:39 +02:00
|
|
|
}
|
2020-04-21 18:01:18 +02:00
|
|
|
|
2020-04-22 14:42:21 +02:00
|
|
|
}
|