Skip to content
Snippets Groups Projects
Commit fc84bb6f authored by Francois .D's avatar Francois .D
Browse files

permet la découverte de la couronne et de la prendre pour la ramener

parent 01dcb24e
No related branches found
No related tags found
No related merge requests found
eclipse.preferences.version=1
encoding/<project>=UTF-8
...@@ -8,6 +8,9 @@ réalisation des événements ...@@ -8,6 +8,9 @@ réalisation des événements
réalisateur des cases procédurale réalisateur des cases procédurale
### Ce que nous allons faire durant le prochain sprint ### 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 ## 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
...@@ -14,18 +14,18 @@ public class Crown extends Items{ ...@@ -14,18 +14,18 @@ public class Crown extends Items{
@Override @Override
public void usage(Joueur joueur) { 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 return;
if (this.getPower() != 0) {
joueur.setWin(true);
this.setPower(0);
}
} }
@Override @Override
public void recup(Joueur joueur) { public void recup(Joueur joueur, Items item, Unite unite) {
Unite unite = this.getItemCase().getUnite();
System.out.println(unite.toString());
this.setItemCase(null); 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; ...@@ -2,6 +2,7 @@ package items;
import main.Case; import main.Case;
import main.Joueur; import main.Joueur;
import units.Unite;
public abstract class Items { public abstract class Items {
private String name; private String name;
...@@ -37,5 +38,5 @@ public abstract class Items { ...@@ -37,5 +38,5 @@ public abstract class Items {
public abstract void usage(Joueur joueur); public abstract void usage(Joueur joueur);
public abstract void recup(Joueur joueur); public abstract void recup(Joueur joueur, Items item,Unite unite);
} }
...@@ -77,17 +77,21 @@ public class Case { ...@@ -77,17 +77,21 @@ public class Case {
} }
public String toString() { public String toString() {
/*
if (!this.isDecouverte()) { if (!this.isDecouverte()) {
return "~ "; return "~ ";
} }
else */if (this.getItem() != null && this.getItem().getName().equalsIgnoreCase("crown")) {
return "c ";
}
else if (this.type == Type.GRASS) { else if (this.type == Type.GRASS) {
return ". "; return ". ";
} }
else if (this.type == Type.MOUNTAIN) { else if (this.type == Type.MOUNTAIN) {
return "Ѧ "; return "m ";
} }
else if (this.type == Type.FORT) { else if (this.type == Type.FORT) {
return " "; return "t ";
} }
else { return "? ";} else { return "? ";}
} }
......
...@@ -27,7 +27,7 @@ public class Main { ...@@ -27,7 +27,7 @@ public class Main {
while(y<30) { while(y<30) {
winner.getArmee().get(0).move(deplacement()); winner.getArmee().get(0).move(deplacement());
System.out.println('\n'); System.out.println('\n');
winner.getArmee().get(0).teleporte(); //winner.getArmee().get(0).teleporte();
Affichage.affichage(plateau); Affichage.affichage(plateau);
} }
Menu(); Menu();
......
package main; package main;
import java.util.Random;
import items.Crown;
public class Plateau { public class Plateau {
private Region[][] plateau; private Region[][] plateau;
public Plateau() { public Plateau() {
Random random = new Random();
this.plateau = new Region[6][6]; this.plateau = new Region[6][6];
for (int i = 0; i < plateau.length; i++) { for (int i = 0; i < plateau.length; i++) {
for (int j = 0; j < plateau[0].length; j++) { for (int j = 0; j < plateau[0].length; j++) {
...@@ -13,6 +18,9 @@ public class Plateau { ...@@ -13,6 +18,9 @@ public class Plateau {
plateau[i][j].fillRegion(); 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) { public Case getCase(int x, int y) {
return plateau[x/5][y/5].region[x%5][y%5]; return plateau[x/5][y/5].region[x%5][y%5];
......
...@@ -122,18 +122,27 @@ public abstract class Unite { ...@@ -122,18 +122,27 @@ public abstract class Unite {
return false; return false;
} }
//à voir le type //à 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) { public boolean move(char c) {
/*if(c=='s' && updatePosition(x+1,y))*/ /*if(c=='s' && updatePosition(x+1,y))*/
if(c == 's') { 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(); //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);
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);
updateItem();
return true; return true;
} }
} }
...@@ -143,6 +152,7 @@ public abstract class Unite { ...@@ -143,6 +152,7 @@ public abstract class Unite {
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);
updateItem();
return true; return true;
} }
} }
...@@ -152,6 +162,7 @@ public abstract class Unite { ...@@ -152,6 +162,7 @@ public abstract class Unite {
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);
updateItem();
return true; return true;
} }
} }
...@@ -161,6 +172,7 @@ public abstract class Unite { ...@@ -161,6 +172,7 @@ public abstract class Unite {
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);
updateItem();
return true; return true;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment