diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..99f26c0203a7844de00dbfc56e6a35d8ed3c022c --- /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 7abc22ad717c5159f473374c323fcf306e85547c..41c707f2f190b8d6ec971772956b185210e02bfa 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 0000000000000000000000000000000000000000..4bf312c6372afd2a781cf75fd9b121f589b363f2 --- /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 33e2c3675db6bfc44c31f1daf51c5cc818126143..939fffd9cef45fe8551d9c5e4e8ab28b41906be7 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 eddd6d333650645395c819961cc177629d055bb7..fbc82293b955c27117dd8daffc4924cf2b8b90b1 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 373dcd6eb86b19cb31aa033c3d5d7aea6a107f25..8508388b74e4b72a1167dffaabda881c6059cc1a 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 94ca0e44de8c48b8cb827533bc518d607d2953fb..28a4145486be065ddef19fd4386422d295a003ec 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 96d7a56ce0191f9e906f723db9d67ab676febe31..c9c05b50141f66cd6cd62de56b766dd55ae5f99d 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 7b1909b25a22617fd0f355c3f914a1450f35d39b..edb5f60ca9358bb4004d34a346ab741b21d8c6b9 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; } }