ConditionTests 100% Coverage
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
package personnage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import condition.Condition;
|
||||
import condition.ConditionMultiple;
|
||||
import condition.ConditionStatistiques;
|
||||
@ -12,18 +15,19 @@ import main.Plateau;
|
||||
|
||||
public class Allie extends Unique{
|
||||
|
||||
public Allie(String nom, int hp, Joueur joueur) {
|
||||
public Allie(String nom, int hp, Joueur joueur) throws Exception {
|
||||
super(nom, hp, joueur);
|
||||
|
||||
Action action = new ActionAltererStatistiquesJoueur("HP",this.getPv(),false);
|
||||
Effet effet = new EffetSelf(action);
|
||||
this.setEffet(effet);
|
||||
|
||||
Condition winCondition = new ConditionMultiple(
|
||||
|
||||
new ConditionStatistiques(ConditionStatistiques.PLATEAU, Plateau.PARTIE_FINIE, 1, ConditionStatistiques.EQUAL)
|
||||
, new ConditionStatistiques(ConditionStatistiques.JOUEUR, Joueur.PLAYER_HP, 0, ConditionStatistiques.MORE)
|
||||
);
|
||||
List<Condition> conditions = new ArrayList<Condition>();
|
||||
|
||||
conditions.add(new ConditionStatistiques(ConditionStatistiques.PLATEAU, Plateau.PARTIE_FINIE, 1, ConditionStatistiques.EQUAL));
|
||||
conditions.add(new ConditionStatistiques(ConditionStatistiques.JOUEUR, Joueur.PLAYER_HP, 0, ConditionStatistiques.MORE));
|
||||
|
||||
Condition winCondition = new ConditionMultiple(conditions);
|
||||
|
||||
this.setCondition(winCondition);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import main.Joueur;
|
||||
|
||||
public class Bob extends CartePersonnage{
|
||||
|
||||
public Bob(String nom, int hp, Joueur joueur) {
|
||||
public Bob(String nom, int hp, Joueur joueur) throws Exception {
|
||||
super(nom, hp, joueur);
|
||||
Condition condition = new ConditionStatistiques(ConditionStatistiques.JOUEUR, Joueur.PLAYER_NB_EQUIPEMENTS, 5, ConditionStatistiques.MORE);
|
||||
this.setCondition(condition);
|
||||
|
@ -1,5 +1,8 @@
|
||||
package personnage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import condition.Condition;
|
||||
import condition.ConditionMultiple;
|
||||
import condition.ConditionMultipleOR;
|
||||
@ -10,21 +13,24 @@ import main.Plateau;
|
||||
|
||||
public class Daniel extends CartePersonnage{
|
||||
|
||||
public Daniel(String nom, int pv, Joueur joueur) {
|
||||
public Daniel(String nom, int pv, Joueur joueur) throws Exception {
|
||||
super(nom, pv, joueur);
|
||||
|
||||
int nbShadow = joueur.getPlateau().getStat(Plateau.NB_SHADOWS);
|
||||
|
||||
Condition winCondition = new ConditionMultipleOR(
|
||||
|
||||
// Mort en premier
|
||||
new ConditionMultiple(
|
||||
new ConditionStatistiques(ConditionStatistiques.JOUEUR, Joueur.PLAYER_HP, 0, ConditionStatistiques.LESS)
|
||||
,new ConditionStatistiques(ConditionStatistiques.PLATEAU, Plateau.NB_MORTS, 1, ConditionStatistiques.LESS)
|
||||
)
|
||||
// Shadows morts
|
||||
,new WinConditionHunter()
|
||||
);
|
||||
List<Condition> conditions = new ArrayList<Condition>();
|
||||
List<Condition> conditions2 = new ArrayList<Condition>();
|
||||
|
||||
conditions.add(new WinConditionHunter());
|
||||
|
||||
conditions2.add(new ConditionStatistiques(ConditionStatistiques.JOUEUR, Joueur.PLAYER_HP, 0, ConditionStatistiques.LESS));
|
||||
conditions2.add(new ConditionStatistiques(ConditionStatistiques.PLATEAU, Plateau.NB_MORTS, 1, ConditionStatistiques.LESS));
|
||||
|
||||
conditions.add(new ConditionMultiple(conditions2));
|
||||
|
||||
|
||||
Condition winCondition = new ConditionMultipleOR(conditions);
|
||||
|
||||
this.setCondition(winCondition);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user