Skip to content
Snippets Groups Projects
Commit 2fbcdcdd authored by Camille Okubo's avatar Camille Okubo
Browse files
parents 42162c59 1730af74
Branches
No related tags found
No related merge requests found
________________________________________________________________________________________________________________________
...@@ -13,7 +13,7 @@ ________________________________________________________________________________ ...@@ -13,7 +13,7 @@ ________________________________________________________________________________
Commandes : Commandes :
a - Attaquer a - Action
q - Quitter q - Quitter
________________________________________________________________________________________________________________________ ________________________________________________________________________________________________________________________
\ No newline at end of file
...@@ -6,12 +6,16 @@ ...@@ -6,12 +6,16 @@
- Implémentation du score et de la sauvegarde - Implémentation du score et de la sauvegarde
### Ce que nous allons faire durant le prochain sprint ### 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 ## 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é ? ### Sur quoi avons nous butté ?
- Gestion des bugs et du temps
### PDCA ### PDCA
......
# 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
File added
...@@ -31,20 +31,27 @@ public class Display { ...@@ -31,20 +31,27 @@ public class Display {
} }
public static void goToDialogBox(){ 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(); clearScreen();
setCursorPos(row, 0); setCursorPos(row, 0);
printDialogBox(); printDialogBox();
goToDialogBox(); goToDialogBox();
} }
public static void printDialogBox() throws IOException{ public static void printDialogBox(){
setCursorPos(50, 0); setCursorPos(100, 0);
String dialogBox = loadTextFile("assets/DialogBox.text"); String dialogBox = "";
try {
dialogBox = loadTextFile("assets/DialogBox.text");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(dialogBox); System.out.println(dialogBox);
} }
...@@ -52,7 +59,7 @@ public class Display { ...@@ -52,7 +59,7 @@ public class Display {
setCursorPos(50, 0); setCursorPos(50, 0);
} }
public static void newPrintln(String text) throws IOException{ public static void newPrintln(String text){
clearDialogBox(); clearDialogBox();
System.out.println(text); System.out.println(text);
goToUserInput(); goToUserInput();
......
...@@ -32,7 +32,7 @@ public class Enemy extends Character{ ...@@ -32,7 +32,7 @@ public class Enemy extends Character{
public String toString() { 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() { public Characteristics getCharacteristic() {
......
...@@ -39,11 +39,7 @@ public class Input { ...@@ -39,11 +39,7 @@ public class Input {
e.printStackTrace(); e.printStackTrace();
} }
} catch (InvalidInputException e) { } catch (InvalidInputException e) {
try { Display.newPrintln(e.getMessage());
Display.newPrintln(e.getMessage());
} catch (IOException e1) {
e1.printStackTrace();
}
} }
} }
while (!validInput()); while (!validInput());
......
...@@ -59,19 +59,22 @@ public class Level{ ...@@ -59,19 +59,22 @@ public class Level{
// annonce un nouvel ennemi // annonce un nouvel ennemi
public void ennemyShowing() { public void ennemyShowing() {
System.out.println("An ennemy just appeared : " + this.ennemy.toString()); System.out.println("An ennemy just appeared : " + this.ennemy.toString());
System.out.println();
} }
public void ennemyFaster(Attack attack) { public void ennemyFaster(Attack attack) throws IOException {
System.out.println("The ennemy attacks before you can!"); 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 player.setCurrentHealth(player.getCurrentHealth() - attack.getDamage() * this.ennemy.getAttackMultiplier()); //Récupère une attaque aléatoire dans l'enum
ennemy.exhaust(attack.getEnergyCost()); ennemy.exhaust(attack.getEnergyCost());
System.out.println(attack.getName() + "!! You receive " + (int) attack.getDamage() * this.ennemy.getAttackMultiplier() + " damage!"); System.out.println(attack.getName() + "!! You receive " + (int) attack.getDamage() * this.ennemy.getAttackMultiplier() + " damage!");
System.out.println(this.player.getName() + "'s life' : " + this.displayPlayerHealth()); System.out.println(this.player.getName() + "'s life' : " + this.displayPlayerHealth());
Display.goToUserInput();
} }
// affiche la jauge de vie de l'ennemi // affiche la jauge de vie de l'ennemi
public String displayEnnemyHealth() { 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 // affiche la jauge de vie du joueur
...@@ -109,15 +112,19 @@ public class Level{ ...@@ -109,15 +112,19 @@ public class Level{
// méthodes de combats // méthodes de combats
// liste des attaques et défenses possibles pour le joueur // 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 attacks are : \n \t punch, kick, double kick, supermanpunch. \"");
System.out.println("Possible defenses are : \n \t lowblock, highblock\""); System.out.println("Possible defenses are : \n \t lowblock, highblock\"");
Display.goToUserInput();
} }
// quand l'utilisateur choisit une action qui n'existe pas // 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."); System.out.println("This action is not available.");
possibleActions(); possibleActions();
Display.goToUserInput();
} }
// méthodes de paramètrages // méthodes de paramètrages
...@@ -163,7 +170,7 @@ public class Level{ ...@@ -163,7 +170,7 @@ public class Level{
image.imageGenerator(); image.imageGenerator();
} }
public static void gameOver() throws IOException, InterruptedException{ public void gameOver() throws IOException, InterruptedException{
Image image=new Image("res/game", 9); Image image=new Image("res/game", 9);
image.imageGenerator(); image.imageGenerator();
Thread.sleep(700); Thread.sleep(700);
...@@ -174,7 +181,7 @@ public class Level{ ...@@ -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 image=new Image("res/victory.clj", 8);
image.imageGenerator(); image.imageGenerator();
Thread.sleep(1250); Thread.sleep(1250);
...@@ -186,7 +193,7 @@ public class Level{ ...@@ -186,7 +193,7 @@ public class Level{
image3.imageGenerator(); image3.imageGenerator();
} }
public static void defeat() throws IOException, InterruptedException{ public void defeat() throws IOException, InterruptedException{
Image image=new Image("res/Defeat", 8); Image image=new Image("res/Defeat", 8);
image.imageGenerator(); image.imageGenerator();
Thread.sleep(1250); Thread.sleep(1250);
......
...@@ -46,9 +46,11 @@ class Main { ...@@ -46,9 +46,11 @@ class Main {
Display.goToDialogBox(); 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(); Display.goToUserInput();
...@@ -68,15 +70,13 @@ class Main { ...@@ -68,15 +70,13 @@ class Main {
if (input.getInput().equals("a")) { if (input.getInput().equals("a")) {
while (!input.getInput().equals("q") && !enemy.isDead() && !player.isDead()) { 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 //A garder au début de la boucle, mesure le temps que le joueur à pris d'écrire
LocalDateTime timeBeforeAttack = LocalDateTime.now(); LocalDateTime timeBeforeAttack = LocalDateTime.now();
int attackTime = 5 - (int)(5 * rand.nextDouble()); int attackTime = 5 - (int)(5 * rand.nextDouble());
// arrivée de l'ennemi if (input.getInput().equals("a")) {
level.ennemyShowing();
level.possibleActions(); level.possibleActions();
input.newInput(); input.newInput();
...@@ -95,8 +95,6 @@ class Main { ...@@ -95,8 +95,6 @@ class Main {
Display.clearDialogBox(); Display.clearDialogBox();
level.invalidActionChoice(); level.invalidActionChoice();
input.newInput(); input.newInput();
System.out.println(actionNames.toString());
System.out.println(input.getInput());
} }
} }
...@@ -112,7 +110,9 @@ class Main { ...@@ -112,7 +110,9 @@ class Main {
Display.newPrintln(enemy.toString()); Display.newPrintln(enemy.toString());
//Display.clearDialogBox(); //Display.clearDialogBox();
input.newInput();
if (enemy.isDead()){ if (enemy.isDead()){
level.ennemyDying(); level.ennemyDying();
player.revive(); player.revive();
...@@ -135,4 +135,5 @@ class Main { ...@@ -135,4 +135,5 @@ class Main {
Save.saveObject("res/gamedata", gamedata); Save.saveObject("res/gamedata", gamedata);
} }
} }
}
\ No newline at end of file
...@@ -6,7 +6,7 @@ public class LevelTest { ...@@ -6,7 +6,7 @@ public class LevelTest {
public static void main(String[] args) throws IOException, InterruptedException { public static void main(String[] args) throws IOException, InterruptedException {
//Level.fightScene(); //Level.fightScene();
//Level.bigFightScene(); //Level.bigFightScene();
Level.gameOver(); //Level.gameOver();
Level.defeat(); // Level.defeat();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment