1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-10-30 11:19:17 +00:00
This commit is contained in:
Fastium
2022-06-12 12:10:57 +02:00
parent d33945ccf4
commit c121320a04
6 changed files with 125 additions and 71 deletions

View File

@@ -1,6 +1,7 @@
package Text;
import java.util.Vector;
import java.util.Random;
public class TextEnemy {
public FightData fightData;
@@ -8,12 +9,18 @@ public class TextEnemy {
public Vector<Line> lines = new Vector<Line>();
public int[] orderAnswer;
public static void main(String[] args) {
TextEnemy t = new TextEnemy("enemi");
t.generateText();
for(Line l : t.lines) {
System.out.println(l.line);
}
}
@@ -28,18 +35,49 @@ public class TextEnemy {
}
int[] randomGenerate(int max_val){
int min_val = 0;
int x;
int[] t = new int[max_val-1];
Random ran = new Random();
int i=0;
while(i<t.length){
System.out.println(i);
t[i] = ran.nextInt(max_val) + min_val;
for(int j : t){
if(t[i] == j){
t[i] = ran.nextInt(max_val) + min_val;
}
else{
i++;
}
}
}
return t;
}
public void generateText(){
int i =1;
//introduction line
lines.add(new Line(speechData.getSpeechs(0), false));
orderAnswer = randomGenerate(fightData.nbre_line);
for(int j=0; j<4;j++){
//generate the order of the answer
//attack and answer (number on vector : 1-4)
lines.add(new Line(
speechData.getSpeechs(i++) + fightData.getAttack(j).attack + "? ("+fightData.getAttack(j).xp+ ") " + "\n" +
fightData.getAttack(j).answer1 + "\n" +
fightData.getAttack(j).answer2 + "\n" +
fightData.getAttack(j).answer3 + "\n" +
fightData.getAttack(j).answer4, true));
speechData.getSpeechs(i++) + fightData.getAttack(orderAnswer[j]).attack + " ? ("+fightData.getAttack(orderAnswer[j]).xp+ ") " + "\n" +
fightData.getAttack(orderAnswer[j]).answer1 + "\n" +
fightData.getAttack(orderAnswer[j]).answer2 + "\n" +
fightData.getAttack(orderAnswer[j]).answer3 + "\n" +
fightData.getAttack(orderAnswer[j]).answer4, true));
// TODO mélanger les attaques aléatoirement
}
//finish (win and death)