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/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000000000000000000000000000000000000..5a0ad22d2a76684139fad95f6b8d209c7cd0d078 --- /dev/null +++ b/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n 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/doc/sprint-6/radiateur.jpg b/doc/sprint-6/radiateur.jpg new file mode 100644 index 0000000000000000000000000000000000000000..57389f92c49d9bf293fd4b4dfb455cafe71a552f Binary files /dev/null and b/doc/sprint-6/radiateur.jpg differ 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 d56ea12524de05117ffb7057014779833da67ddc..1f4f7b66095e3fb33f17268680063b2d5d994fb3 100644 --- a/src/main/Case.java +++ b/src/main/Case.java @@ -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 "; diff --git a/src/main/Main.java b/src/main/Main.java index 94ca0e44de8c48b8cb827533bc518d607d2953fb..9dd3e40e0249ddffabee76ad1f674a58015694b2 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -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; } } 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/main/Region.java b/src/main/Region.java index 5fbffd444a1d88b48318e923ada633f45f2fd408..9ecb3099edf05e7ac5ec35c320df02d0f17ad40d 100644 --- a/src/main/Region.java +++ b/src/main/Region.java @@ -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; } diff --git a/src/main/Type.java b/src/main/Type.java index 59fb26206d3636820dea9b4c1ef28b8e03aac2b6..bdfacc4ab2b794f54a2785d7d71be011f0b47d1e 100644 --- a/src/main/Type.java +++ b/src/main/Type.java @@ -1,5 +1,5 @@ package main; public enum Type { - UNITE,GRASS, MOUNTAIN, VILLAGE, FORT; + UNITE,GRASS, MOUNTAIN, CAMP, FORT; } diff --git a/src/units/Unite.java b/src/units/Unite.java index 223a0b58b54ce8f0292731982214d2f8603e4abf..d7a9b42aad377534a70700c3a9c7f875375c79c6 100644 --- a/src/units/Unite.java +++ b/src/units/Unite.java @@ -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; } }