mirror of
https://github.com/Klagarge/PokeHES.git
synced 2025-07-17 21:31:10 +00:00
add pokemon for enemy
This commit is contained in:
@ -14,7 +14,7 @@ public class FightData {
|
||||
|
||||
|
||||
|
||||
public int nbre_line =0;
|
||||
public int nbr_line =0;
|
||||
|
||||
public FightData(String branch) {
|
||||
file = new File("./Data/Battle/Fight/" + branch + ".csv");
|
||||
@ -37,7 +37,7 @@ public class FightData {
|
||||
attacks.add(attack);
|
||||
line = bf.readLine();
|
||||
//add line
|
||||
nbre_line++;
|
||||
nbr_line++;
|
||||
}
|
||||
|
||||
bf.close();
|
||||
|
@ -1,8 +1,6 @@
|
||||
package Text;
|
||||
|
||||
import Entity.Enemy;
|
||||
import Entity.Character.Direction;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
@ -18,16 +16,6 @@ public class TextEnemy {
|
||||
private int[] orderAnswer;
|
||||
|
||||
private Vector<int[]> currentData;
|
||||
|
||||
public static void main(String[] args) {
|
||||
TextEnemy t = new TextEnemy(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique", Direction.NULL));
|
||||
|
||||
t.generateText();
|
||||
|
||||
for(Line l : t.lines) {
|
||||
System.out.println(l.line);
|
||||
}
|
||||
}
|
||||
|
||||
public TextEnemy(Enemy e){
|
||||
//generate the vector of fight
|
||||
@ -38,12 +26,12 @@ public class TextEnemy {
|
||||
speechData = new SpeechData(e.getName());
|
||||
speechData.readFile();
|
||||
|
||||
//save random data (attack and ansver) : attack, answer 1, answer 2 answer 3, answer 4
|
||||
//save random data (attack and answer) : attack, answer 1, answer 2 answer 3, answer 4
|
||||
currentData = new Vector<int[]>();
|
||||
|
||||
}
|
||||
|
||||
public static int[] randomGenerate( int min, int max, int nbreRandom){
|
||||
public static int[] randomGenerate( int min, int max, int nbrRandom){
|
||||
//create an array with all the number I need
|
||||
int[] a = new int[max-min+1];
|
||||
int k = min;
|
||||
@ -53,7 +41,7 @@ public class TextEnemy {
|
||||
}
|
||||
|
||||
//create a new array with the numbers I want
|
||||
int[] b = new int[nbreRandom];
|
||||
int[] b = new int[nbrRandom];
|
||||
|
||||
// Creating object for Random class
|
||||
Random rd = new Random();
|
||||
@ -70,7 +58,7 @@ public class TextEnemy {
|
||||
a[j] = temp;
|
||||
}
|
||||
//add the numbers I want
|
||||
for(int i=0;i<nbreRandom;i++){
|
||||
for(int i=0;i<nbrRandom;i++){
|
||||
b[i] = a[i];
|
||||
}
|
||||
return b;
|
||||
@ -86,7 +74,7 @@ public class TextEnemy {
|
||||
lines.add(new Line(introduction, false));
|
||||
|
||||
|
||||
orderAttack = randomGenerate(0, fightData.nbre_line-1, 4);
|
||||
orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
|
||||
for(int j=0; j<4;j++){
|
||||
int[] currentRandom = new int[5];
|
||||
currentRandom[0] = orderAttack[j];
|
||||
@ -135,7 +123,7 @@ public class TextEnemy {
|
||||
String newLine = "";
|
||||
|
||||
int startC = 0;
|
||||
int stoppC = cut;
|
||||
int stopC = cut;
|
||||
|
||||
if(cut>line.length()-1){
|
||||
newLine =line;
|
||||
@ -151,35 +139,35 @@ public class TextEnemy {
|
||||
|
||||
|
||||
while(true){
|
||||
for(int i =stoppC; i>=startC; i--){
|
||||
for(int i =stopC; i>=startC; i--){
|
||||
if(c[i] == ' '){
|
||||
stoppC = i;
|
||||
stopC = i;
|
||||
break;
|
||||
}
|
||||
else if(stoppC == c.length-1){
|
||||
else if(stopC == c.length-1){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//découper le mot
|
||||
for(int i=startC;i<=stoppC;i++){
|
||||
for(int i=startC;i<=stopC;i++){
|
||||
cutLine += c[i];
|
||||
}
|
||||
|
||||
newLine += cutLine+"\n";
|
||||
cutLine = "";
|
||||
|
||||
startC = stoppC + 1;
|
||||
startC = stopC + 1;
|
||||
|
||||
|
||||
if(c.length-1-stoppC <=0){
|
||||
if(c.length-1-stopC <=0){
|
||||
break;
|
||||
}
|
||||
else if(c.length-1-stoppC <= cut){
|
||||
stoppC = c.length-1;
|
||||
else if(c.length-1-stopC <= cut){
|
||||
stopC = c.length-1;
|
||||
}
|
||||
else{
|
||||
stoppC += cut;
|
||||
stopC += cut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user