1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2024-11-26 19:13:27 +00:00

xp modification

This commit is contained in:
Fastium 2022-06-14 12:51:47 +02:00
parent c1ed41fdbe
commit 26a8b0280b
4 changed files with 44 additions and 5 deletions

View File

@ -24,6 +24,10 @@ public class Player extends Character{
this.xp += xp; this.xp += xp;
} }
public int getXp(){
return xp;
}
public void manageEntity(ScreenMap sm, Controller c) { public void manageEntity(ScreenMap sm, Controller c) {
// Do nothing if hero is already moving // Do nothing if hero is already moving

View File

@ -13,6 +13,8 @@ public class Battle {
public int answer; public int answer;
private int newXp; private int newXp;
private int pvEnemy;
private int xpPlayer;
public boolean screenBattleOn = true; 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(){ public boolean finish(){
return false; return false;
} }
public boolean getAttackOn(){ public boolean getAttackOn(){
return textEnemy.lines.get(lineSpeech).attackOn; return textEnemy.lines.get(lineSpeech).attackOn;
} }
public String getLine(){ public String getLine(){
if(e==null) return null; if(e==null) return null;
return textEnemy.lines.get(lineSpeech).line; return textEnemy.lines.get(lineSpeech).line;
} }
//get the line for the dialog
public int getLineSpeech() { public int getLineSpeech() {
return lineSpeech; return lineSpeech;
} }
//return true if the screen is active
public boolean getScreenBattleOn(){ public boolean getScreenBattleOn(){
return screenBattleOn; return screenBattleOn;
} }
//get the total xp win in the battle
public int getNewXp(){ public int getNewXp(){
return newXp; return newXp;
} }
public void setPvEnemy(int pv){
pvEnemy = pv;
}
public void setXpPlayer(int xp){
xpPlayer = xp;
}
//set enemy
public void setEnemy(Enemy e){ public void setEnemy(Enemy e){
this.e = e; this.e = e;
} }

View File

@ -73,6 +73,12 @@ public class PokeMudry extends PortableApplication {
if(onBattleScreen) sp.sb.manage(controller, sp.b); 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){ if(!sp.b.getScreenBattleOn() && onBattleScreen){
sp.p.onEnemy = false; sp.p.onEnemy = false;

View File

@ -101,9 +101,15 @@ public class ScreenBattle extends RenderingScreen{
if( battle.getAttackOn() == false){ if( battle.getAttackOn() == false){
if (c.keyStatus.get(Input.Keys.SPACE)){ if (c.keyStatus.get(Input.Keys.SPACE)){
if(battle.getLineSpeech() <= 5){
battle.screenBattleOn = battle.finish();
}
else{
System.out.println("in"); System.out.println("in");
battle.readNextLine(); battle.readNextLine();
} }
}
if (c.keyStatus.get(Input.Keys.ENTER)){ if (c.keyStatus.get(Input.Keys.ENTER)){
battle.screenBattleOn = battle.finish(); battle.screenBattleOn = battle.finish();
} }