mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-04 05:09:18 +00:00 
			
		
		
		
	change the world
This commit is contained in:
		@@ -4,9 +4,11 @@ import com.badlogic.gdx.math.Vector2;
 | 
			
		||||
 | 
			
		||||
public class Enemy extends Character{
 | 
			
		||||
 | 
			
		||||
    private String branch;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public Enemy(String name, int x, int y, String img, String map, int pv) {
 | 
			
		||||
 | 
			
		||||
    public Enemy(String name, int x, int y, String img, String map, int pv, String branch) {
 | 
			
		||||
        super(name, x, y, img, map);
 | 
			
		||||
        //generate his text
 | 
			
		||||
 | 
			
		||||
@@ -14,6 +16,8 @@ public class Enemy extends Character{
 | 
			
		||||
 | 
			
		||||
        turn(Character.Direction.DOWN);
 | 
			
		||||
 | 
			
		||||
        this.branch = branch;
 | 
			
		||||
 | 
			
		||||
        this.pv = pv;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -33,5 +37,9 @@ public class Enemy extends Character{
 | 
			
		||||
        this.pv -= pv;
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getBranch(){
 | 
			
		||||
        return branch;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ import Text.TextEnemy;
 | 
			
		||||
 | 
			
		||||
public class Battle {
 | 
			
		||||
 | 
			
		||||
    private Enemy e;
 | 
			
		||||
    public TextEnemy textEnemy;
 | 
			
		||||
    private int lineSpeech;
 | 
			
		||||
	public int answer;
 | 
			
		||||
@@ -16,9 +17,11 @@ public class Battle {
 | 
			
		||||
    public boolean screenBattleOn = true;
 | 
			
		||||
   
 | 
			
		||||
    public Battle(Enemy e){
 | 
			
		||||
        textEnemy = new TextEnemy("enemi"); // should be enemy.name
 | 
			
		||||
		textEnemy.generateText();
 | 
			
		||||
 | 
			
		||||
        if(e != null){
 | 
			
		||||
            textEnemy = new TextEnemy(e);  
 | 
			
		||||
            textEnemy.generateText();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        lineSpeech = 0;
 | 
			
		||||
        newXp = 0;
 | 
			
		||||
 | 
			
		||||
@@ -76,7 +79,10 @@ public class Battle {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getLine(){
 | 
			
		||||
        if(e==null) return null;
 | 
			
		||||
    
 | 
			
		||||
        return textEnemy.lines.get(lineSpeech).line;
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
@@ -91,4 +97,8 @@ public class Battle {
 | 
			
		||||
    public int getNewXp(){
 | 
			
		||||
        return newXp;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setEnemy(Enemy e){
 | 
			
		||||
        this.e = e;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -45,8 +45,8 @@ public class PokeMudry extends PortableApplication {
 | 
			
		||||
 | 
			
		||||
        // add player, create and add all enemies in entities
 | 
			
		||||
		entities.add((Entity) sp.p);
 | 
			
		||||
		enemies.add(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 100));
 | 
			
		||||
		enemies.add(new Enemy("Pignat", 5, 1, "lumberjack_sheet32", "test", 150));
 | 
			
		||||
		enemies.add(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique"));
 | 
			
		||||
		//enemies.add(new Enemy("Pignat", 5, 1, "lumberjack_sheet32", "test", 150));
 | 
			
		||||
        for (Enemy enemy : enemies) { entities.add(enemy); }
 | 
			
		||||
 | 
			
		||||
		//Init all entities
 | 
			
		||||
@@ -65,6 +65,8 @@ public class PokeMudry extends PortableApplication {
 | 
			
		||||
        if (sp.p.onEnemy && onMapScreen){
 | 
			
		||||
            sp.e = sp.p.lastEnemy;
 | 
			
		||||
            sp.sb = sp.screenManager.getScreenBattle();
 | 
			
		||||
            if(sp.e == null) System.out.println("sdfsdfsdfsdf");
 | 
			
		||||
            
 | 
			
		||||
            sp.b = new Battle(sp.e);
 | 
			
		||||
            g.resetCamera();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,8 @@ public class ScreenPlayer {
 | 
			
		||||
 | 
			
		||||
        // One player by ScreenPlayer
 | 
			
		||||
        p = new Player(8, 15, "desert");
 | 
			
		||||
        b = new Battle(e);
 | 
			
		||||
 | 
			
		||||
        b = new Battle(new Enemy("enemi", 0, 0, "charachter", "desert", 50, "enemi"));
 | 
			
		||||
 | 
			
		||||
        // Create both type of screen and record for reuse
 | 
			
		||||
        screenManager.registerScreen(ScreenMap.class);
 | 
			
		||||
@@ -34,6 +35,7 @@ public class ScreenPlayer {
 | 
			
		||||
        
 | 
			
		||||
        if(sb != null){
 | 
			
		||||
            sb.setBattle(b);
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        screenManager.render(g);
 | 
			
		||||
 
 | 
			
		||||
@@ -9,14 +9,14 @@ public class FightData {
 | 
			
		||||
 | 
			
		||||
    private  Vector<Attack> attacks = new Vector<Attack>();
 | 
			
		||||
    private  File file;
 | 
			
		||||
    private static final String REGEX = ",";
 | 
			
		||||
    private static String regex = ";";
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public int nbre_line =0;
 | 
			
		||||
 | 
			
		||||
    public FightData(String name) {
 | 
			
		||||
        file = new File("./resources/Battle/Fight/" + name + ".csv");
 | 
			
		||||
    public FightData(String branch) {
 | 
			
		||||
        file = new File("./resources/Battle/Fight/" + branch + ".csv");
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -30,9 +30,11 @@ public class FightData {
 | 
			
		||||
 | 
			
		||||
            //add the line in the vector attacks of attack
 | 
			
		||||
            line = bf.readLine(); 
 | 
			
		||||
            System.out.println(line);
 | 
			
		||||
            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]));
 | 
			
		||||
                String[] a = line.split(regex);//change the regex if it is another
 | 
			
		||||
                System.out.println(a.length);
 | 
			
		||||
                attack = new Attack(a[0], a[1], a[2], a[3], a[4], Integer.valueOf(a[5]));
 | 
			
		||||
                attacks.add(attack);
 | 
			
		||||
                line = bf.readLine();
 | 
			
		||||
                //add line
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,9 @@
 | 
			
		||||
package Text;
 | 
			
		||||
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
 | 
			
		||||
import Entity.Enemy;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
 | 
			
		||||
@@ -17,24 +20,22 @@ public class TextEnemy {
 | 
			
		||||
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        TextEnemy t  = new TextEnemy("enemi");
 | 
			
		||||
        TextEnemy t  = new TextEnemy(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique"));
 | 
			
		||||
 | 
			
		||||
        t.generateText();
 | 
			
		||||
 | 
			
		||||
        for(Line l : t.lines) {
 | 
			
		||||
            System.out.println(l.line);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
       
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public TextEnemy(String name){
 | 
			
		||||
    public TextEnemy(Enemy e){
 | 
			
		||||
        //generate the vector of fight
 | 
			
		||||
        fightData = new FightData(name);
 | 
			
		||||
        fightData = new FightData(e.getBranch());
 | 
			
		||||
        fightData.readFile();
 | 
			
		||||
 | 
			
		||||
        //generate the vector of Speechs
 | 
			
		||||
        speechData = new SpeechData(name);
 | 
			
		||||
        speechData = new SpeechData(e.getName());
 | 
			
		||||
        speechData.readFile();
 | 
			
		||||
 | 
			
		||||
        //save random data (attack and ansver) : attack, answer 1, answer 2 answer 3, answer 4
 | 
			
		||||
@@ -98,7 +99,7 @@ public class TextEnemy {
 | 
			
		||||
 | 
			
		||||
            //attack and answer (number on vector : 1-4) 
 | 
			
		||||
            lines.add(new Line(
 | 
			
		||||
                speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ?  ("+fightData.getAttack(orderAttack[j]).xp+ ") " + "\n" +
 | 
			
		||||
                speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ?  ("+fightData.getAttack(orderAttack[j]).getXp()+ ") " + "\n" +
 | 
			
		||||
                "1. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) + "\n" +
 | 
			
		||||
                "2. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) + "\n" + 
 | 
			
		||||
                "3. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) + "\n" + 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user