Skip to content
Snippets Groups Projects
Commit c13b6c91 authored by Gabriel Mille's avatar Gabriel Mille
Browse files

correction main

parent 00ab6da6
Branches
No related tags found
No related merge requests found
File added
...@@ -75,14 +75,13 @@ class Main { ...@@ -75,14 +75,13 @@ class Main {
// arrivée de l'ennemi // arrivée de l'ennemi
level.ennemyShowing(); level.ennemyShowing();
if (input.getInput().equals("a")) {
level.possibleActions(); level.possibleActions();
input.newInput(in.readLine()); input.newInput(in.readLine());
// Boucle tant que le joueur n'a pas taper de nom d'une attaque valide // Boucle tant que le joueur n'a pas taper de nom d'une attaque valide ou tape trop tard ou tape q
while (!actionNames.contains(input.getInput()) || Attack.attackInTime(timeBeforeAttack, attackTime)) { while ((!actionNames.contains(input.getInput()) || !Attack.attackInTime(timeBeforeAttack, attackTime)) && !input.getInput().equals("q")) {
//Si le joueur est trop lent, l'ennemi fait une attaque aléatoire //Si le joueur est trop lent, l'ennemi fait une attaque aléatoire
if(Attack.attackInTime(timeBeforeAttack, attackTime)){ if(!Attack.attackInTime(timeBeforeAttack, attackTime)){
Display.clearDialogBox(); Display.clearDialogBox();
Attack randomEnemyAttack = Attack.values()[(int) rand.nextDouble()*Attack.values().length]; Attack randomEnemyAttack = Attack.values()[(int) rand.nextDouble()*Attack.values().length];
level.ennemyFaster(randomEnemyAttack); level.ennemyFaster(randomEnemyAttack);
...@@ -100,7 +99,7 @@ class Main { ...@@ -100,7 +99,7 @@ class Main {
} }
if(!player.isExhausted()){ if(!player.isExhausted() && !input.getInput().equals("q") ){
Attack attack = Attack.valueOf(actionNames.get(actionNames.indexOf(input.getInput())).toUpperCase()); Attack attack = Attack.valueOf(actionNames.get(actionNames.indexOf(input.getInput())).toUpperCase());
level.playerHasEnergy(attack); level.playerHasEnergy(attack);
} else {} //TODO ajouter display trop fatigué } else {} //TODO ajouter display trop fatigué
...@@ -112,7 +111,6 @@ class Main { ...@@ -112,7 +111,6 @@ class Main {
//Display.clearDialogBox(); //Display.clearDialogBox();
input.newInput(in.readLine());;
if (enemy.isDead()){ if (enemy.isDead()){
level.ennemyDying(); level.ennemyDying();
player.revive(); player.revive();
...@@ -129,7 +127,6 @@ class Main { ...@@ -129,7 +127,6 @@ class Main {
} }
} }
}
in.close(); in.close();
Save.saveObject("res/gamedata", gamedata); Save.saveObject("res/gamedata", gamedata);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment