mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-10-31 03:39:16 +00:00 
			
		
		
		
	add fight data at enemy
This commit is contained in:
		| @@ -1,14 +1,21 @@ | |||||||
| package Entity; | package Entity; | ||||||
|  |  | ||||||
|  | import Text.FightData; | ||||||
|  |  | ||||||
| import com.badlogic.gdx.math.Vector2; | import com.badlogic.gdx.math.Vector2; | ||||||
|  |  | ||||||
| import ch.hevs.gdx2d.lib.GdxGraphics; | import ch.hevs.gdx2d.lib.GdxGraphics; | ||||||
|  |  | ||||||
| public class Enemy extends Character{ | public class Enemy extends Character{ | ||||||
|  |  | ||||||
|  |     public FightData fightData; | ||||||
|  |  | ||||||
|     public Enemy(String name, int x, int y, String img) { |     public Enemy(String name, int x, int y, String img) { | ||||||
|         super(name, x, y, img); |         super(name, x, y, img); | ||||||
|  |         //generate the vector of fight | ||||||
|  |         fightData = new FightData(name); | ||||||
|         //TODO Auto-generated constructor stub |         //TODO Auto-generated constructor stub | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setPosition(int x, int y){ |     public void setPosition(int x, int y){ | ||||||
|   | |||||||
							
								
								
									
										23
									
								
								src/Text/Attack.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/Text/Attack.java
									
									
									
									
									
										Normal 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; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -11,16 +11,18 @@ public class FightData { | |||||||
|     private  File file; |     private  File file; | ||||||
|     private static final String REGEX = ","; |     private static final String REGEX = ","; | ||||||
|  |  | ||||||
|  |     /*  | ||||||
|     public static void main(String[] args) { |     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(); |         d.readFile(); | ||||||
|         for(Attack a : d.attacks){ |         for(Attack a : d.attacks){ | ||||||
|             System.out.println(a); |             System.out.println(a); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |     */ | ||||||
|  |  | ||||||
|     public FightData(String pathname){ |     public FightData(String name) { | ||||||
|         file = new File(pathname); |         file = new File("resources//fight//" + name + ".csv"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void readFile() { |     public void readFile() { | ||||||
| @@ -46,37 +48,17 @@ public class FightData { | |||||||
|          |          | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     //return the vector with all attaks of one enemi | ||||||
|     public Vector<Attack> getAllAttacks(){ |     public Vector<Attack> getAllAttacks(){ | ||||||
|         return attacks; |         return attacks; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|      |     //return the vector with one attak | ||||||
|     public Attack getAttacks(int a){ |     public Attack getAttacks(int a){ | ||||||
|         return attacks.get(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; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|      |      | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user