Skip to content
Snippets Groups Projects
Commit 2278fd89 authored by CARION Baptiste's avatar CARION Baptiste
Browse files

Correction main et chevalier

parent 5b2c5ee3
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,12 @@ package main;
import java.util.Scanner;
import units.Chevalier;
import units.Paysant;
public class Main {
private static Joueur winner = new Joueur("Winner");
private static Joueur joueur1 = new Joueur("joueur1");
private static Joueur joueur2 = new Joueur("joueur2");
private int actionPoint;
static Main m = new Main();
......@@ -20,12 +22,15 @@ public class Main {
Plateau plateau = new Plateau();
int x = 11;
int y = 10;
int x = 5;
int y = 5;
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner));
winner.getArmee().get(0).getPlateau().getRegion(0,0).changeToCamp();
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, joueur1));
plateau.getCase(x+2, y+2).setUnite(new Paysant(x+2, y+2, plateau, joueur1));
plateau.getCase(x+20, y+20).setUnite(new Chevalier(x+20, y+20, plateau, joueur2));
joueur1.getArmee().get(0).getPlateau().getRegion(0,0).changeToCamp();
joueur2.getArmee().get(0).getPlateau().getRegion(0,0).changeToCamp();
a.affichage(plateau);
/*while(y<30) {
winner.getArmee().get(0).move(deplacement());*/
......@@ -47,7 +52,7 @@ public class Main {
}
if(continuer !=3) {
continuer =2;
m.game(new Joueur[]{winner,null}, plateau);
m.game(new Joueur[]{joueur1,joueur2}, plateau);
}
}
}
......@@ -74,6 +79,7 @@ public class Main {
}
public void Tour(Joueur currentPlayer, int actionPoint, Plateau plateau) {
System.out.println("Debut du tour de : " + currentPlayer.getNomJoueur());
for(int i =0; i<actionPoint; i++) {
Interface.tourDeJeu(plateau, currentPlayer);
}
......@@ -84,6 +90,7 @@ public class Main {
}
public void setActionPoint(Joueur currentPlayer) {
System.out.println("" + currentPlayer.getArmee().size() + (currentPlayer.getRoyaume().size() * 3));
this.actionPoint = currentPlayer.getArmee().size() + (currentPlayer.getRoyaume().size() * 3);
}
......@@ -93,10 +100,10 @@ public class Main {
public void setWinner(Joueur winner) {
this.winner = winner;
this.joueur1 = winner;
}
public Joueur getWinner() {
return this.winner;
return this.joueur1;
}
}
package units;
import java.util.Scanner;
import main.Joueur;
import main.Plateau;
......@@ -9,6 +11,7 @@ public class Chevalier extends Unite {
public static final int DAMAGE = 5;
public static final char SYMBOL = 'C';
public static final int VISION = 2;
public static final int PATOGIVE = 2;
public Chevalier(int x, int y, Plateau plateau, Joueur joueur) {
super(x,y, plateau, SYMBOL, ARMOR, DAMAGE, joueur, VISION);
......@@ -22,10 +25,47 @@ public class Chevalier extends Unite {
@Override
public boolean action() {
// TODO Auto-generated method stub
//TODO: le paysant doit regarder si il peut attaquer ou donne un PA pour le prochain tour
Scanner sc = new Scanner(System.in);
StringBuilder builder = new StringBuilder();
builder.append("Voici les action disponnible pour le Paysant ")
.append(this.getId()).append(":\n");
/*
if (this.getUnitCase().haveUnitNear) {
builder.append("1. Combattre\n")
.append("2. Donner un Point d'Action\n");
}else{
builder.append("2. Donner un Point d'Action\n")
}
*/
System.out.println(builder.toString());
int res = sc.nextInt();
if (res == 1) {
combattre();
}else if(res == 2){
actionGivePA();
sc.close();
return true;
}else {
//TODO:utiliser un système de vérification d'entrée globale
System.out.println("ERROR");
}
sc.close();
return false;
}
public void combattre() {
//TODO: il faut d'abord regarder si une unité est présente autour
}
public void actionGivePA() {
this.getJoueur().addPa(PATOGIVE);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment