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

Merge branch 'master' into Baptiste

parents 8585e5bd 07c805be
No related branches found
No related tags found
No related merge requests found
eclipse.preferences.version=1
encoding/<project>=UTF-8
eclipse.preferences.version=1
line.separator=\n
......@@ -8,6 +8,9 @@ réalisation des événements
réalisateur des cases procédurale
### Ce que nous allons faire durant le prochain sprint
mise en place du brouillard de guerre
réalisation de l'interface
mise en place du téléporteur
mise en place du système d'items
## Rétro
\ No newline at end of file
# Sprint 5
## Démo + Planification du sprint suivant
### Ce que nous avons fait durant ce sprint
mise en place du brouillard de guerre
réalisation de l'interface
mise en place du téléporteur
mise en place du système d'items
### Ce que nous allons faire durant le prochain sprint
Avoir un jeu un minimum fonctionnel avec l'ajout des camps, de la coronne sur la map
## Rétro
\ No newline at end of file
doc/sprint-6/radiateur.jpg

4.03 MiB

......@@ -14,18 +14,18 @@ public class Crown extends Items{
@Override
public void usage(Joueur joueur) {
//TODO: premi�re version, tu prend la couronne tu gagne, ensuite faire de syst�me de r�cup et d'arriver au camp
if (this.getPower() != 0) {
joueur.setWin(true);
this.setPower(0);
}
return;
}
@Override
public void recup(Joueur joueur) {
Unite unite = this.getItemCase().getUnite();
public void recup(Joueur joueur, Items item, Unite unite) {
System.out.println(unite.toString());
this.setItemCase(null);
unite.setItem(this);
System.out.println(item.getName());
unite.setItem(item);
unite.setSymbol('c');
unite.getPlateau().getCase(unite.getX(), unite.getY()).setItem(null);
}
}
......@@ -2,6 +2,7 @@ package items;
import main.Case;
import main.Joueur;
import units.Unite;
public abstract class Items {
private String name;
......@@ -37,5 +38,5 @@ public abstract class Items {
public abstract void usage(Joueur joueur);
public abstract void recup(Joueur joueur);
public abstract void recup(Joueur joueur, Items item,Unite unite);
}
......@@ -99,17 +99,24 @@ public class Case {
}
public String toString() {
/*
if (!this.isDecouverte()) {
return "~ ";
}
else */if (this.getItem() != null && this.getItem().getName().equalsIgnoreCase("crown")) {
return "c ";
}
else if (this.type == Type.GRASS) {
return ". ";
}
else if (this.type == Type.MOUNTAIN) {
return "Ѧ ";
return "m ";
}
else if (this.type == Type.FORT) {
return "♜ ";
return "t ";
}
else if (this.type == Type.CAMP) {
return "O ";
}
else if (this.type == Type.VILLAGE) {
return "V ";
......
......@@ -7,15 +7,14 @@ 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;
......@@ -23,11 +22,12 @@ public class Main {
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner));
winner.getArmee().get(0).getPlateau().getRegion(0,0).changeToCamp();
Affichage.affichage(plateau);
while(y<30) {
winner.getArmee().get(0).move(deplacement());
System.out.println('\n');
winner.getArmee().get(0).teleporte();
//winner.getArmee().get(0).teleporte();
Affichage.affichage(plateau);
}
Menu();
......@@ -36,23 +36,24 @@ public class Main {
Affichage.affichage(plateau);
//Menu();
}
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);
......@@ -60,28 +61,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;
}
}
package main;
import java.util.Random;
import items.Crown;
public class Plateau {
private Region[][] plateau;
public Plateau() {
Random random = new Random();
this.plateau = new Region[6][6];
for (int i = 0; i < plateau.length; i++) {
for (int j = 0; j < plateau[0].length; j++) {
......@@ -13,6 +18,9 @@ public class Plateau {
plateau[i][j].fillRegion();
}
}
int rd1 = (int)random.nextInt(10)+10;
int rd2 = (int)random.nextInt(30);
this.getCase(rd1, rd2).setItem(new Crown(this.getCase(0, 0)));
}
public Case getCase(int x, int y) {
return plateau[x/5][y/5].region[x%5][y%5];
......
......@@ -40,6 +40,15 @@ public class Region {
region[rd1][rd2].setType(Type.VILLAGE);
}
}
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;
}
......@@ -20,6 +20,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;
......@@ -113,54 +114,68 @@ 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).getEvents().length > 0){
System.out.println("oui");
}*/
return true;
}
return false;
}
//à voir le type
public void updateItem() {
Case unitcase = plateau.getCase(x,y);
if(this.getItem() == null && unitcase.getItem() != null) {
unitcase.getItem().recup(joueur,unitcase.getItem(),this);
}
}
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);
updateItem();
return true;
}
}
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);
updateItem();
return true;
}
}
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);
updateItem();
return true;
}
}
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);
updateItem();
return true;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment