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

merge master

parent 3303186d
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,9 @@ public class Case {
else if (this.type == Type.FORT) {
return "♜ ";
}
else if (this.type == Type.CAMP) {
return "O ";
}
else { return "? ";}
}
}
......@@ -7,44 +7,47 @@ import units.Paysant;
public class Main {
private static Joueur winner = new Joueur("Winner");
private int actionPoint;
public static void main(String[] args) {
/*Region[][] regions = new Region[6][6];
for(int i = 0; i<regions.length; i++) {
for(int j = 0; j<regions[i].length; j++) {
regions[i][j] = new Region();
}
}*/
/*
* Region[][] regions = new Region[6][6]; for(int i = 0; i<regions.length; i++)
* { for(int j = 0; j<regions[i].length; j++) { regions[i][j] = new Region(); }
* }
*/
Plateau plateau = new Plateau();
int x = 11;
int y = 10;
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner));
winner.getArmee().get(0).getPlateau().getRegion(0,0).changeToCamp();
Affichage.affichage(plateau);
winner.getArmee().get(0).move(deplacement());
System.out.println('\n');
Affichage.affichage(plateau);
while (y != 30) {
winner.getArmee().get(0).move(deplacement());
System.out.println('\n');
Affichage.affichage(plateau);
}
Menu();
plateau.getCase(12, 0);
Affichage.affichage(plateau);
}
public static void Menu () {
public static void Menu() {
System.out.print("Bienvenue dans Game of Crown, vous êtes actuellement sur le Menu !");
}
public static char deplacement() {
Scanner sc = new Scanner(System.in);
System.out.println("Veuillez choisir une direction");
while (!sc.hasNext("[zqsd]")) {
System.out.println("Cette touche n'est pas acceptés, veuillez réessayer");
sc.next();
System.out.println("Cette touche n'est pas acceptés, veuillez réessayer");
sc.next();
}
return sc.next().charAt(0);
}
private Joueur Game (Joueur[] joueurs) {
private Joueur Game(Joueur[] joueurs) {
boolean gameEnd = false;
while(gameEnd){
while (gameEnd) {
for (Joueur currentPlayer : joueurs) {
setActionPoint(currentPlayer);
Tour(currentPlayer, actionPoint);
......@@ -52,28 +55,28 @@ public class Main {
}
return getWinner();
}
public void Tour (Joueur currentPlayer, int actionPoint) {
public void Tour(Joueur currentPlayer, int actionPoint) {
}
public void setActionPoint (int actionPoint) {
public void setActionPoint(int actionPoint) {
this.actionPoint = actionPoint;
}
public void setActionPoint (Joueur currentPlayer) {
public void setActionPoint(Joueur currentPlayer) {
this.actionPoint = currentPlayer.getArmee().size() + (currentPlayer.getRoyaume().size() * 3);
}
public int getActionPoint () {
public int getActionPoint() {
return this.actionPoint;
}
public void setWinner (Joueur winner) {
public void setWinner(Joueur winner) {
this.winner = winner;
}
public Joueur getWinner () {
public Joueur getWinner() {
return this.winner;
}
}
......@@ -30,6 +30,15 @@ public class Region {
region[rd1][rd2].setEvent(Event.FORT);
region[rd1][rd2].setType(Type.FORT);
}
public void changeToCamp() {
for (int i = 0; i < region.length; i++) {
for (int j = 0; j < region[0].length; j++) {
if (region[i][j].getType()==Type.FORT) {
region[i][j].setType(Type.CAMP);
}
}
}
}
public void setX(int x) {
this.x = x;
}
......
package main;
public enum Type {
UNITE,GRASS, MOUNTAIN, VILLAGE, FORT;
UNITE,GRASS, MOUNTAIN, CAMP, FORT;
}
......@@ -22,6 +22,7 @@ public abstract class Unite {
public static int generalId = 1;
private Joueur joueur;
private Items item;
private Type temp = Type.GRASS;
public Unite(int x, int y, Plateau plateau, char symbol, int armor, int damage, Joueur joueur, int vision) {
this.id = generalId;
......@@ -115,28 +116,31 @@ public abstract class Unite {
}
public boolean updatePosition(int x,int y) {
if(x>=0 && x<plateau.getPlateau().length*plateau.getRegion(0, 0).region.length && y>=0 && y<plateau.getPlateau().length*plateau.getRegion(0, 0).region.length ) {
if(x>=0 && x<(plateau.getPlateau().length*plateau.getRegion(0, 0).region.length-1) && y>=0 && y<(plateau.getPlateau().length*plateau.getRegion(0, 0).region.length-1) ) {
this.plateau.getCase(x, y).setUnite(this);
temp = this.plateau.getCase(x, y).getType();
this.plateau.getCase(x, y).setType(Type.UNITE);
if(this.plateau.getCase(x, y).getEvent() == Event.FORT) {
this.plateau.getRegion(x, y).setProprietaire(joueur);
this.joueur.getRoyaume().add(this.plateau.getRegion(x, y));
}
/*if(this.plateau.getCase(x, y).getEvents().length > 0){
System.out.println("oui");
}*/
return true;
}
return false;
}
//à voir le type
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) {
/*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.plateau.getCase(x, y).setType(temp);
this.x+=1;
updateDecouverte(this.plateau.getCase(x+1, y), this.vision);
return true;
......@@ -145,7 +149,7 @@ public abstract class Unite {
else if(c == 'd') {
if (updatePosition(x,y+1)) {
this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(Type.GRASS);
this.plateau.getCase(x, y).setType(temp);
this.y+=1;
updateDecouverte(this.plateau.getCase(x, y+1), this.vision);
return true;
......@@ -154,7 +158,7 @@ public abstract class Unite {
else if(c == 'q') {
if (updatePosition(x,y-1)) {
this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(Type.GRASS);
this.plateau.getCase(x, y).setType(temp);
this.y-=1;
updateDecouverte(this.plateau.getCase(x, y-1), this.vision);
return true;
......@@ -163,7 +167,7 @@ public abstract class Unite {
else if(c == 'z') {
if (updatePosition(x-1, y)) {
this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(Type.GRASS);
this.plateau.getCase(x, y).setType(temp);
this.x-=1;
updateDecouverte(this.plateau.getCase(x-1, y), this.vision);
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment