Skip to content
Snippets Groups Projects
Commit 0ce40ed9 authored by Francois DEROUBAIX's avatar Francois DEROUBAIX
Browse files

merge master

parents 428c3b3f c62a0b38
No related branches found
No related tags found
No related merge requests found
package main;
import units.Unite;
public class Interface {
private static int rep = 0;
public static void start() {
......@@ -24,11 +26,36 @@ public class Interface {
for(int i = 0; i< j1.getArmee().size(); i++) {
System.out.println(i+": "+ j1.getArmee().get(1).toString());
}
Scan.scan(j1.getArmee().size());
System.out.println("vous pouvez déplacer une unité...");
System.out.println("1: Vers le haut");
System.out.println("2: Vers le bas");
System.out.println("3: Vers la droite");
System.out.println("4: Vers la gauche");
Unite u =j1.getArmee().get((Scan.scan(j1.getArmee().size())));
System.out.println("vous pouvez...");
if(u.getX()>0) {
if(plateau.getCase(u.getX()-1, u.getY()).getUnite()!=null){
System.out.println("1: Combattre l'unité au-dessus");
}else {
System.out.println("1: Se déplacer vers le haut");
}
}
if(u.getX()<plateau.getPlateau().length*5) {
if(plateau.getCase(u.getX()+1, u.getY()).getUnite()!=null){
System.out.println("2: Combattre l'unité en bas");
}else {
System.out.println("2: Se déplacer vers le bas");
}
}
if(u.getY()<plateau.getPlateau().length*5) {
if(plateau.getCase(u.getX(), u.getY()+1).getUnite()!=null){
System.out.println("3: Combattre l'unité à droite");
}else {
System.out.println("3: Se déplacer vers la droite");
}
}
if(u.getY()>0) {
if(plateau.getCase(u.getX(), u.getY()-1).getUnite()!=null){
System.out.println("4: Combattre l'unité à gauche");
}else {
System.out.println("4: Se déplacer vers la gauche");
}
}
rep = Scan.scan(4);
}
}
......@@ -17,25 +17,36 @@ public class Main {
}*/
Plateau plateau = new Plateau();
<<<<<<< HEAD
int x = 11;
int y = 10;
=======
int x = 11;
int y = 10;
>>>>>>> master
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner));
Affichage.affichage(plateau);
while(y<30) {
winner.getArmee().get(0).move(deplacement());
System.out.println('\n');
<<<<<<< HEAD
winner.getArmee().get(0).teleporte();
=======
>>>>>>> master
Affichage.affichage(plateau);
}
Menu();
<<<<<<< HEAD
plateau.getCase(12, 0);
Affichage.affichage(plateau);
//Menu();
=======
plateau.getCase(12, 0);
Affichage.affichage(plateau);
>>>>>>> master
}
public static void Menu () {
......
......@@ -9,10 +9,10 @@ public class Archer extends Unite{
public static final int ARMOR = 5;
public static final int DAMAGE = 5;
public static final char SYMBOL = 'A';
public static final int VISION = 2;
public Archer(int x, int y, Plateau plateau, Joueur joueur) {
super(x,y, plateau, SYMBOL, ARMOR, DAMAGE, joueur);
super(x,y, plateau, SYMBOL, ARMOR, DAMAGE, joueur, VISION);
}
@Override
......
......@@ -9,9 +9,10 @@ public class Chevalier extends Unite {
public static final int ARMOR = 10;
public static final int DAMAGE = 5;
public static final char SYMBOL = 'C';
public static final int VISION = 2;
public Chevalier(int x, int y, Plateau plateau, Joueur joueur) {
super(x,y, plateau, SYMBOL, ARMOR, DAMAGE, joueur);
super(x,y, plateau, SYMBOL, ARMOR, DAMAGE, joueur, VISION);
}
......
......@@ -9,9 +9,10 @@ public class Eclaireur extends Unite {
public static final int ARMOR = 1;
public static final int DAMAGE = 0;
public static final char SYMBOL = 'E';
public static final int VISION = 2;
public Eclaireur(int x, int y, Plateau plateau, Joueur joueur) {
super(x,y, plateau, SYMBOL, ARMOR, DAMAGE, joueur);
super(x,y, plateau, SYMBOL, ARMOR, DAMAGE, joueur, VISION);
}
......
......@@ -50,7 +50,7 @@ public class Paysant extends Unite{
sc.close();
return true;
}else {
//TODO:utiliser un systme de vrification d'entre globale
//TODO:utiliser un système de vérification d'entrée globale
System.out.println("ERROR");
}
......@@ -60,7 +60,7 @@ public class Paysant extends Unite{
}
public void combattre() {
//TODO: il faut d'abord regarder si une unit est prsente autour
//TODO: il faut d'abord regarder si une unité est présente autour
}
public void actionGivePA() {
......
......@@ -120,10 +120,24 @@ public abstract class Unite {
return false;
}
//à voir le type
<<<<<<< HEAD
public boolean move(Direction d) {
if(d == Direction.BAS) {
if (updatePosition(x+1,y)) {
this.plateau.getCase(x, y).setUnite(null);
=======
public boolean move(char c) {
/*if(c=='s' && updatePosition(x+1,y))*/
if(c == 's') {
if (plateau.getCase(x+1,y).getUnite() != null || plateau.getCase(x+1, y).getUnite().getJoueur() != this.joueur) {
//combat();
}
if (updatePosition(x+1,y)) {
this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(Type.GRASS);
this.x+=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x+1, y), this.vision);
return true;
}
......@@ -131,6 +145,11 @@ public abstract class Unite {
else if(d == Direction.DROITE) {
if (updatePosition(x,y+1)) {
this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
=======
this.plateau.getCase(x, y).setType(Type.GRASS);
this.y+=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x, y+1), this.vision);
return true;
}
......@@ -138,6 +157,11 @@ public abstract class Unite {
else if(d == Direction.GAUCHE) {
if (updatePosition(x,y-1)) {
this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
=======
this.plateau.getCase(x, y).setType(Type.GRASS);
this.y-=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x, y-1), this.vision);
return true;
}
......@@ -145,6 +169,11 @@ public abstract class Unite {
else if(d == Direction.HAUT) {
if (updatePosition(x-1, y)) {
this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
=======
this.plateau.getCase(x, y).setType(Type.GRASS);
this.x-=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x-1, y), this.vision);
return true;
}
......@@ -152,6 +181,25 @@ public abstract class Unite {
return false;
}
<<<<<<< HEAD
=======
public void teleporte() {
Random alea = new Random();
int longueur = plateau.getPlateau().length*plateau.getRegion(0, 0).region.length;
int rd1 = alea.nextInt(longueur);
int rd2 = alea.nextInt(longueur);
while(plateau.getCase(rd1, rd2).getType()!=Type.GRASS) {
rd1 = alea.nextInt(longueur);
rd2 = alea.nextInt(longueur);
}
updatePosition(rd1,rd2);
this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(Type.GRASS);
this.x=rd1;
this.y=rd2;
}
>>>>>>> master
public void updateDecouverte (Case emplacement, int vision) {
System.out.println("" + emplacement.getX() + ", " + emplacement.getY());
if (emplacement.getX()+1 < this.plateau.getLength()) {
......@@ -187,7 +235,10 @@ public abstract class Unite {
}
}
}
<<<<<<< HEAD
=======
>>>>>>> master
public abstract String toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment