CarteLieu possède désormais ses propres pioches
This commit is contained in:
@ -2,19 +2,21 @@ package carte;
|
||||
|
||||
import java.util.List;
|
||||
import main.Joueur;
|
||||
import main.Pioche;
|
||||
import main.Type;
|
||||
import main.TypeLumiere;
|
||||
|
||||
|
||||
public class CarteLieu extends CarteEffet{
|
||||
public class CarteLieu<T extends Type> extends CarteEffet{
|
||||
|
||||
private Type field;
|
||||
|
||||
// Liste des joueurs actuellement présentsur le lieu
|
||||
private Pioche<T> piocheLumiere;
|
||||
private List<Joueur> listeJoueur;
|
||||
|
||||
|
||||
public void utiliser(Joueur j) {
|
||||
super.utiliser(j);
|
||||
|
||||
CartePiochable<?> carte = piocheLumiere.piocher();
|
||||
carte.utiliser(j);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class ActionAttaquer extends Action {
|
||||
*/
|
||||
@Override
|
||||
public void affecte(Joueur j1, Joueur j2) {
|
||||
|
||||
|
||||
Plateau p = j1.getPlateau();
|
||||
p.attaquer(j1, j2);
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
package effet.action;
|
||||
|
||||
import main.Joueur;
|
||||
|
||||
public class ActionPiocher extends Action{
|
||||
|
||||
public ActionPiocher() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lance l'action de piocher une carte.
|
||||
* @param j1 Le joueur qui lance l'action
|
||||
* @param j2 Le joueur qui subit l'action
|
||||
* @return void
|
||||
*/
|
||||
@Override
|
||||
public void affecte(Joueur j1, Joueur j2) {
|
||||
j2.piocher();
|
||||
}
|
||||
|
||||
}
|
@ -10,12 +10,13 @@ import personnage.CartePersonnage;
|
||||
|
||||
public class Joueur {
|
||||
private GestionnaireEquipements gestionnaireEquipements;
|
||||
|
||||
private String nom;
|
||||
private boolean revele;
|
||||
private Plateau plateau;
|
||||
private CartePersonnage cartePersonnage;
|
||||
private Equipe equipe;
|
||||
private CarteLieu carteLieu;
|
||||
|
||||
|
||||
// map keys
|
||||
public static final String PLAYER_HP = "hp";
|
||||
@ -79,8 +80,10 @@ public class Joueur {
|
||||
}
|
||||
|
||||
public List<Joueur> getJoueursAdjacents() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
||||
List<Joueur> joueurs = this.carteLieu.getJoueursAdjacents();
|
||||
joueurs.remove(this);
|
||||
return joueurs;
|
||||
}
|
||||
|
||||
public Equipement[] getEquipements() {
|
||||
@ -98,11 +101,6 @@ public class Joueur {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void piocher() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void attaquer(Joueur j2, int attaqueDice) {
|
||||
|
||||
int blessure = evaluerImmunite(j2)*(this.evaluerAttaque(j2) + attaqueDice);
|
||||
@ -155,9 +153,7 @@ public class Joueur {
|
||||
}
|
||||
|
||||
public void setCartePersonnage(CartePersonnage cp) {
|
||||
|
||||
this.cartePersonnage = cp;
|
||||
|
||||
}
|
||||
|
||||
public void setEquipe(Equipe equipe) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package main;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
import carte.CartePiochable;
|
||||
@ -9,7 +10,13 @@ public class Pioche<T extends Type> {
|
||||
|
||||
private Stack<CartePiochable<T>> cartesPiochables;
|
||||
|
||||
|
||||
public Pioche(List<CartePiochable<T>> cartesPiochables) {
|
||||
super();
|
||||
this.cartesPiochables = new Stack<CartePiochable<T>>();
|
||||
this.cartesPiochables.addAll(cartesPiochables);
|
||||
melanger();
|
||||
}
|
||||
|
||||
public void melanger()
|
||||
{
|
||||
Collections.shuffle(cartesPiochables);
|
||||
|
@ -23,13 +23,7 @@ public class Plateau {
|
||||
|
||||
private Map<String, Integer> stats;
|
||||
|
||||
|
||||
private Pioche<TypeLumiere> piocheLumiere;
|
||||
private Pioche<TypeTenebre> piocheTenebre;
|
||||
private Pioche<TypeVision> piocheVision;
|
||||
|
||||
|
||||
|
||||
|
||||
public Plateau(List<Joueur> joueurs) {
|
||||
this.joueurs = joueurs;
|
||||
this.lieux = new ArrayList<>();
|
||||
@ -54,8 +48,8 @@ public class Plateau {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void fairePiocher(Joueur joueur, Type type) {
|
||||
|
||||
public void piocher(Joueur joueur, Type type) {
|
||||
|
||||
}
|
||||
|
||||
public void déplacerJoueur(Joueur joueur, int indexLieu) {
|
||||
@ -70,7 +64,6 @@ public class Plateau {
|
||||
|
||||
joueur1.attaquer(joueur2,attaque);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -86,8 +79,6 @@ public class Plateau {
|
||||
return (int) Math.floor(Math.random() * 3)+1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int rollDices4() {
|
||||
return Math.abs(roll4() - roll4());
|
||||
}
|
||||
|
Reference in New Issue
Block a user