mirror of
https://github.com/Klagarge/PokeHES.git
synced 2024-11-26 19:13:27 +00:00
xp modification
This commit is contained in:
parent
b4a899bdcd
commit
744b160542
@ -6,15 +6,16 @@ public class Enemy extends Character{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Enemy(String name, int x, int y, String img, String map) {
|
public Enemy(String name, int x, int y, String img, String map, int pv) {
|
||||||
super(name, x, y, img, map);
|
super(name, x, y, img, map);
|
||||||
//generate his text
|
//generate his text
|
||||||
|
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
|
||||||
turn(Character.Direction.DOWN);
|
turn(Character.Direction.DOWN);
|
||||||
//generate the vector of fight
|
|
||||||
//FightData fightData = new FightData(name);
|
this.pv = pv;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,8 +29,8 @@ public class Enemy extends Character{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void removedPv(int pv) {
|
public void removedPv(int pv) {
|
||||||
// TODO Auto-generated method stub
|
this.pv -= pv;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import Screen.ScreenMap;
|
|||||||
|
|
||||||
public class Player extends Character{
|
public class Player extends Character{
|
||||||
|
|
||||||
private int xp;
|
private int xp = 0;
|
||||||
public Enemy lastEnemy = null;
|
public Enemy lastEnemy = null;
|
||||||
public boolean onEnemy = false;
|
public boolean onEnemy = false;
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ public class Player extends Character{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addXp(int xp){
|
public void addXp(int xp){
|
||||||
|
this.xp += xp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manageEntity(ScreenMap sm, Controller c) {
|
public void manageEntity(ScreenMap sm, Controller c) {
|
||||||
|
@ -6,24 +6,21 @@ import Entity.Enemy;
|
|||||||
import Text.TextEnemy;
|
import Text.TextEnemy;
|
||||||
|
|
||||||
public class Battle {
|
public class Battle {
|
||||||
|
|
||||||
|
|
||||||
TextEnemy textEnemy;
|
public TextEnemy textEnemy;
|
||||||
private int lineSpeech;
|
private int lineSpeech;
|
||||||
|
|
||||||
public int answer;
|
public int answer;
|
||||||
|
|
||||||
private int winPoint;
|
private int newXp;
|
||||||
|
|
||||||
public boolean screenBattleOn = true;
|
public boolean screenBattleOn = true;
|
||||||
|
|
||||||
|
public Battle(Enemy e){
|
||||||
public Battle(Enemy enemy){
|
|
||||||
textEnemy = new TextEnemy("enemi"); // should be enemy.name
|
textEnemy = new TextEnemy("enemi"); // should be enemy.name
|
||||||
textEnemy.generateText();
|
textEnemy.generateText();
|
||||||
|
|
||||||
lineSpeech = 0;
|
lineSpeech = 0;
|
||||||
winPoint = 0;
|
newXp = 0;
|
||||||
|
|
||||||
System.out.println("lll : "+ getLine());
|
System.out.println("lll : "+ getLine());
|
||||||
|
|
||||||
@ -46,7 +43,6 @@ public class Battle {
|
|||||||
|
|
||||||
//get number current answer random
|
//get number current answer random
|
||||||
int currentAnswer = textEnemy.getCurrentData().get(attack)[answer];
|
int currentAnswer = textEnemy.getCurrentData().get(attack)[answer];
|
||||||
System.out.println("current answer : " + currentAnswer);
|
|
||||||
|
|
||||||
//get the answer of the player
|
//get the answer of the player
|
||||||
String answerPlayer = textEnemy.fightData.getAttack(currentAttack).getAnswer(currentAnswer);
|
String answerPlayer = textEnemy.fightData.getAttack(currentAttack).getAnswer(currentAnswer);
|
||||||
@ -58,7 +54,9 @@ public class Battle {
|
|||||||
|
|
||||||
//check the choice of the player
|
//check the choice of the player
|
||||||
if(answerPlayer == trueAsnwer){
|
if(answerPlayer == trueAsnwer){
|
||||||
|
newXp += textEnemy.fightData.getAttack(currentAttack).getXp();
|
||||||
System.out.println("it's true !!!!");
|
System.out.println("it's true !!!!");
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
System.out.println("it's false !!!!");
|
System.out.println("it's false !!!!");
|
||||||
@ -89,6 +87,8 @@ public class Battle {
|
|||||||
public boolean getScreenBattleOn(){
|
public boolean getScreenBattleOn(){
|
||||||
return screenBattleOn;
|
return screenBattleOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNewXp(){
|
||||||
|
return newXp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ public class PokeMudry extends PortableApplication {
|
|||||||
|
|
||||||
// add player, create and add all enemies in entities
|
// add player, create and add all enemies in entities
|
||||||
entities.add((Entity) sp.p);
|
entities.add((Entity) sp.p);
|
||||||
enemies.add(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert"));
|
enemies.add(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 100));
|
||||||
enemies.add(new Enemy("Pignat", 5, 1, "lumberjack_sheet32", "test"));
|
enemies.add(new Enemy("Pignat", 5, 1, "lumberjack_sheet32", "test", 150));
|
||||||
for (Enemy enemy : enemies) { entities.add(enemy); }
|
for (Enemy enemy : enemies) { entities.add(enemy); }
|
||||||
|
|
||||||
//Init all entities
|
//Init all entities
|
||||||
@ -75,6 +75,8 @@ public class PokeMudry extends PortableApplication {
|
|||||||
if(!sp.b.getScreenBattleOn() && onBattleScreen){
|
if(!sp.b.getScreenBattleOn() && onBattleScreen){
|
||||||
sp.p.onEnemy = false;
|
sp.p.onEnemy = false;
|
||||||
sp.sm = sp.screenManager.getScreenMap();
|
sp.sm = sp.screenManager.getScreenMap();
|
||||||
|
sp.p.addXp(sp.b.getNewXp());
|
||||||
|
sp.e.removedPv(sp.b.getNewXp());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Graphics render
|
// Graphics render
|
||||||
|
@ -9,7 +9,7 @@ public class Attack {
|
|||||||
String answer4;
|
String answer4;
|
||||||
public String[] s;
|
public String[] s;
|
||||||
|
|
||||||
float xp;
|
private int xp;
|
||||||
|
|
||||||
Attack(String attack, String answer1,String answer2,String answer3, String answer4, float xp){
|
Attack(String attack, String answer1,String answer2,String answer3, String answer4, float xp){
|
||||||
this.attack = attack;
|
this.attack = attack;
|
||||||
@ -38,4 +38,8 @@ public class Attack {
|
|||||||
return answer1;
|
return answer1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getXp() {
|
||||||
|
return xp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user