Skip to content
Snippets Groups Projects
Commit 09ea1016 authored by Mohamed Taarit's avatar Mohamed Taarit
Browse files
parents 88206905 60887793
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
# 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
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() {
......
......@@ -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);
......
......@@ -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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment