Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
9aee02f16c |
@ -1,23 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="/home/nicolas/eclipse-workspace/Projet_Java/JAVA/PROJET-PMT_STRI1A/src/jdbc.jar">
|
||||
<classpathentry exported="true" kind="lib" path="/home/nicolas/Bureau/jdbc-support-1.0.23-sources.jar">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/nicolas/eclipse-workspace/Projet_Java/JAVA/PROJET-PMT_STRI1A/src/gson-2.6.2.jar">
|
||||
<classpathentry exported="true" kind="lib" path="/home/nicolas/Téléchargements/gson-2.8.5.jar">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/nicolas/eclipse-workspace/Projet_Java/JAVA/PROJET-PMT_STRI1A/src/javatuples-1.2.jar"/>
|
||||
<classpathentry kind="lib" path="/home/nicolas/Téléchargements/swt-linux-gtk-x64.jar/swt-linux-gtk-x64.jar"/>
|
||||
<classpathentry kind="lib" path="swing2swt.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -1,12 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 939 KiB |
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="src" path=""/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>src</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
Binary file not shown.
@ -1,33 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package gui;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridBagLayout;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
* @author nicolas
|
||||
*
|
||||
*/
|
||||
public class Background extends JPanel{
|
||||
private ImageIcon image;
|
||||
public Background(String path) {
|
||||
super();
|
||||
//this.setLayout(new FlowLayout());
|
||||
this.image=new ImageIcon(path);
|
||||
}
|
||||
public void setBackground(ImageIcon back) {
|
||||
this.image=back;
|
||||
}
|
||||
public void paintComponent(Graphics gr) {
|
||||
super.paintComponent(gr);
|
||||
gr.drawImage(image.getImage(),0,0,this);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
* @author nicolas
|
||||
*
|
||||
*/
|
||||
public class Boutton extends JButton {
|
||||
public Boutton(String txt) {
|
||||
super(txt);
|
||||
//this.setLayout(new FlowLayout());
|
||||
setForeground(Color.WHITE);
|
||||
setOpaque(true);
|
||||
setContentAreaFilled(false);
|
||||
setBorderPainted(true);
|
||||
setFocusPainted(false);
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
setVerticalAlignment(SwingConstants.CENTER);
|
||||
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package gui;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import modeles.Labyrinthe;
|
||||
import modeles.Menu;
|
||||
import modeles.Salle;
|
||||
|
||||
/**
|
||||
* @author nicolas
|
||||
*
|
||||
*/
|
||||
public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
public int nb;
|
||||
public Menu menu;
|
||||
public Labyrinthe lab = null;
|
||||
public JeuSalle() {
|
||||
setTitle("Labyrinthe");
|
||||
setSize(1200,600);
|
||||
setLocationRelativeTo(null);
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
this.setVisible(true);
|
||||
|
||||
|
||||
}
|
||||
/*Méthode permettant d'écrire du texte dans la fenetre de jeu*/
|
||||
public JPanel ecrire(String str) {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new FlowLayout());
|
||||
JLabel label = new JLabel(str);
|
||||
panel.add(label);
|
||||
this.setFocusable(true);
|
||||
this.setContentPane(panel);
|
||||
this.addKeyListener(this);
|
||||
this.requestFocus();
|
||||
this.setVisible(true);
|
||||
return panel;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
|
||||
*/
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
|
||||
*/
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
|
||||
Entrer du clavier
|
||||
*/
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
nb = e.getKeyChar();
|
||||
System.out.println(nb);
|
||||
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*Méthode qui récupère les entrés de type int du clavier*/
|
||||
public int toucheint() {
|
||||
System.out.println("sortie"+nb);
|
||||
return nb;
|
||||
}
|
||||
/*Méthode que permet de cacher un texte affiché dans la fenetre*/
|
||||
public void cacher(JPanel panel) {
|
||||
panel.setVisible(false);
|
||||
}
|
||||
/**
|
||||
* @return the lab
|
||||
*/
|
||||
public Labyrinthe getLab() {
|
||||
return lab;
|
||||
}
|
||||
/**
|
||||
* @param lab the lab to set
|
||||
*/
|
||||
public void setLab(Labyrinthe lab) {
|
||||
this.lab = lab;
|
||||
}
|
||||
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package gui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
|
||||
import gui.Boutton;
|
||||
import modeles.Labyrinthe;
|
||||
import modeles.Marche;
|
||||
import modeles.Menu;
|
||||
import modeles.Objet;
|
||||
import modeles.Personnage;
|
||||
import gui.Background;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.attribute.AclEntry.Builder;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
||||
/**
|
||||
* @author nicolas
|
||||
*
|
||||
*/
|
||||
public class jeu extends JFrame implements ActionListener {
|
||||
JButton continuer =new JButton("Continuer");
|
||||
JButton nouvelle = new JButton("Nouvelle Partie");
|
||||
|
||||
public JPanel panel;
|
||||
|
||||
public Menu menu;
|
||||
|
||||
public jeu() throws IOException {
|
||||
super();
|
||||
build();
|
||||
this.menu=new Menu();
|
||||
}
|
||||
|
||||
public void build() throws IOException{
|
||||
setTitle("Jeu");
|
||||
setSize(593,283);
|
||||
setLocationRelativeTo(null);
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
//Création du JLabel pour l'image
|
||||
JLabel container = new JLabel(new ImageIcon(this.image()));
|
||||
|
||||
//Création du layout des boutons
|
||||
container.setLayout(new GridBagLayout());
|
||||
|
||||
|
||||
nouvelle.addActionListener(this);
|
||||
continuer.addActionListener(this);
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
container.add(nouvelle);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy=0;
|
||||
container.add(continuer);
|
||||
|
||||
this.setContentPane(container);
|
||||
this.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
public BufferedImage image() throws IOException {
|
||||
BufferedImage image = ImageIO.read(new File("/home/nicolas/eclipse-workspace/Projet_Java/JAVA/PROJET-PMT_STRI1A/test.jpg"));
|
||||
return image;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
Récupération des évènements des boutons Nouvelle Partie et Contnuer
|
||||
*/
|
||||
@Override
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
Object source=arg0.getSource();
|
||||
choix(source);
|
||||
|
||||
|
||||
}
|
||||
/*Méthode de traitement des actions sur les boutons*/
|
||||
public void choix(Object source) {
|
||||
|
||||
if(source==nouvelle) {
|
||||
System.out.println("1");
|
||||
|
||||
//menu =new Menu();
|
||||
//Création du Labyrinthe
|
||||
Labyrinthe lab =new Labyrinthe();
|
||||
|
||||
//
|
||||
this.menu.getJs().setLab(lab);
|
||||
//Appel de la méthode menuSelection()
|
||||
this.menu.menuSelection(this.menu.getJs().getLab());
|
||||
}
|
||||
if(source==continuer) {
|
||||
System.out.println("2");
|
||||
//menu = new Menu();
|
||||
//recupMenu(menu);
|
||||
//lab = menu.continuer();
|
||||
//return lab;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Menu getMenu() {
|
||||
return menu;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package gui;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import modeles.Labyrinthe;
|
||||
import modeles.Menu;
|
||||
|
||||
/**
|
||||
* @author nicolas
|
||||
*
|
||||
*/
|
||||
public class main {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public jeu fenetre;
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
public void run(){
|
||||
//On crée une nouvelle instance de notre JDialog
|
||||
jeu fenetre = null;
|
||||
|
||||
try {
|
||||
|
||||
fenetre = new jeu();
|
||||
//Menu menu =fenetre.glob;
|
||||
/*if(fenetre.menu.getJs().getLab()!=null) {
|
||||
System.out.println("passer");
|
||||
fenetre.menu.menuSelection(fenetre.menu.getJs().getLab());
|
||||
//Menu menu =fenetre.creersalle();
|
||||
}*/
|
||||
|
||||
//fenetre.salle.ecrire(fenetre.menu.textePerso(fenetre.lab));
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
fenetre.setVisible(true);//On la rend visible
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.class
Executable file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.class
Executable file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.class
Executable file
Binary file not shown.
@ -5,17 +5,9 @@ public class Bourse extends Objet {
|
||||
|
||||
public Bourse(int somme) {
|
||||
super("bourse",somme,99999999);
|
||||
this.valeur=valeur;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param valeur the valeur to set
|
||||
*/
|
||||
public void setValeur(int valeur) {
|
||||
this.valeur = valeur;
|
||||
}
|
||||
|
||||
public int getValeur() {
|
||||
return this.valeur;
|
||||
}
|
||||
@ -24,12 +16,12 @@ public class Bourse extends Objet {
|
||||
return "Bourse";
|
||||
}
|
||||
|
||||
public int Achat(Objet o) { //commande pour v<EFBFBD>rifier si la personne peut acheter un objet et pour faire le d<EFBFBD>compte de la thunasse
|
||||
if (o.getPrix() <= this.valeur) return (this.valeur=this.valeur-o.getPrix());
|
||||
public int Achat(int cout) { //commande pour vérifier si la personne peut acheter un objet et pour faire le décompte de la thunasse
|
||||
if (cout <= this.valeur) return (this.valeur=this.valeur-cout);
|
||||
else {
|
||||
int manque =o.getPrix()-this.valeur;
|
||||
int manque = cout-this.valeur;
|
||||
System.out.println("L'achat est impossible, il vous manque : "+manque);
|
||||
return -1;
|
||||
return manque;
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Clavier.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Clavier.class
Executable file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.class
Executable file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Generateur.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Generateur.class
Executable file
Binary file not shown.
@ -17,7 +17,9 @@ public class Generateur {
|
||||
public Labyrinthe labyrinthe() {
|
||||
BufferedReader bfr= null;
|
||||
try {
|
||||
bfr = new BufferedReader(new FileReader("C:\\Users\\Nicolas\\eclipse-workspace\\Projet_Java\\JAVA\\PROJET-PMT_STRI1A\\src\\json\\lab.json"));
|
||||
bfr = new BufferedReader(new FileReader("/home/nicolas/eclipse-workspace/Projet_Java/JAVA/PROJET-PMT_STRI1A/src/json/lab.json" +
|
||||
"" +
|
||||
""));
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@ -34,7 +36,8 @@ public class Generateur {
|
||||
String str = gson.toJson(lab);
|
||||
System.out.println(str);
|
||||
try {
|
||||
File file = new File("C:\\Users\\Nicolas\\eclipse-workspace\\Projet_Java\\JAVA\\PROJET-PMT_STRI1A\\src\\json\\lab.json");
|
||||
File file = new File("/home/nicolas/eclipse-workspace/Projet_Java/JAVA/PROJET-PMT_STRI1A/src/json\n" +
|
||||
"" + "lab.json");
|
||||
|
||||
file.createNewFile();
|
||||
FileWriter writer = new FileWriter(file);
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Labyrinthe.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Labyrinthe.class
Executable file
Binary file not shown.
@ -9,19 +9,18 @@ public class Labyrinthe {
|
||||
protected List<Personnage> listePersonnage=new ArrayList<Personnage>();
|
||||
protected List<Arme> listeArme= new ArrayList<Arme>();
|
||||
protected List<Armure> listeArmure=new ArrayList<Armure>();
|
||||
public List<Porte> listePorte=new ArrayList<Porte>();
|
||||
protected List<Porte> listePorte=new ArrayList<Porte>();
|
||||
protected List<Monstre> listeMonstre=new ArrayList<Monstre>();
|
||||
|
||||
public Labyrinthe() {
|
||||
public Labyrinthe Labyrinthe() {
|
||||
/*switch (nInstance)
|
||||
case 1 :
|
||||
return Labyrinthe1();
|
||||
break;
|
||||
}*/
|
||||
|
||||
labyrinthe1();
|
||||
return labyrinthe1();
|
||||
}
|
||||
public void labyrinthe1() {
|
||||
public Labyrinthe labyrinthe1() {
|
||||
Arme arme=new Arme("Epee en bois",5,10,2);
|
||||
listeArme.add(arme);
|
||||
Arme arme1=new Arme("Epee en acier",15,10,4);
|
||||
@ -44,7 +43,7 @@ public class Labyrinthe {
|
||||
|
||||
Personnage perso=new Personnage("Aramis",10,1);
|
||||
listePersonnage.add(perso);
|
||||
Personnage perso2=new Personnage("Boromis",100,50);
|
||||
Personnage perso2=new Personnage("Boromis",8,2);
|
||||
listePersonnage.add(perso2);
|
||||
|
||||
Monstre mons = new Monstre("pantin en bois",5, 1);
|
||||
@ -108,7 +107,8 @@ public class Labyrinthe {
|
||||
Porte po6= new Porte(true,salle5,salle3);
|
||||
listePorte.add(po6);
|
||||
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.class
Executable file
Binary file not shown.
@ -11,27 +11,12 @@ import java.util.List;
|
||||
*
|
||||
*/
|
||||
public class Marche extends Salle {
|
||||
private List<Integer> listeObjet=new ArrayList<Integer>();
|
||||
public Marche(List<Integer> listeEnnemie) {
|
||||
super(0,0, false, listeEnnemie);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public String creerObjetsAVendre(Labyrinthe lab) {
|
||||
String listeSarme="";
|
||||
String listeSarmure="";
|
||||
String listeobjet="<html>";
|
||||
int i = 0;
|
||||
int j =0;
|
||||
|
||||
|
||||
for (Arme arme : lab.listeArme) listeSarme += "<br>" + i++ +") "+ arme.getNom() + " au prix de : " + arme.getPrix()+"</br>";
|
||||
|
||||
for (Armure armure : lab.listeArmure) listeSarmure += "<br>"+ j++ +") "+ armure.getNom()+ " au prix de : " + armure.getPrix()+"</br>";
|
||||
|
||||
|
||||
listeobjet ="<html>" + "Armes :\n" + listeSarme +"<br></br>"+ "\nArmures :\n" + listeSarmure;
|
||||
listeobjet=listeobjet+"</html>";
|
||||
return listeobjet;
|
||||
}
|
||||
|
||||
//methode pour enregistrer la liste objet (il faudra sans doute changer le type de listeObjet) settingListeObjet(Labyrinthe lab)
|
||||
}
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Menu.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Menu.class
Executable file
Binary file not shown.
@ -1,77 +1,66 @@
|
||||
package modeles;
|
||||
import gui.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Random;
|
||||
import java.awt.*;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class Menu {
|
||||
|
||||
private JeuSalle js= new JeuSalle();
|
||||
/**
|
||||
* @return the js
|
||||
*/
|
||||
|
||||
public String menuCombat(Monstre mons, Personnage perso, Labyrinthe lab) throws IOException {
|
||||
public String menuCombat(Monstre mons, Personnage perso, Labyrinthe lab) {
|
||||
int degat;
|
||||
int reponse = 0;
|
||||
|
||||
js.ecrire("Un monstre du nom de "+mons.getNom()+" se présente devant vous et il est trés en colère :");
|
||||
System.out.println("Un monstre du nom de "+mons.getNom()+" se pr<70>sente devant vous et il est tr<74>s en col<6F>re :");
|
||||
while (true){
|
||||
System.out.println("\t - 1 attaquer\n\t - 2 Potion \n\t- 3 Fuir");
|
||||
try{
|
||||
reponse=Clavier.entrerClavierInt();
|
||||
}catch (Exception e) {
|
||||
System.in.read();
|
||||
}
|
||||
System.out.println("\t - 1<> attaquer\n\t - 2<> Potion \n\t- 3<> Fuir");
|
||||
reponse=Clavier.entrerClavierInt();
|
||||
switch (reponse) {
|
||||
case 1:
|
||||
degat = perso.attaquer(mons);
|
||||
System.out.println("Vous avez infligé "+degat+" à votre adversaire.");
|
||||
System.out.println("Vous avez inflig<69> "+degat+" <20> votre adversaire.");
|
||||
if (!mons.isVivant()) {
|
||||
perso.salle.cle(lab);
|
||||
System.out.println(perso.remplirBourse());
|
||||
return "Votre ennemie trépasse et vous obtenez la clé des portes de la salle.";
|
||||
perso.getSalle().cle(lab);
|
||||
System.out.println(perso.obtenirBourse());
|
||||
return "Votre ennemie tr<EFBFBD>passe et vous obtenez la cl<63> des portes de la salle.";
|
||||
} else {
|
||||
System.out.println("Au tour de votre adversaire. Il attaque préparez vous ! ");
|
||||
System.out.println("Au tour de votre adversaire. Il attaque pr<EFBFBD>parez vous ! ");
|
||||
System.out.println("il vous inflige "+ mons.attaquer(perso)+".");
|
||||
if (!perso.isVivant()) {
|
||||
return "C'est ainsi que vous trépassez sous les coups des ténèbres. Reposez vous héros... Vous avez l'<27>ternit<69>.";
|
||||
return "C'est ainsi que vous tr<EFBFBD>passez sous les coups des t<>n<EFBFBD>bres. Reposez vous h<>ros... Vous avez l'<27>ternit<69>.";
|
||||
}
|
||||
else System.out.println("votre ennemie n'est pas encore à bout achever le !");
|
||||
else System.out.println("votre ennemie n'est pas encore <EFBFBD> bout achever le !");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2 :
|
||||
if (!perso.getPotion().isEmpty()) {
|
||||
perso.utiliser(perso.getPotion().remove(0));
|
||||
System.out.println("Vous avez utilisé une potion. Votre vie est maintenant au maximum.");
|
||||
System.out.println("Vous avez utilis<EFBFBD> une potion. Votre vie est maintenant au maximum.");
|
||||
} else {
|
||||
System.out.println("Il ne vous reste plus de potion. Désolé.");
|
||||
System.out.println("Il ne vous reste plus de potion. D<EFBFBD>sol<EFBFBD>.");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3 :
|
||||
System.out.println("Vous tentez de fuir.");
|
||||
Random rd = new Random();
|
||||
if (rd.nextInt(100)<50) {
|
||||
return "Vous avez fuit.";
|
||||
} else {
|
||||
System.out.println("Ce fut un échec !");
|
||||
System.out.println("Ce fut un <EFBFBD>chec !");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Labyrinthe menuStartGame() {
|
||||
js.ecrire("L'Aventure vous appelle ! Le choix s'offre à vous, une histoire peut s'écrire une autre peut continuer :\n1) Nouvelle Partie\n2) Continuer votre progression");
|
||||
|
||||
System.out.println("L'Aventure vous appelle ! Le choix s'offre <20> vous, une histoire peut s'<27>crire une autre peut continuer :\n1) Nouvelle Partie\n2) Continuer votre progression");
|
||||
switch(Clavier.entrerClavierInt()) {
|
||||
case 1:
|
||||
System.out.println("Labyrinthe cree !");
|
||||
return new Labyrinthe();
|
||||
|
||||
case 2:
|
||||
Generateur ge = new Generateur();
|
||||
System.out.println("Labyrinthe chargée !");
|
||||
return ge.labyrinthe();
|
||||
default :
|
||||
return null;
|
||||
@ -79,102 +68,21 @@ public class Menu {
|
||||
}
|
||||
|
||||
public Personnage menuSelection(Labyrinthe lab) {
|
||||
JPanel panel =js.ecrire("Bonjour Etranger, je suis le narrateur de votre histoire. Comment dois-je vous appeler ? ");
|
||||
js.cacher(panel);
|
||||
int i = 0;
|
||||
for (Personnage per : lab.listePersonnage) {
|
||||
js.ecrire(i++ + ") "+per.getNom());
|
||||
}
|
||||
|
||||
Personnage pers;
|
||||
try{
|
||||
pers =lab.listePersonnage.get(js.toucheint());
|
||||
|
||||
}
|
||||
catch(Exception e) {
|
||||
js.ecrire("Le personnage dont vous me parlez n'existe pas.");
|
||||
return null;
|
||||
}
|
||||
js.ecrire("Enchante de vous rencontrer "+pers.getNom()+".");
|
||||
return pers;
|
||||
}
|
||||
|
||||
public void deplacement(Personnage perso, Salle salle) {
|
||||
System.out.println("Choisissez une direction:\n Z) Haut\n S) Bas\n D) Droite\n Q) Gauche");
|
||||
switch(Clavier.entrerClavierString()) {
|
||||
case "Z":
|
||||
System.out.println("Vous allez vers le haut");
|
||||
perso.seDeplacer(salle);
|
||||
break;
|
||||
case "S":
|
||||
System.out.println("Vous allez vers le bas");
|
||||
perso.seDeplacer(salle);
|
||||
break;
|
||||
case "D":
|
||||
System.out.println("Vous allez vers le droite");
|
||||
perso.seDeplacer(salle);
|
||||
break;
|
||||
case "Q":
|
||||
System.out.println("Vous allez vers le gauche");
|
||||
perso.seDeplacer(salle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Menu_Marche(Marche marche,Personnage perso, Labyrinthe lab) {
|
||||
System.out.println("Voulez-vous acheter un objet:(votre bourse :"+perso.getValeurBourse() +")\n1) Oui\n2) Non");
|
||||
switch(Clavier.entrerClavierString()) {
|
||||
case "a":
|
||||
System.out.println("Choisissez un objet:");
|
||||
switch(Clavier.entrerClavierString()) {
|
||||
case "1":
|
||||
System.out.println(marche.creerObjetsAVendre(lab)+"\nVoulez-vous acheter une arme ? (oui/non)");
|
||||
String selection=Clavier.entrerClavierString();
|
||||
if(selection.compareTo("oui")>0) {
|
||||
System.out.println("Quel num<75>ro pour l'arme ?");
|
||||
int valeur = Clavier.entrerClavierInt();
|
||||
if (perso.getBourse().Achat(lab.listeArme.get(valeur))>=0) perso.equiper(lab.listeArme.get(valeur));
|
||||
} else {
|
||||
System.out.println("Pourquoi Pas une armure alors ? (oui/non)");
|
||||
selection=Clavier.entrerClavierString();
|
||||
if(selection.compareTo("oui")>0) {
|
||||
System.out.println("Quel num<75>ro pour l'armure ?");
|
||||
int valeur = Clavier.entrerClavierInt();
|
||||
if (perso.getBourse().Achat(lab.listeArmure.get(valeur))>=0) perso.equiper(lab.listeArmure.get(valeur));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
System.out.println("Vous sortez du marche.");
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Labyrinthe nouvellePartie() {
|
||||
System.out.println("Nouvelle partie!");
|
||||
|
||||
return new Labyrinthe();
|
||||
}
|
||||
|
||||
public Labyrinthe continuer() {
|
||||
System.out.println("Continuer");
|
||||
Generateur ge = new Generateur();
|
||||
return ge.labyrinthe();
|
||||
}
|
||||
public String textePerso(Labyrinthe lab) {
|
||||
String str ="<html>";
|
||||
str = str + "<br>Bonjour Etranger, je suis le narrateur de votre histoire. Comment dois-je vous appeler ? </br>";
|
||||
int i = 0;
|
||||
for (Personnage per : lab.listePersonnage) {
|
||||
str =str + "<br>" + (i++ + ") "+per.getNom())+"</br>";
|
||||
}
|
||||
str=str+"</html>";
|
||||
return str;
|
||||
|
||||
}
|
||||
public JeuSalle getJs() {
|
||||
return js;
|
||||
}
|
||||
|
||||
|
||||
System.out.println("Bonjour Etranger, je suis le narrateur de votre histoire. Comment dois-je vous appeler ? ");
|
||||
int i = 0;
|
||||
for (Personnage per : lab.listePersonnage) {
|
||||
System.out.println(i++ + ") "+per.getNom());
|
||||
}
|
||||
|
||||
Personnage pers;
|
||||
try{
|
||||
pers =lab.listePersonnage.get(Clavier.entrerClavierInt());
|
||||
}
|
||||
catch(Exception e) {
|
||||
System.out.println("Le personnage dont vous me parlez n'existe pas.");
|
||||
return null;
|
||||
}
|
||||
System.out.println("Enchante de vous rencontrer "+pers.getNom()+".");
|
||||
return pers;
|
||||
}
|
||||
}
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.class
Executable file
Binary file not shown.
@ -20,10 +20,8 @@ public class Monstre extends EtreVivant {
|
||||
|
||||
public int attaquer(Personnage def) {
|
||||
int pAttaqueLoc;
|
||||
if (def.getArmure()!=null) pAttaqueLoc=this.getpAttaque()-(def.getArmure().getpArmure());
|
||||
else pAttaqueLoc=this.getpAttaque();
|
||||
def.pVie-=pAttaqueLoc;
|
||||
if (def.pVie<=0)def.setVivant(false);
|
||||
pAttaqueLoc=this.getpAttaque()-(def.getArmure().getpArmure());
|
||||
def.pVie=pAttaqueLoc;
|
||||
return pAttaqueLoc;
|
||||
|
||||
}
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Objet.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Objet.class
Executable file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Personnage.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Personnage.class
Executable file
Binary file not shown.
@ -10,13 +10,27 @@ public class Personnage extends EtreVivant {
|
||||
private Arme arme;
|
||||
private Armure armure;
|
||||
private Bourse bourse;
|
||||
private Salle salle;
|
||||
private List<Potion> listepotion= new ArrayList<Potion>();
|
||||
|
||||
public Personnage(String nom, int pVieMax,int pAttaque) {
|
||||
super(nom, pVieMax, pAttaque);
|
||||
this.bourse=new Bourse(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the salle
|
||||
*/
|
||||
public Salle getSalle() {
|
||||
return salle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param salle the salle to set
|
||||
*/
|
||||
public void setSalle(Salle salle) {
|
||||
this.salle = salle;
|
||||
}
|
||||
|
||||
public void equiper(Arme arme) {
|
||||
arme.setProprietaire(this);
|
||||
this.arme=arme;
|
||||
@ -30,10 +44,7 @@ public void equiper(Armure armure) {
|
||||
soin();
|
||||
}
|
||||
|
||||
public void seDeplacer(Salle salle) {
|
||||
this.salle=salle;
|
||||
}
|
||||
|
||||
|
||||
public void allerMarche(Salle marche){
|
||||
this.salle=marche;
|
||||
}
|
||||
@ -54,12 +65,10 @@ public void equiper(Armure armure) {
|
||||
public int attaquer(Monstre monstre) {
|
||||
if(arme!=null) {
|
||||
monstre.pVie=monstre.pVie-(arme.getpArme()+getpAttaque());
|
||||
if (monstre.pVie<=0)monstre.setVivant(false);
|
||||
return arme.getpArme()+getpAttaque();
|
||||
}
|
||||
else {
|
||||
monstre.pVie=monstre.pVie-getpAttaque();
|
||||
if (monstre.pVie<=0)monstre.setVivant(false);
|
||||
monstre.pVie=monstre.pVie=getpAttaque();
|
||||
return getpAttaque();
|
||||
}
|
||||
}
|
||||
@ -78,13 +87,10 @@ public void equiper(Armure armure) {
|
||||
return arme;
|
||||
}
|
||||
|
||||
public String remplirBourse() {
|
||||
public String obtenirBourse() {
|
||||
Random rd = new Random();
|
||||
int piece = rd.nextInt(20);
|
||||
//this.bourse.fusionBourse(new Bourse(rd.nextInt(20)));
|
||||
this.bourse.setValeur(this.bourse.getValeur()+piece);
|
||||
String str="Vous avez gagnez une bourse. Vous comptez vos piéces... Genial !! Vous avez désormais ".concat(String.valueOf(this.getValeurBourse()).concat(" pi<70>ces d'argent !"));
|
||||
System.out.println("bourse:"+this.bourse.getValeur());
|
||||
this.bourse.fusionBourse(new Bourse(rd.nextInt(20)));
|
||||
String str="Vous avez gagnez une bourse. Vous comptez vos pi<70>ces... Genial !! Vous avez d<>sormais ".concat(String.valueOf(this.getValeurBourse()).concat(" pi<70>ces d'argent !"));
|
||||
return str;
|
||||
|
||||
}
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.class
Executable file
Binary file not shown.
@ -9,6 +9,9 @@ public class Porte {
|
||||
private Salle salle1;
|
||||
private Salle salle2;
|
||||
|
||||
public Porte() {
|
||||
|
||||
}
|
||||
|
||||
public Porte(boolean ouvert, Salle salle,Salle salle2) {
|
||||
super();
|
||||
@ -19,18 +22,20 @@ public class Porte {
|
||||
this.salle2.getListePorte().add(this.id);
|
||||
this.id++;
|
||||
}
|
||||
|
||||
|
||||
public Salle getSalle1() {
|
||||
/**
|
||||
* @return the salle1
|
||||
*/
|
||||
public Salle getSalle1() {
|
||||
return salle1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the salle2
|
||||
*/
|
||||
public Salle getSalle2() {
|
||||
return salle2;
|
||||
}
|
||||
|
||||
|
||||
public boolean estOuverte() {
|
||||
return ouvert;
|
||||
}
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.class
Executable file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.class
Executable file
Binary file not shown.
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
//import javafx.util.Pair;
|
||||
import org.javatuples.*;
|
||||
|
||||
public class Salle {
|
||||
private Pair<Integer,Integer> coordonnees;
|
||||
private boolean sortie;
|
||||
@ -17,14 +16,16 @@ public class Salle {
|
||||
|
||||
}
|
||||
|
||||
public List<Integer> getListeEnnemie() {
|
||||
return listeEnnemie;
|
||||
}
|
||||
|
||||
public Salle(int positionX, int positionY, boolean sortie, List<Integer> listeEnnemie) {
|
||||
this.coordonnees=new Pair<Integer,Integer>(positionX,positionY);
|
||||
this.sortie = sortie;
|
||||
this.listeEnnemie = listeEnnemie;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the listeEnnemie
|
||||
*/
|
||||
public List<Integer> getListeEnnemie() {
|
||||
return listeEnnemie;
|
||||
}
|
||||
|
||||
public String getType(){
|
||||
@ -40,9 +41,9 @@ public class Salle {
|
||||
}
|
||||
|
||||
public void cle(Labyrinthe lab) {
|
||||
//if (listeEnnemie.isEmpty()=null) {
|
||||
if (listeEnnemie.isEmpty()) {
|
||||
for (int i : listePorte ) lab.listePorte.get(i).ouverture();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean estVide() {
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/main.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/main.class
Executable file
Binary file not shown.
@ -6,26 +6,22 @@ public class main {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
Generateur gene = new Generateur();
|
||||
Labyrinthe lab = new Labyrinthe();
|
||||
|
||||
Menu menu = new Menu();
|
||||
Labyrinthe lab=menu.menuStartGame();
|
||||
lab=menu.menuStartGame();
|
||||
|
||||
|
||||
Marche marche= (Marche) lab.listePorte.get(0).getSalle1();
|
||||
System.out.println(marche.creerObjetsAVendre(lab));
|
||||
|
||||
Personnage perso = menu.menuSelection(lab);
|
||||
perso.setSalle(lab.listePorte.get(0).getSalle1());
|
||||
Salle next =lab.listePorte.get(perso.getSalle().getListePorte().get(0)).prochainSaut(perso.getSalle());
|
||||
|
||||
System.out.println(menu.menuCombat(lab.listeMonstre.get(next.getListeEnnemie().get(0)), perso, lab));
|
||||
perso.setSalle(next);
|
||||
menu.deplacement(perso,next);
|
||||
System.out.println("le personnage à bouger");
|
||||
|
||||
//Clavier.entrerClavierInt();
|
||||
//menu.menuCombat(lab.listeMonstre.get(0), lab.listePersonnage.get(0), lab);
|
||||
//menu.menuSelection(lab);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.class
Executable file
BIN
JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.class
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 32 KiB |
Loading…
Reference in New Issue
Block a user