mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-04 05:09:18 +00:00 
			
		
		
		
	new font
This commit is contained in:
		@@ -1,7 +1,5 @@
 | 
			
		||||
package Game;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
 | 
			
		||||
import Entity.Enemy;
 | 
			
		||||
import Text.TextEnemy;
 | 
			
		||||
 | 
			
		||||
@@ -10,7 +8,7 @@ public class Battle {
 | 
			
		||||
    private Enemy e;
 | 
			
		||||
    public TextEnemy textEnemy;
 | 
			
		||||
    private int lineSpeech;
 | 
			
		||||
	public int answer;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public int newXp;
 | 
			
		||||
    public int pvEnemy;
 | 
			
		||||
@@ -31,11 +29,32 @@ public class Battle {
 | 
			
		||||
    public void readNextLine(){
 | 
			
		||||
    //change line
 | 
			
		||||
    System.out.println(textEnemy.lines.size());
 | 
			
		||||
        if(lineSpeech < textEnemy.lines.size()-1){
 | 
			
		||||
        if(lineSpeech < 5){
 | 
			
		||||
            lineSpeech++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    public void action(int answer){
 | 
			
		||||
        System.out.println("pv enemy : " +pvEnemy);
 | 
			
		||||
        System.out.println("xp player : " + xpPlayer);
 | 
			
		||||
        System.out.println("xp win " + newXp);
 | 
			
		||||
        
 | 
			
		||||
        if(getLineSpeech() == 4){
 | 
			
		||||
            FinishSpeech();
 | 
			
		||||
        }
 | 
			
		||||
        else if( getLineSpeech() == 5  || getLineSpeech() == 6){
 | 
			
		||||
            finish();
 | 
			
		||||
        }
 | 
			
		||||
        else if(0 < getLineSpeech() && getLineSpeech() < 4){
 | 
			
		||||
            checkAnswer(answer);
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
        readNextLine();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //check the choice answer
 | 
			
		||||
    public void checkAnswer(int answer){
 | 
			
		||||
        int attack = lineSpeech-1;
 | 
			
		||||
@@ -61,14 +80,7 @@ public class Battle {
 | 
			
		||||
        else{
 | 
			
		||||
            System.out.println("it's false !!!!");
 | 
			
		||||
        }
 | 
			
		||||
        System.out.println("pv enemy : " +pvEnemy);
 | 
			
		||||
        System.out.println("xp player : " + xpPlayer);
 | 
			
		||||
        System.out.println("xp win " + newXp);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        if(lineSpeech < 4) readNextLine();
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        readNextLine();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void updatePlayerEnemy(int xp){
 | 
			
		||||
@@ -82,19 +94,20 @@ public class Battle {
 | 
			
		||||
    public void FinishSpeech(){
 | 
			
		||||
        if(pvEnemy>0){
 | 
			
		||||
            //alive (speechline = 6)
 | 
			
		||||
            for(int i=0;i<2;i++)readNextLine();;
 | 
			
		||||
            lineSpeech += 2;
 | 
			
		||||
            System.out.println("enemy alive");
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
            //dead (speechline = 5)
 | 
			
		||||
            readNextLine();
 | 
			
		||||
            lineSpeech += 1;
 | 
			
		||||
            System.out.println("enemy dead");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public boolean finish(){
 | 
			
		||||
        return false;
 | 
			
		||||
    public void finish(){
 | 
			
		||||
        screenBattleOn = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public boolean getAttackOn(){
 | 
			
		||||
        return textEnemy.lines.get(lineSpeech).attackOn;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -27,15 +27,11 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
 | 
			
		||||
	private Battle b = null;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
	public void onInit() {
 | 
			
		||||
        //display the question
 | 
			
		||||
		generateFont("resources/font/OptimusPrinceps.ttf", 40, Color.BLACK);
 | 
			
		||||
		generateFont("resources/font/Ubuntu-Regular.ttf", 30, Color.BLACK);
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -44,8 +40,6 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
		g.clear(Color.BLACK);
 | 
			
		||||
 | 
			
		||||
		displayDialog(g);
 | 
			
		||||
 | 
			
		||||
		//System.out.println("render: " + battle.getLineSpeech());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
@@ -80,12 +74,8 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
		if(b.getLine() == null) return;
 | 
			
		||||
		g.drawString(15, 245 ,b.getLine() , optimus40);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	public void displayEnemy(Enemy e){
 | 
			
		||||
		// TODO affficher l'enemi
 | 
			
		||||
  	}
 | 
			
		||||
@@ -98,43 +88,28 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
 | 
			
		||||
	public void manage(Controller c, Battle battle){
 | 
			
		||||
		if(PokeMudry.front_montant){
 | 
			
		||||
 	     	System.out.println("manage: " + battle.getLineSpeech());
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			if( battle.getAttackOn() == false){
 | 
			
		||||
				if (c.keyStatus.get(Input.Keys.SPACE)){
 | 
			
		||||
					if(battle.getLineSpeech() == 4){
 | 
			
		||||
						//dislpay the finish speech
 | 
			
		||||
						battle.FinishSpeech();
 | 
			
		||||
					}
 | 
			
		||||
					else if(battle.getLineSpeech() > 4){
 | 
			
		||||
						//return in the map
 | 
			
		||||
						battle.screenBattleOn = battle.finish();
 | 
			
		||||
					}
 | 
			
		||||
					else{
 | 
			
		||||
						//fix next line
 | 
			
		||||
						battle.readNextLine();
 | 
			
		||||
					}
 | 
			
		||||
					
 | 
			
		||||
					battle.action(-1);
 | 
			
		||||
				}
 | 
			
		||||
				if (c.keyStatus.get(Input.Keys.ENTER)){
 | 
			
		||||
					battle.screenBattleOn = battle.finish();
 | 
			
		||||
					battle.screenBattleOn = battle.screenBattleOn;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(battle.getAttackOn() == true){
 | 
			
		||||
				if (c.keyStatus.get(Input.Keys.NUM_1)){
 | 
			
		||||
					battle.checkAnswer(1);
 | 
			
		||||
					battle.action(1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (c.keyStatus.get(Input.Keys.NUM_2)){
 | 
			
		||||
					battle.checkAnswer(2);
 | 
			
		||||
					battle.action(2);
 | 
			
		||||
				}
 | 
			
		||||
				else if (c.keyStatus.get(Input.Keys.NUM_3)){
 | 
			
		||||
					battle.checkAnswer(3);
 | 
			
		||||
					battle.action(3);
 | 
			
		||||
				}
 | 
			
		||||
				else if (c.keyStatus.get(Input.Keys.NUM_4)){
 | 
			
		||||
					battle.checkAnswer(4);
 | 
			
		||||
					battle.action(4);
 | 
			
		||||
					
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user