Skip to content
Snippets Groups Projects
Commit 3303186d authored by Maxime Wallart's avatar Maxime Wallart :speech_balloon:
Browse files

update

parent 84756715
No related branches found
No related tags found
No related merge requests found
...@@ -17,28 +17,16 @@ public class Main { ...@@ -17,28 +17,16 @@ public class Main {
}*/ }*/
Plateau plateau = new Plateau(); Plateau plateau = new Plateau();
<<<<<<< HEAD
int x = 11; int x = 11;
int y = 10; int y = 10;
=======
int x = 13;
int y = 23;
>>>>>>> 663e9463f07e3e309d4b27451be1390f7ac87d7e
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner)); plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner));
Affichage.affichage(plateau); Affichage.affichage(plateau);
while(y<30) {
winner.getArmee().get(0).move(deplacement()); winner.getArmee().get(0).move(deplacement());
System.out.println('\n'); System.out.println('\n');
<<<<<<< HEAD
winner.getArmee().get(0).teleporte();
Affichage.affichage(plateau); Affichage.affichage(plateau);
}
Menu(); Menu();
=======
plateau.getCase(12, 0); plateau.getCase(12, 0);
Affichage.affichage(plateau); Affichage.affichage(plateau);
//Menu();
>>>>>>> 663e9463f07e3e309d4b27451be1390f7ac87d7e
} }
public static void Menu () { public static void Menu () {
......
...@@ -9,10 +9,10 @@ public class Archer extends Unite{ ...@@ -9,10 +9,10 @@ public class Archer extends Unite{
public static final int ARMOR = 5; public static final int ARMOR = 5;
public static final int DAMAGE = 5; public static final int DAMAGE = 5;
public static final char SYMBOL = 'A'; public static final char SYMBOL = 'A';
public static final int VISION = 2;
public Archer(int x, int y, Plateau plateau, Joueur joueur) { 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 @Override
......
...@@ -9,9 +9,10 @@ public class Chevalier extends Unite { ...@@ -9,9 +9,10 @@ public class Chevalier extends Unite {
public static final int ARMOR = 10; public static final int ARMOR = 10;
public static final int DAMAGE = 5; public static final int DAMAGE = 5;
public static final char SYMBOL = 'C'; public static final char SYMBOL = 'C';
public static final int VISION = 2;
public Chevalier(int x, int y, Plateau plateau, Joueur joueur) { 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 { ...@@ -9,9 +9,10 @@ public class Eclaireur extends Unite {
public static final int ARMOR = 1; public static final int ARMOR = 1;
public static final int DAMAGE = 0; public static final int DAMAGE = 0;
public static final char SYMBOL = 'E'; public static final char SYMBOL = 'E';
public static final int VISION = 2;
public Eclaireur(int x, int y, Plateau plateau, Joueur joueur) { 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{ ...@@ -50,7 +50,7 @@ public class Paysant extends Unite{
sc.close(); sc.close();
return true; return true;
}else { }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"); System.out.println("ERROR");
} }
...@@ -60,7 +60,7 @@ public class Paysant extends Unite{ ...@@ -60,7 +60,7 @@ public class Paysant extends Unite{
} }
public void combattre() { 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() { public void actionGivePA() {
......
...@@ -128,61 +128,50 @@ public abstract class Unite { ...@@ -128,61 +128,50 @@ public abstract class Unite {
} }
//à voir le type //à voir le type
public boolean move(char c) { public boolean move(char c) {
/*if(c=='s' && updatePosition(x+1,y))*/
if(c == 's') { if(c == 's') {
/*if (plateau.getCase(x+1,y).getUnite() != null) { if (plateau.getCase(x+1,y).getUnite() != null || plateau.getCase(x+1, y).getUnite().getJoueur() != this.joueur) {
combat(); //combat();
}*/ }
if (updatePosition(x+1,y)) { if (updatePosition(x+1,y)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.x+=1; this.x+=1;
=======
updateDecouverte(this.plateau.getCase(x+1, y), this.vision); updateDecouverte(this.plateau.getCase(x+1, y), this.vision);
>>>>>>> 663e9463f07e3e309d4b27451be1390f7ac87d7e
return true; return true;
} }
} }
else if(c == 'd') { else if(c == 'd') {
if (updatePosition(x,y+1)) { if (updatePosition(x,y+1)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.y+=1; this.y+=1;
=======
updateDecouverte(this.plateau.getCase(x, y+1), this.vision); updateDecouverte(this.plateau.getCase(x, y+1), this.vision);
>>>>>>> 663e9463f07e3e309d4b27451be1390f7ac87d7e
return true; return true;
} }
} }
else if(c == 'q') { else if(c == 'q') {
if (updatePosition(x,y-1)) { if (updatePosition(x,y-1)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.y-=1; this.y-=1;
=======
updateDecouverte(this.plateau.getCase(x, y-1), this.vision); updateDecouverte(this.plateau.getCase(x, y-1), this.vision);
>>>>>>> 663e9463f07e3e309d4b27451be1390f7ac87d7e
return true; return true;
} }
} }
else if(c == 'z') { else if(c == 'z') {
if (updatePosition(x-1, y)) { if (updatePosition(x-1, y)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.x-=1; this.x-=1;
=======
updateDecouverte(this.plateau.getCase(x-1, y), this.vision); updateDecouverte(this.plateau.getCase(x-1, y), this.vision);
>>>>>>> 663e9463f07e3e309d4b27451be1390f7ac87d7e
return true; return true;
} }
} }
return false; return false;
} }
<<<<<<< HEAD
public void teleporte() { public void teleporte() {
Random alea = new Random(); Random alea = new Random();
int longueur = plateau.getPlateau().length*plateau.getRegion(0, 0).region.length; int longueur = plateau.getPlateau().length*plateau.getRegion(0, 0).region.length;
...@@ -199,7 +188,6 @@ public abstract class Unite { ...@@ -199,7 +188,6 @@ public abstract class Unite {
this.x=rd1; this.x=rd1;
this.y=rd2; this.y=rd2;
} }
=======
public void updateDecouverte (Case emplacement, int vision) { public void updateDecouverte (Case emplacement, int vision) {
System.out.println("" + emplacement.getX() + ", " + emplacement.getY()); System.out.println("" + emplacement.getX() + ", " + emplacement.getY());
if (emplacement.getX()+1 < this.plateau.getLength()) { if (emplacement.getX()+1 < this.plateau.getLength()) {
...@@ -236,8 +224,6 @@ public abstract class Unite { ...@@ -236,8 +224,6 @@ public abstract class Unite {
} }
} }
>>>>>>> 663e9463f07e3e309d4b27451be1390f7ac87d7e
public abstract String toString(); public abstract String toString();
public abstract boolean action(); public abstract boolean action();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment