1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-07-07 17:01:10 +00:00

should work

This commit is contained in:
Fastium
2022-06-13 20:53:09 +02:00
parent a4b760fe66
commit ba7694528f
8 changed files with 107 additions and 46 deletions

View File

@ -1,5 +1,7 @@
package Game;
import java.util.Arrays;
import Entity.Enemy;
import Text.TextEnemy;
@ -11,6 +13,8 @@ public class Battle {
private int lineSpeech;
public int answer;
private int winPoint;
public Battle(Enemy enemy){
@ -19,9 +23,8 @@ public class Battle {
textEnemy.generateText();
lineSpeech = 0;
answer = 0;
winPoint = 0;
//initialize the first line
System.out.println("lll : "+ getLine());
}
@ -32,6 +35,37 @@ public class Battle {
}
//check the choice answer
public void checkAnswer(int answer){
int attack = lineSpeech-1;
//get number current attack random
int currentAttack = textEnemy.getCurrentData().get(attack)[0];
System.out.println(Arrays.toString(textEnemy.getCurrentData().get(attack)));
//get number current answer random
int currentAnswer = textEnemy.getCurrentData().get(attack)[answer];
System.out.println("current answer : " + currentAnswer);
//get the answer of the player
String answerPlayer = textEnemy.fightData.getAttack(currentAttack).getAnswer(currentAnswer);
System.out.println("answer player : " + answerPlayer);
//get true answer
String trueAsnwer = textEnemy.fightData.getAttack(currentAttack).getTrueAnswer();
System.out.println("true answer : " + trueAsnwer);
//check the choice of the player
if(answerPlayer == trueAsnwer){
System.out.println("it's true !!!!");
}
else{
System.out.println("it's false !!!!");
}
readNextLine();
}
public boolean getAttackOn(){
return textEnemy.lines.get(lineSpeech).attackOn;
}
@ -40,6 +74,7 @@ public class Battle {
return textEnemy.lines.get(lineSpeech).line;
}
public int getLineSpeech() {
return lineSpeech;
}