1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2024-11-23 01:43:28 +00:00

Merge pull request #6 from Klagarge/fight-data

add fight data at enemy
This commit is contained in:
Fastium 2022-06-08 19:04:37 +01:00 committed by GitHub
commit 1a84524e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 26 deletions

View File

@ -1,14 +1,21 @@
package Entity;
import Text.FightData;
import com.badlogic.gdx.math.Vector2;
import ch.hevs.gdx2d.lib.GdxGraphics;
public class Enemy extends Character{
public FightData fightData;
public Enemy(String name, int x, int y, String img) {
super(name, x, y, img);
//generate the vector of fight
fightData = new FightData(name);
//TODO Auto-generated constructor stub
}
public void setPosition(int x, int y){

23
src/Text/Attack.java Normal file
View File

@ -0,0 +1,23 @@
package Text;
public class Attack {
String attack;
String answer1;
String answer2;
String answer3;
String answer4;
float xp;
Attack(String attack, String answer1,String answer2,String answer3, String answer4, float xp){
this.attack = attack;
this.answer1 = answer1;
this.answer2 = answer2;
this.answer3 = answer3;
this.answer4 = answer4;
this.xp = xp;
}
public String toString(){
return attack+ " " + answer1+ " " + answer2+ " " + answer3+ " " + answer4+ " " + xp;
}
}

View File

@ -11,16 +11,18 @@ public class FightData {
private File file;
private static final String REGEX = ",";
/*
public static void main(String[] args) {
FightData d = new FightData("app/src/main/java/test_map/data/donnee.csv");
FightData d = new FightData("enemi");
d.readFile();
for(Attack a : d.attacks){
System.out.println(a);
}
}
*/
public FightData(String pathname){
file = new File(pathname);
public FightData(String name) {
file = new File("resources//fight//" + name + ".csv");
}
public void readFile() {
@ -46,37 +48,17 @@ public class FightData {
}
//return the vector with all attaks of one enemi
public Vector<Attack> getAllAttacks(){
return attacks;
}
//return the vector with one attak
public Attack getAttacks(int a){
return attacks.get(a);
}
}
class Attack{
String attack;
String answer1;
String answer2;
String answer3;
String answer4;
float xp;
Attack(String attack, String answer1,String answer2,String answer3, String answer4, float xp){
this.attack = attack;
this.answer1 = answer1;
this.answer2 = answer2;
this.answer3 = answer3;
this.answer4 = answer4;
this.xp = xp;
}
public String toString(){
return attack+ " " + answer1+ " " + answer2+ " " + answer3+ " " + answer4+ " " + xp;
}
}