From fc84bb6f5e75e214f48841af6e9098eeba7aa853 Mon Sep 17 00:00:00 2001 From: "Francois .D" <automate59go@gmail.com> Date: Wed, 2 Sep 2020 09:01:36 +0200 Subject: [PATCH] =?UTF-8?q?permet=20la=20d=C3=A9couverte=20de=20la=20couro?= =?UTF-8?q?nne=20et=20de=20la=20prendre=20pour=20la=20ramener?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .settings/org.eclipse.core.resources.prefs | 2 ++ doc/sprint-5/README.md | 5 ++++- doc/sprint-6/README.md | 14 ++++++++++++++ src/items/Crown.java | 16 ++++++++-------- src/items/Items.java | 3 ++- src/main/Case.java | 8 ++++++-- src/main/Main.java | 2 +- src/main/Plateau.java | 8 ++++++++ src/units/Unite.java | 16 ++++++++++++++-- 9 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 doc/sprint-6/README.md diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/doc/sprint-5/README.md b/doc/sprint-5/README.md index 7abc22a..41c707f 100644 --- a/doc/sprint-5/README.md +++ b/doc/sprint-5/README.md @@ -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 diff --git a/doc/sprint-6/README.md b/doc/sprint-6/README.md new file mode 100644 index 0000000..4bf312c --- /dev/null +++ b/doc/sprint-6/README.md @@ -0,0 +1,14 @@ +# 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 diff --git a/src/items/Crown.java b/src/items/Crown.java index 33e2c36..939fffd 100644 --- a/src/items/Crown.java +++ b/src/items/Crown.java @@ -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); } } diff --git a/src/items/Items.java b/src/items/Items.java index eddd6d3..fbc8229 100644 --- a/src/items/Items.java +++ b/src/items/Items.java @@ -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); } diff --git a/src/main/Case.java b/src/main/Case.java index 373dcd6..8508388 100644 --- a/src/main/Case.java +++ b/src/main/Case.java @@ -77,17 +77,21 @@ 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 { return "? ";} } diff --git a/src/main/Main.java b/src/main/Main.java index 94ca0e4..28a4145 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -27,7 +27,7 @@ public class Main { 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(); diff --git a/src/main/Plateau.java b/src/main/Plateau.java index 96d7a56..c9c05b5 100644 --- a/src/main/Plateau.java +++ b/src/main/Plateau.java @@ -1,9 +1,14 @@ 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]; diff --git a/src/units/Unite.java b/src/units/Unite.java index 7b1909b..edb5f60 100644 --- a/src/units/Unite.java +++ b/src/units/Unite.java @@ -122,18 +122,27 @@ public abstract class Unite { 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.x+=1; updateDecouverte(this.plateau.getCase(x+1, y), this.vision); + updateItem(); return true; } } @@ -143,6 +152,7 @@ public abstract class Unite { this.plateau.getCase(x, y).setType(Type.GRASS); this.y+=1; updateDecouverte(this.plateau.getCase(x, y+1), this.vision); + updateItem(); return true; } } @@ -152,6 +162,7 @@ public abstract class Unite { this.plateau.getCase(x, y).setType(Type.GRASS); this.y-=1; updateDecouverte(this.plateau.getCase(x, y-1), this.vision); + updateItem(); return true; } } @@ -161,6 +172,7 @@ public abstract class Unite { this.plateau.getCase(x, y).setType(Type.GRASS); this.x-=1; updateDecouverte(this.plateau.getCase(x-1, y), this.vision); + updateItem(); return true; } } -- GitLab