mirror of
https://github.com/Klagarge/PokeHES.git
synced 2025-10-30 03:11:05 +00:00
c
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user