1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-10-30 03:11:05 +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

@@ -11,23 +11,33 @@ public class FightData {
private File file;
private static final String REGEX = ",";
public int nbre_line =0;
public FightData(String name) {
file = new File("./resources/Battle/Fight/" + name + ".csv");
}
public void readFile() {
Attack attack;
String line = "";
try {
FileReader f = new FileReader(file);
BufferedReader bf = new BufferedReader(f);
//add the line in the vector attacks of attack
line = bf.readLine();
while(line != null){
String[] a = line.split(REGEX);//change the regex if it is another
attack = new Attack(a[0], a[1], a[2], a[3], a[4], Float.valueOf(a[5]));
attacks.add(attack);
line = bf.readLine();
//add line
nbre_line++;
}
bf.close();
@@ -35,10 +45,6 @@ public class FightData {
} catch (Exception e) {
e.printStackTrace();
}
}
//return the vector with all attaks of one enemi