diff --git a/assets/DialogBox.text b/assets/DialogBox.text index 3824c2cfa6d57ed073ec9ad88effe88f20d33bf0..2882879bc05263cc3ac838d5c349e4c50e053252 100644 --- a/assets/DialogBox.text +++ b/assets/DialogBox.text @@ -1,4 +1,4 @@ -________________________________________________________________________________________________________________________ + @@ -13,7 +13,7 @@ ________________________________________________________________________________ Commandes : - a - Attaquer - q - Quitter + a - Action + q - Quitter ________________________________________________________________________________________________________________________ \ No newline at end of file diff --git a/doc/sprint-7/README.md b/doc/sprint-7/README.md index 877f8e7df16a9b5b7bb95d4d117383cb5ddc4daa..26ddffe993fafad95b7bbfe04850081d0c429cbd 100644 --- a/doc/sprint-7/README.md +++ b/doc/sprint-7/README.md @@ -6,12 +6,16 @@ - Implémentation du score et de la sauvegarde ### Ce que nous allons faire durant le prochain sprint - +- Terminer les dernières corrections de l'affichage +- Gérer les dernières exceptions +- Ajouter les méthodes implémentées ## Rétrospective - +- Essentiel de ne pas mettre trop de choses dans le programme principal, erreur faite plusieurs fois et très chronovore +- Amélioration sur la question des conflits git, chacun plus autonome et partage plus ### Sur quoi avons nous butté ? +- Gestion des bugs et du temps ### PDCA diff --git a/doc/sprint-8/.gitkeep b/doc/sprint-8/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/sprint-8/README.md b/doc/sprint-8/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8b4692ece5cdc749e76e1150a695e8b6641d7a69 --- /dev/null +++ b/doc/sprint-8/README.md @@ -0,0 +1,14 @@ +# Sprint 8 + +### Ce que nous avons fait durant ce sprint + + +### Ce que nous allons faire durant le prochain sprint + +## Rétrospective + +### Sur quoi avons nous butté ? + + +### PDCA +* N/A, sprint 8 \ No newline at end of file diff --git a/doc/sprint-8/radiateur-8.heic b/doc/sprint-8/radiateur-8.heic new file mode 100644 index 0000000000000000000000000000000000000000..cbcfe8e7dac269ec0c8eac87e64fcba01c453cdc Binary files /dev/null and b/doc/sprint-8/radiateur-8.heic differ diff --git a/src/main/java/bitFight/Display.java b/src/main/java/bitFight/Display.java index 77173399f160548dac6e55a4e453e390d134e0ff..5d47f5c96155f82bd4434c39f6a31042d05225ce 100644 --- a/src/main/java/bitFight/Display.java +++ b/src/main/java/bitFight/Display.java @@ -31,20 +31,27 @@ public class Display { } public static void goToDialogBox(){ - setCursorPos(row+7,0); + setCursorPos(1,0); + //System.out.flush(); } - public static void clearDialogBox() throws IOException{ + public static void clearDialogBox(){ clearScreen(); setCursorPos(row, 0); printDialogBox(); goToDialogBox(); } - public static void printDialogBox() throws IOException{ - setCursorPos(50, 0); - String dialogBox = loadTextFile("assets/DialogBox.text"); + public static void printDialogBox(){ + setCursorPos(100, 0); + String dialogBox = ""; + try { + dialogBox = loadTextFile("assets/DialogBox.text"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } System.out.println(dialogBox); } @@ -52,7 +59,7 @@ public class Display { setCursorPos(50, 0); } - public static void newPrintln(String text) throws IOException{ + public static void newPrintln(String text){ clearDialogBox(); System.out.println(text); goToUserInput(); diff --git a/src/main/java/bitFight/Enemy.java b/src/main/java/bitFight/Enemy.java index a2ec9113a2c5f2083e9b33573fe3f6eefdc340c4..948ce6f6515077b53acff449dff38749c5ee60f0 100644 --- a/src/main/java/bitFight/Enemy.java +++ b/src/main/java/bitFight/Enemy.java @@ -32,7 +32,7 @@ public class Enemy extends Character{ public String toString() { - return name + " LE " + characteristic.name() + " : level " + this.level + " - Current life level : " + (int)this.currentHealth; + return name + " LE " + characteristic.name() + " : level " + this.level; } public Characteristics getCharacteristic() { diff --git a/src/main/java/bitFight/Input.java b/src/main/java/bitFight/Input.java index 1b19f6f427d0cd68b5f529b97278c0b4779e9a0d..e1f86164b39df1417b727a9359063853c2c09bf2 100644 --- a/src/main/java/bitFight/Input.java +++ b/src/main/java/bitFight/Input.java @@ -39,11 +39,7 @@ public class Input { e.printStackTrace(); } } catch (InvalidInputException e) { - try { - Display.newPrintln(e.getMessage()); - } catch (IOException e1) { - e1.printStackTrace(); - } + Display.newPrintln(e.getMessage()); } } while (!validInput()); diff --git a/src/main/java/bitFight/Level.java b/src/main/java/bitFight/Level.java index cf7db71f57b4d9490de9fbb96ce53845344fe3c8..4dd619c587f1c2ebbce23f748030f33cbb3115ec 100644 --- a/src/main/java/bitFight/Level.java +++ b/src/main/java/bitFight/Level.java @@ -59,19 +59,22 @@ public class Level{ // annonce un nouvel ennemi public void ennemyShowing() { System.out.println("An ennemy just appeared : " + this.ennemy.toString()); + System.out.println(); } - public void ennemyFaster(Attack attack) { - System.out.println("The ennemy attacks before you can!"); + public void ennemyFaster(Attack attack) throws IOException { + Display.clearDialogBox(); + System.out.println("The ennemy attacks before you can !"); player.setCurrentHealth(player.getCurrentHealth() - attack.getDamage() * this.ennemy.getAttackMultiplier()); //Récupère une attaque aléatoire dans l'enum ennemy.exhaust(attack.getEnergyCost()); System.out.println(attack.getName() + "!! You receive " + (int) attack.getDamage() * this.ennemy.getAttackMultiplier() + " damage!"); System.out.println(this.player.getName() + "'s life' : " + this.displayPlayerHealth()); + Display.goToUserInput(); } // affiche la jauge de vie de l'ennemi public String displayEnnemyHealth() { - return (int)this.ennemy.getCurrentHealth() +"/" + (int)this.ennemy.getMaxHealth(); + return this.ennemy.toString() + " - " + (int)this.ennemy.getCurrentHealth() +"/" + (int)this.ennemy.getMaxHealth(); } // affiche la jauge de vie du joueur @@ -109,15 +112,19 @@ public class Level{ // méthodes de combats // liste des attaques et défenses possibles pour le joueur - public void possibleActions() { + public void possibleActions() throws IOException { + Display.clearDialogBox(); System.out.println("Possible attacks are : \n \t punch, kick, double kick, supermanpunch. \""); System.out.println("Possible defenses are : \n \t lowblock, highblock\""); + Display.goToUserInput(); } // quand l'utilisateur choisit une action qui n'existe pas - public void invalidActionChoice() { + public void invalidActionChoice() throws IOException { + Display.clearDialogBox(); System.out.println("This action is not available."); possibleActions(); + Display.goToUserInput(); } // méthodes de paramètrages @@ -163,7 +170,7 @@ public class Level{ image.imageGenerator(); } - public static void gameOver() throws IOException, InterruptedException{ + public void gameOver() throws IOException, InterruptedException{ Image image=new Image("res/game", 9); image.imageGenerator(); Thread.sleep(700); @@ -174,7 +181,7 @@ public class Level{ } - public static void victory() throws IOException, InterruptedException{ + public void victory() throws IOException, InterruptedException{ Image image=new Image("res/victory.clj", 8); image.imageGenerator(); Thread.sleep(1250); @@ -186,7 +193,7 @@ public class Level{ image3.imageGenerator(); } - public static void defeat() throws IOException, InterruptedException{ + public void defeat() throws IOException, InterruptedException{ Image image=new Image("res/Defeat", 8); image.imageGenerator(); Thread.sleep(1250); diff --git a/src/main/java/bitFight/Main.java b/src/main/java/bitFight/Main.java index 74a651dd045f8d7011025139451bc5c768a63352..0de1a18f98fa6244ca379ab2415272a7eaa1096b 100644 --- a/src/main/java/bitFight/Main.java +++ b/src/main/java/bitFight/Main.java @@ -46,9 +46,11 @@ class Main { Display.goToDialogBox(); - Display.newPrintln(Terminal.RED_BACKGROUND + "ATTAQUEZ" + Terminal.RESET + " ou " + Terminal.PURPLE_BACKGROUND + "QUITTEZ" + Terminal.RESET); + // arrivée de l'ennemi + level.ennemyShowing(); - level.displayGameRules(); + Display.newPrintln(enemy.toString()); + Display.newPrintln(Terminal.RED_BACKGROUND + "ATTAQUEZ" + Terminal.RESET + " ou " + Terminal.PURPLE_BACKGROUND + "QUITTEZ" + Terminal.RESET); Display.goToUserInput(); @@ -68,15 +70,13 @@ class Main { if (input.getInput().equals("a")) { - while (!input.getInput().equals("q") && !enemy.isDead() && !player.isDead()) { - - //A garder au début de la boucle, mesure le temps que le joueur à pris d'écrire - LocalDateTime timeBeforeAttack = LocalDateTime.now(); - int attackTime = 5 - (int)(5 * rand.nextDouble()); - - // arrivée de l'ennemi - level.ennemyShowing(); - + while (!input.getInput().equals("q") && !enemy.isDead() && !player.isDead()) { + + //A garder au début de la boucle, mesure le temps que le joueur à pris d'écrire + LocalDateTime timeBeforeAttack = LocalDateTime.now(); + int attackTime = 5 - (int)(5 * rand.nextDouble()); + + if (input.getInput().equals("a")) { level.possibleActions(); input.newInput(); @@ -95,8 +95,6 @@ class Main { Display.clearDialogBox(); level.invalidActionChoice(); input.newInput(); - System.out.println(actionNames.toString()); - System.out.println(input.getInput()); } } @@ -112,7 +110,9 @@ class Main { Display.newPrintln(enemy.toString()); //Display.clearDialogBox(); - + + input.newInput(); + if (enemy.isDead()){ level.ennemyDying(); player.revive(); @@ -135,4 +135,5 @@ class Main { Save.saveObject("res/gamedata", gamedata); } } +} \ No newline at end of file diff --git a/src/main/java/bitFight/LevelTest.java b/src/test/java/bitFight/LevelTest.java similarity index 81% rename from src/main/java/bitFight/LevelTest.java rename to src/test/java/bitFight/LevelTest.java index 0cff06e7432c8215371faf494f5e336dfcef1f19..f4f1a51aea5ef233b9a2c4c361d6741447efb8a9 100644 --- a/src/main/java/bitFight/LevelTest.java +++ b/src/test/java/bitFight/LevelTest.java @@ -6,7 +6,7 @@ public class LevelTest { public static void main(String[] args) throws IOException, InterruptedException { //Level.fightScene(); //Level.bigFightScene(); - Level.gameOver(); - Level.defeat(); + //Level.gameOver(); + // Level.defeat(); } }