diff --git a/resources/font/Ubuntu-Medium.ttf b/resources/font/Ubuntu-Medium.ttf new file mode 100644 index 0000000..7340a40 Binary files /dev/null and b/resources/font/Ubuntu-Medium.ttf differ diff --git a/resources/font/Ubuntu-Regular.ttf b/resources/font/Ubuntu-Regular.ttf new file mode 100644 index 0000000..f98a2da Binary files /dev/null and b/resources/font/Ubuntu-Regular.ttf differ diff --git a/src/Game/Battle.java b/src/Game/Battle.java index 57a2231..915ffd2 100644 --- a/src/Game/Battle.java +++ b/src/Game/Battle.java @@ -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; } diff --git a/src/Screen/ScreenBattle.java b/src/Screen/ScreenBattle.java index f0bcf8d..f2691f7 100644 --- a/src/Screen/ScreenBattle.java +++ b/src/Screen/ScreenBattle.java @@ -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); } }