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/Input.java b/src/main/java/bitFight/Input.java index 62d37f08a893c0e84a83d90db6d64c1a51e669c4..ffef1bb9cb8a484a0fbeaca7c1a718a34a22589c 100644 --- a/src/main/java/bitFight/Input.java +++ b/src/main/java/bitFight/Input.java @@ -1,7 +1,9 @@ package bitFight; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; public class Input { @@ -25,7 +27,7 @@ public class Input { } - public void newInput() { + public void newInput() throws IOException { BufferedReader in= new BufferedReader( new InputStreamReader(System.in)); do { @@ -34,14 +36,17 @@ public class Input { setInput(in.readLine()); } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); - } + System.err.println(e.getMessage() + ": Contact support"); + } } catch (InvalidInputException e) { - Display.newPrintln(e.getMessage()); + Display.newPrintln(e.getMessage()); + } catch (Exception e) { + System.err.println(e.getMessage()+": Contact support"); + } finally { + in.close(); } } while (!validInput()); - } public Input() { diff --git a/src/main/java/bitFight/Level.java b/src/main/java/bitFight/Level.java index 7c792aa03633c85e96e1ef7fe95be126ddd1f9c2..635b5b9dc63162fc080208df0c9641373209ccd4 100644 --- a/src/main/java/bitFight/Level.java +++ b/src/main/java/bitFight/Level.java @@ -62,11 +62,12 @@ public class Level{ System.out.println(); } - public void ennemyFaster(Attack attack) { + 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 - System.out.println(attack.getName() + "!! You're getting " + (int) attack.getDamage() * this.ennemy.getAttackMultiplier() + " of damage!"); + 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(); } @@ -125,7 +126,7 @@ 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\""); @@ -133,7 +134,7 @@ public class Level{ } // 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(); @@ -158,6 +159,17 @@ public class Level{ } } + public void defends(Character character, Defense defense, Attack attack){ + if(defense.getHeight() == attack.getHeight()){ + character.currentEnergy += 60; + if(character.currentEnergy > character.maxEnergy) character.currentEnergy = character.maxEnergy; + System.out.println("The attack is blocked! 60 energy is gained"); + } else { + character.currentEnergy += 30; + character.currentHealth -= attack.getDamage(); + System.out.println("The block fails! 30 energy is gained, but damage is still done"); + } + } //Affichage ascii @@ -172,7 +184,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); @@ -183,7 +195,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); @@ -195,7 +207,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/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(); } }