1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-03-14 14:54:33 +00:00
PokeHES/src/Game/Battle.java

95 lines
2.2 KiB
Java
Raw Normal View History

2022-06-10 19:33:24 +02:00
package Game;
2022-06-13 20:53:09 +02:00
import java.util.Arrays;
2022-06-12 12:10:57 +02:00
import Entity.Enemy;
import Text.TextEnemy;
2022-06-10 19:33:24 +02:00
public class Battle {
2022-06-13 21:54:05 +02:00
2022-06-12 12:10:57 +02:00
TextEnemy textEnemy;
2022-06-12 14:26:02 +02:00
private int lineSpeech;
2022-06-12 12:10:57 +02:00
2022-06-12 14:26:02 +02:00
public int answer;
2022-06-13 20:53:09 +02:00
private int winPoint;
2022-06-13 21:54:05 +02:00
private boolean screenBattleOn = true;
2022-06-12 14:26:02 +02:00
2022-06-12 12:10:57 +02:00
public Battle(Enemy enemy){
textEnemy = new TextEnemy("enemi"); // should be enemy.name
textEnemy.generateText();
2022-06-12 14:26:02 +02:00
lineSpeech = 0;
2022-06-13 20:53:09 +02:00
winPoint = 0;
2022-06-12 14:26:02 +02:00
2022-06-12 12:10:57 +02:00
System.out.println("lll : "+ getLine());
}
public void readNextLine(){
//change line
2022-06-13 21:38:00 +02:00
System.out.println(textEnemy.lines.size());
if(lineSpeech < textEnemy.lines.size()-1){
lineSpeech++;
}
2022-06-12 12:10:57 +02:00
}
2022-06-13 20:53:09 +02:00
//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();
}
2022-06-13 21:38:00 +02:00
public boolean finish(){
return false;
}
2022-06-12 12:10:57 +02:00
public boolean getAttackOn(){
return textEnemy.lines.get(lineSpeech).attackOn;
}
2022-06-11 21:45:45 +02:00
2022-06-12 12:10:57 +02:00
public String getLine(){
return textEnemy.lines.get(lineSpeech).line;
}
2022-06-12 14:26:02 +02:00
2022-06-13 20:53:09 +02:00
2022-06-12 14:26:02 +02:00
public int getLineSpeech() {
return lineSpeech;
}
2022-06-13 21:54:05 +02:00
2022-06-13 21:57:01 +02:00
public boolean getScreenBattleOn(){
2022-06-13 21:54:05 +02:00
return screenBattleOn;
}
2022-06-11 21:45:45 +02:00
2022-06-10 19:33:24 +02:00
}