diff --git a/src/Entity/Player.java b/src/Entity/Player.java index 77ae101..8a30034 100644 --- a/src/Entity/Player.java +++ b/src/Entity/Player.java @@ -24,6 +24,10 @@ public class Player extends Character{ this.xp += xp; } + public int getXp(){ + return xp; + } + public void manageEntity(ScreenMap sm, Controller c) { // Do nothing if hero is already moving diff --git a/src/Game/Battle.java b/src/Game/Battle.java index 2cde061..06d5146 100644 --- a/src/Game/Battle.java +++ b/src/Game/Battle.java @@ -13,6 +13,8 @@ public class Battle { public int answer; private int newXp; + private int pvEnemy; + private int xpPlayer; public boolean screenBattleOn = true; @@ -69,35 +71,56 @@ public class Battle { } + public void FinishSpeech(int pvEnemy){ + if(pvEnemy>0){ + //alive + readNextLine(); + } + else{ + //dead + } + } + + public boolean finish(){ return false; } + public boolean getAttackOn(){ return textEnemy.lines.get(lineSpeech).attackOn; } public String getLine(){ if(e==null) return null; - return textEnemy.lines.get(lineSpeech).line; - } - + //get the line for the dialog public int getLineSpeech() { return lineSpeech; } + //return true if the screen is active public boolean getScreenBattleOn(){ return screenBattleOn; } + //get the total xp win in the battle public int getNewXp(){ return newXp; } + public void setPvEnemy(int pv){ + pvEnemy = pv; + } + + public void setXpPlayer(int xp){ + xpPlayer = xp; + } + + //set enemy public void setEnemy(Enemy e){ this.e = e; } diff --git a/src/Main/PokeMudry.java b/src/Main/PokeMudry.java index 1b4d60f..94e05b0 100644 --- a/src/Main/PokeMudry.java +++ b/src/Main/PokeMudry.java @@ -73,6 +73,12 @@ public class PokeMudry extends PortableApplication { if(onBattleScreen) sp.sb.manage(controller, sp.b); + //manage battle + if(!sp.b.getScreenBattleOn()){ + sp.b.setPvEnemy(sp.e.getPv()); + sp.b.setXpPlayer(sp.p.getXp()); + } + if(!sp.b.getScreenBattleOn() && onBattleScreen){ sp.p.onEnemy = false; diff --git a/src/Screen/ScreenBattle.java b/src/Screen/ScreenBattle.java index 2d638d9..b9a319b 100644 --- a/src/Screen/ScreenBattle.java +++ b/src/Screen/ScreenBattle.java @@ -101,8 +101,14 @@ public class ScreenBattle extends RenderingScreen{ if( battle.getAttackOn() == false){ if (c.keyStatus.get(Input.Keys.SPACE)){ - System.out.println("in"); - battle.readNextLine(); + if(battle.getLineSpeech() <= 5){ + battle.screenBattleOn = battle.finish(); + } + else{ + System.out.println("in"); + battle.readNextLine(); + } + } if (c.keyStatus.get(Input.Keys.ENTER)){ battle.screenBattleOn = battle.finish();