1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2024-11-26 11:03:28 +00:00

Merge pull request #47 from Klagarge:comment-Yann

Comment-Yann
This commit is contained in:
Fastium 2022-06-17 09:40:01 +02:00 committed by GitHub
commit 296caeb0e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -43,21 +43,23 @@ public class Battle {
System.out.println("xp player : " + xpPlayer); System.out.println("xp player : " + xpPlayer);
System.out.println("xp win " + newXp); System.out.println("xp win " + newXp);
//the player is at the last question, the finish text must be displayed
if(getLineSpeech() == 4){ if(getLineSpeech() == 4){
FinishSpeech(); finishSpeech();
} }
//the player is at the finish text and he must quit the battle
else if( getLineSpeech() == 5 || getLineSpeech() == 6){ else if( getLineSpeech() == 5 || getLineSpeech() == 6){
finish(); finish();
e.recoveredTime = 0;
} }
//the player answer the question and it is check and if the enemy is killed
else if(0 < getLineSpeech() && getLineSpeech() < 4){ else if(0 < getLineSpeech() && getLineSpeech() < 4){
checkAnswer(answer); checkAnswer(answer);
if(pvEnemy <= 0){ if(pvEnemy <= 0){
FinishSpeech(); finishSpeech();
} }
} }
//default case : increase speech to display the new line
else{ else{
readNextLine(); readNextLine();
} }
@ -100,7 +102,7 @@ public class Battle {
} }
public void FinishSpeech(){ public void finishSpeech(){
if(pvEnemy>0){ if(pvEnemy>0){
//alive (speechLine = 6) //alive (speechLine = 6)
lineSpeech = 6; lineSpeech = 6;
@ -116,6 +118,7 @@ public class Battle {
public void finish(){ public void finish(){
screenBattleOn = false; screenBattleOn = false;
e.recoveredTime = 0;
} }
public boolean getAttackOn(){ public boolean getAttackOn(){

View File

@ -2,6 +2,7 @@ package Text;
import Entity.Enemy; import Entity.Enemy;
import java.util.Vector; import java.util.Vector;
import java.util.Arrays;
import java.util.Random; import java.util.Random;
public class TextEnemy { public class TextEnemy {
@ -87,7 +88,7 @@ public class TextEnemy {
} }
//Format the line //Format the line
String attack = formatLine(speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ? ("+fightData.getAttack(orderAttack[j]).getXp()+ ") ", CUT); String attack = formatLine(speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ("+fightData.getAttack(orderAttack[j]).getXp()+ ") ", CUT);
String answer1 = formatLine("1. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) , CUT); String answer1 = formatLine("1. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) , CUT);
String answer2 = formatLine("2. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) , CUT); String answer2 = formatLine("2. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) , CUT);
String answer3 = formatLine("3. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) , CUT); String answer3 = formatLine("3. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) , CUT);
@ -100,11 +101,11 @@ public class TextEnemy {
currentData.add(currentRandom); currentData.add(currentRandom);
} }
/* //display answer
for(int[] a : currentData){ for(int[] a : currentData){
System.out.println(Arrays.toString(a)); System.out.println(Arrays.toString(a));
} }
*/
//finish (win and death) //finish (win and death)
String dead = formatLine(speechData.getSpeechs(5),CUT); String dead = formatLine(speechData.getSpeechs(5),CUT);