mirror of
https://github.com/Klagarge/PokeHES.git
synced 2024-11-26 19:13:27 +00:00
commit
c1ed41fdbe
@ -1,7 +1,7 @@
|
||||
attaque1,contre-attaque 1,contre-attaque 2,contre-attaque 3,contre-attaque 4,1
|
||||
attaque2,contre-attaque 1,contre-attaque 2,contre-attaque 3,contre-attaque 4,10
|
||||
attaque3,contre-attaque 1,contre-attaque 2,contre-attaque 3,contre-attaque 4,3
|
||||
attaque4,contre-attaque 1,contre-attaque 2,contre-attaque 3,contre-attaque 4,45
|
||||
attaque5,contre-attaque 1,contre-attaque 2,contre-attaque 3,contre-attaque 4,4
|
||||
attaque6,contre-attaque 1,contre-attaque 2,contre-attaque 3,contre-attaque 4,6
|
||||
attaque7,contre-attaque 1,contre-attaque 2,contre-attaque 3,contre-attaque 4,3
|
||||
attaque1;contre-attaque 1;contre-attaque 2;contre-attaque 3;contre-attaque 4;1
|
||||
attaque2;contre-attaque 1;contre-attaque 2;contre-attaque 3;contre-attaque 4;10
|
||||
attaque3;contre-attaque 1;contre-attaque 2;contre-attaque 3;contre-attaque 4;3
|
||||
attaque4;contre-attaque 1;contre-attaque 2;contre-attaque 3;contre-attaque 4;45
|
||||
attaque5;contre-attaque 1;contre-attaque 2;contre-attaque 3;contre-attaque 4;4
|
||||
attaque6;contre-attaque 1;contre-attaque 2;contre-attaque 3;contre-attaque 4;6
|
||||
attaque7;contre-attaque 1;contre-attaque 2;contre-attaque 3;contre-attaque 4;3
|
||||
|
|
@ -1,5 +1,5 @@
|
||||
Convertir 0b01010111 en décimal :;87;79;afg;83;25
|
||||
Convertir 0b11110011 en héxadécimal :;F3;Q8;35;12;25
|
||||
Quel est la valeur de 'a' en ASCII en décimal ?;97;0;42;2;25
|
||||
Quel mot est utile à une fonction qui retourne rien ?;void;break;Integer;false;25
|
||||
Convertir 0b01010111 en décimal :;87;79;afg;83;25
|
||||
Convertir 0b11110011 en héxadécimal :;F3;Q8;35;12;25
|
||||
Quel est la valeur de 'a' en ASCII en décimal ?;97;0;42;2;25
|
||||
Quel mot est utile à une fonction qui retourne rien ?;void;break;Integer;false;25
|
||||
Comment convertir un string en int ?;int a = Integer.parseInt(String s);int a = String s;Je sais pas;int a = String.changeInt(String s);25
|
||||
|
|
7
resources/Battle/Speech/mudry.txt
Normal file
7
resources/Battle/Speech/mudry.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Un mudry sauvage se balade dans les salles de classe. Il va te tester pour savoir si tu a traviallé cette année
|
||||
Une question pour commencer :
|
||||
Encore une autre :
|
||||
Est ce que tu est vraiment chaud pour
|
||||
Vas-y...quoi !
|
||||
Tu m'as vaincu. Moi le Mudry tout puissant !
|
||||
Pas fortiche mon gars !
|
@ -4,17 +4,22 @@ import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
public class Enemy extends Character{
|
||||
|
||||
private String branch;
|
||||
|
||||
|
||||
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, String branch) {
|
||||
super(name, x, y, img, map);
|
||||
//generate his text
|
||||
|
||||
this.map = map;
|
||||
|
||||
turn(Character.Direction.DOWN);
|
||||
//generate the vector of fight
|
||||
//FightData fightData = new FightData(name);
|
||||
|
||||
this.branch = branch;
|
||||
|
||||
this.pv = pv;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -28,9 +33,13 @@ public class Enemy extends Character{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removedPv(int pv) {
|
||||
// TODO Auto-generated method stub
|
||||
public void removedPv(int pv) {
|
||||
this.pv -= pv;
|
||||
|
||||
}
|
||||
|
||||
public String getBranch(){
|
||||
return branch;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import Screen.ScreenMap;
|
||||
|
||||
public class Player extends Character{
|
||||
|
||||
private int xp;
|
||||
private int xp = 0;
|
||||
public Enemy lastEnemy = null;
|
||||
public boolean onEnemy = false;
|
||||
|
||||
@ -21,7 +21,7 @@ public class Player extends Character{
|
||||
}
|
||||
|
||||
public void addXp(int xp){
|
||||
|
||||
this.xp += xp;
|
||||
}
|
||||
|
||||
public void manageEntity(ScreenMap sm, Controller c) {
|
||||
|
@ -7,23 +7,23 @@ import Text.TextEnemy;
|
||||
|
||||
public class Battle {
|
||||
|
||||
|
||||
TextEnemy textEnemy;
|
||||
private Enemy e;
|
||||
public TextEnemy textEnemy;
|
||||
private int lineSpeech;
|
||||
|
||||
public int answer;
|
||||
|
||||
private int winPoint;
|
||||
private int newXp;
|
||||
|
||||
public boolean screenBattleOn = true;
|
||||
|
||||
|
||||
public Battle(Enemy enemy){
|
||||
textEnemy = new TextEnemy("enemi"); // should be enemy.name
|
||||
public Battle(Enemy e){
|
||||
if(e != null){
|
||||
textEnemy = new TextEnemy(e);
|
||||
textEnemy.generateText();
|
||||
}
|
||||
|
||||
lineSpeech = 0;
|
||||
winPoint = 0;
|
||||
newXp = 0;
|
||||
|
||||
System.out.println("lll : "+ getLine());
|
||||
|
||||
@ -46,7 +46,6 @@ public class Battle {
|
||||
|
||||
//get number current answer random
|
||||
int currentAnswer = textEnemy.getCurrentData().get(attack)[answer];
|
||||
System.out.println("current answer : " + currentAnswer);
|
||||
|
||||
//get the answer of the player
|
||||
String answerPlayer = textEnemy.fightData.getAttack(currentAttack).getAnswer(currentAnswer);
|
||||
@ -58,7 +57,9 @@ public class Battle {
|
||||
|
||||
//check the choice of the player
|
||||
if(answerPlayer == trueAsnwer){
|
||||
newXp += textEnemy.fightData.getAttack(currentAttack).getXp();
|
||||
System.out.println("it's true !!!!");
|
||||
|
||||
}
|
||||
else{
|
||||
System.out.println("it's false !!!!");
|
||||
@ -78,7 +79,10 @@ public class Battle {
|
||||
}
|
||||
|
||||
public String getLine(){
|
||||
if(e==null) return null;
|
||||
|
||||
return textEnemy.lines.get(lineSpeech).line;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -90,5 +94,11 @@ public class Battle {
|
||||
return screenBattleOn;
|
||||
}
|
||||
|
||||
|
||||
public int getNewXp(){
|
||||
return newXp;
|
||||
}
|
||||
|
||||
public void setEnemy(Enemy e){
|
||||
this.e = e;
|
||||
}
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ public class PokeMudry extends PortableApplication {
|
||||
|
||||
// add player, create and add all enemies in entities
|
||||
entities.add((Entity) sp.p);
|
||||
enemies.add(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert"));
|
||||
enemies.add(new Enemy("Pignat", 5, 1, "lumberjack_sheet32", "test"));
|
||||
enemies.add(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique"));
|
||||
//enemies.add(new Enemy("Pignat", 5, 1, "lumberjack_sheet32", "test", 150));
|
||||
for (Enemy enemy : enemies) { entities.add(enemy); }
|
||||
|
||||
//Init all entities
|
||||
@ -65,6 +65,8 @@ public class PokeMudry extends PortableApplication {
|
||||
if (sp.p.onEnemy && onMapScreen){
|
||||
sp.e = sp.p.lastEnemy;
|
||||
sp.sb = sp.screenManager.getScreenBattle();
|
||||
if(sp.e == null) System.out.println("sdfsdfsdfsdf");
|
||||
|
||||
sp.b = new Battle(sp.e);
|
||||
g.resetCamera();
|
||||
}
|
||||
@ -75,6 +77,8 @@ public class PokeMudry extends PortableApplication {
|
||||
if(!sp.b.getScreenBattleOn() && onBattleScreen){
|
||||
sp.p.onEnemy = false;
|
||||
sp.sm = sp.screenManager.getScreenMap();
|
||||
sp.p.addXp(sp.b.getNewXp());
|
||||
sp.e.removedPv(sp.b.getNewXp());
|
||||
}
|
||||
|
||||
// Graphics render
|
||||
|
@ -75,7 +75,9 @@ public class ScreenBattle extends RenderingScreen{
|
||||
g.drawFilledRectangle(Settings.SIDE/2, HEIGHT_DIALOG/2 + EDGE, WIDTH_DIALOG, HEIGHT_DIALOG, 0);
|
||||
|
||||
//dialog
|
||||
if(b != null) g.drawString(15, 245 ,b.getLine() , optimus40);
|
||||
if(b == null) return;
|
||||
if(b.getLine() == null) return;
|
||||
g.drawString(15, 245 ,b.getLine() , optimus40);
|
||||
|
||||
|
||||
|
||||
|
@ -16,10 +16,10 @@ public class ScreenPlayer {
|
||||
public void init(){
|
||||
|
||||
// One player by ScreenPlayer
|
||||
//p = new Player(8, 15, "desert");
|
||||
p = new Player(4, 2, "21RI");
|
||||
p = new Player(8, 15, "desert");
|
||||
//p = new Player(4, 2, "21RI");
|
||||
|
||||
b = new Battle(e);
|
||||
b = new Battle(new Enemy("enemi", 0, 0, "charachter", "desert", 50, "enemi"));
|
||||
|
||||
// Create both type of screen and record for reuse
|
||||
screenManager.registerScreen(ScreenMap.class);
|
||||
@ -36,6 +36,7 @@ public class ScreenPlayer {
|
||||
|
||||
if(sb != null){
|
||||
sb.setBattle(b);
|
||||
b.setEnemy(e);
|
||||
}
|
||||
|
||||
screenManager.render(g);
|
||||
|
@ -9,9 +9,9 @@ public class Attack {
|
||||
String answer4;
|
||||
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, int xp){
|
||||
this.attack = attack;
|
||||
this.answer1 = answer1;
|
||||
this.answer2 = answer2;
|
||||
@ -38,4 +38,8 @@ public class Attack {
|
||||
return answer1;
|
||||
}
|
||||
|
||||
public int getXp() {
|
||||
return xp;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,14 +9,14 @@ public class FightData {
|
||||
|
||||
private Vector<Attack> attacks = new Vector<Attack>();
|
||||
private File file;
|
||||
private static final String REGEX = ",";
|
||||
private static String regex = ";";
|
||||
|
||||
|
||||
|
||||
public int nbre_line =0;
|
||||
|
||||
public FightData(String name) {
|
||||
file = new File("./resources/Battle/Fight/" + name + ".csv");
|
||||
public FightData(String branch) {
|
||||
file = new File("./resources/Battle/Fight/" + branch + ".csv");
|
||||
|
||||
}
|
||||
|
||||
@ -30,9 +30,11 @@ public class FightData {
|
||||
|
||||
//add the line in the vector attacks of attack
|
||||
line = bf.readLine();
|
||||
System.out.println(line);
|
||||
while(line != null){
|
||||
String[] a = line.split(REGEX);//change the regex if it is another
|
||||
attack = new Attack(a[0], a[1], a[2], a[3], a[4], Float.valueOf(a[5]));
|
||||
String[] a = line.split(regex);//change the regex if it is another
|
||||
System.out.println(a.length);
|
||||
attack = new Attack(a[0], a[1], a[2], a[3], a[4], Integer.valueOf(a[5]));
|
||||
attacks.add(attack);
|
||||
line = bf.readLine();
|
||||
//add line
|
||||
|
@ -1,6 +1,9 @@
|
||||
package Text;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import Entity.Enemy;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
@ -17,24 +20,22 @@ public class TextEnemy {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
TextEnemy t = new TextEnemy("enemi");
|
||||
TextEnemy t = new TextEnemy(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique"));
|
||||
|
||||
t.generateText();
|
||||
|
||||
for(Line l : t.lines) {
|
||||
System.out.println(l.line);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public TextEnemy(String name){
|
||||
public TextEnemy(Enemy e){
|
||||
//generate the vector of fight
|
||||
fightData = new FightData(name);
|
||||
fightData = new FightData(e.getBranch());
|
||||
fightData.readFile();
|
||||
|
||||
//generate the vector of Speechs
|
||||
speechData = new SpeechData(name);
|
||||
speechData = new SpeechData(e.getName());
|
||||
speechData.readFile();
|
||||
|
||||
//save random data (attack and ansver) : attack, answer 1, answer 2 answer 3, answer 4
|
||||
@ -98,7 +99,7 @@ public class TextEnemy {
|
||||
|
||||
//attack and answer (number on vector : 1-4)
|
||||
lines.add(new Line(
|
||||
speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ? ("+fightData.getAttack(orderAttack[j]).xp+ ") " + "\n" +
|
||||
speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + " ? ("+fightData.getAttack(orderAttack[j]).getXp()+ ") " + "\n" +
|
||||
"1. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) + "\n" +
|
||||
"2. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) + "\n" +
|
||||
"3. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) + "\n" +
|
||||
|
Loading…
Reference in New Issue
Block a user