From ff5d05394697da84be9a1bf462ca09a12c636f18 Mon Sep 17 00:00:00 2001 From: Theo_Dubo Date: Tue, 16 Apr 2019 12:05:43 +0000 Subject: [PATCH 1/5] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?JAVA/PROJET-PMT=5FSTRI1A/src/modeles'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java | 36 +++++++---- .../PROJET-PMT_STRI1A/src/modeles/Armure.java | 39 ++++++++---- .../PROJET-PMT_STRI1A/src/modeles/Bourse.java | 47 ++++++++++---- JAVA/PROJET-PMT_STRI1A/src/modeles/Objet.java | 62 +++++++++++++++---- .../PROJET-PMT_STRI1A/src/modeles/Potion.java | 39 ++++++++---- 5 files changed, 163 insertions(+), 60 deletions(-) diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java index f6408bb..919a07a 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java @@ -1,12 +1,24 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Arme extends Objet { - -} + +package modeles; + +/** + * @author flavien + * + */ +public class Arme extends Objet { + + private int pArme; + + public int getpArme() { + return this.pArme; + } + + public String getType() { + return "Arme"; + } + + public Arme(String nm, int valeur, int resistance, int attaque) { + super(nm, valeur, resistance); + this.pArme=attaque; + } +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java index 60347c6..35f6103 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java @@ -1,12 +1,27 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Armure extends Objet { - -} +/** + * + */ +package modeles; + +/** + * @author flavien + * + */ +public class Armure extends Objet { + + private int pArmure; + + public int getpArmure() { + return this.pArmure; + } + + public String getType () { + return "Armure"; + } + + public Armure(String nm, int valeur, int resistance,int efficacité) { + super(nm, valeur, resistance); + this.pArmure=efficacité; + } + +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java index adbf0d0..3f09d2c 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java @@ -1,12 +1,35 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Bourse extends Objet { - -} +/** + * + */ +package modeles; + +/** + * @author flavien + * + */ +public class Bourse extends Objet { + private int valeur; + + public Bourse(int somme) { + super("bourse",somme,99999999); + + } + + public int getValeur() { + return this.valeur; + } + + public String getType() { + return "Bourse"; + } + + 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 = cout-this.valeur; + System.out.println("L'achat est impossible, il vous manque :"+manque); + return -manque; + } + } + +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Objet.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Objet.java index 1dcfd44..9e59ae0 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Objet.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Objet.java @@ -1,12 +1,50 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Objet { - -} +package modeles; + +/** + * @author flavien + * + */ +public abstract class Objet { + private String nom; + private int prix; + private int usure; + private Personnage proprietaire; + + + public Objet(String nm, int valeur, int resistance) { + this.nom=nm; + this.prix=valeur; + this.usure=resistance; + } + + public int getPrix() { + return this.prix; + } + + public String getNom() { + return this.nom; + } + + public int getUsure() { + return this.usure; + } + + public void utilisation() { // diminue la résistance de l'objet + this.usure--; + if (this.usure == 0) System.out.println(this.nom+"s'est cassée !"); + } + + public abstract String getType(); + + public Personnage getProprietaire() { + return this.proprietaire; + } + + public void setProprietaire(Personnage perso) { + this.proprietaire=perso; + } + + public void lacher() { + this.proprietaire=null; + } +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java index dc7103e..bd441c2 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java @@ -1,12 +1,27 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Potion extends Objet { - -} +/** + * + */ +package modeles; + +/** + * @author flavien + * + */ +public class Potion extends Objet { + public String getType() { + return "Potion"; + } + + public Potion(int valeur) { + super("potion", valeur, 1); + } + + public void utilisation() { + super.utilisation(); + this.getProprietaire().soin(this.getProprietaire().getPVmax()); // + + + } + + +} From 114f7e010422f893eea423891a7bd1d2c47802ec Mon Sep 17 00:00:00 2001 From: Theo_Dubo Date: Tue, 16 Apr 2019 13:32:12 +0000 Subject: [PATCH 2/5] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?JAVA/PROJET-PMT=5FSTRI1A/src/modeles'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modeles/sauvegarde.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java new file mode 100644 index 0000000..cc1d9da --- /dev/null +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java @@ -0,0 +1,34 @@ +package modeles; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + + +public class sauvegarde { + + public void enregistrerPersonnage(Labyrinthe lab) { + try { + File f= new File("./personnage.json"); + f.createNewFile(); + FileWriter fw= new FileWriter(f,true); + for (int i =0; i Date: Thu, 18 Apr 2019 14:11:34 +0000 Subject: [PATCH 3/5] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?JAVA/PROJET-PMT=5FSTRI1A/src/modeles'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java | 2 + .../PROJET-PMT_STRI1A/src/modeles/Armure.java | 2 + .../PROJET-PMT_STRI1A/src/modeles/Bourse.java | 9 +- .../src/modeles/EtreVivant.java | 133 ++++++++++++++++-- .../src/modeles/Labyrinthe.java | 35 +++-- 5 files changed, 155 insertions(+), 26 deletions(-) diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java index 919a07a..355a724 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Arme.java @@ -21,4 +21,6 @@ public class Arme extends Objet { super(nm, valeur, resistance); this.pArme=attaque; } + + /* public void effectArme ? (poison, incinération, gel, saignement, paralysie,... */ } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java index 35f6103..76ef352 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Armure.java @@ -24,4 +24,6 @@ public class Armure extends Objet { this.pArmure=efficacité; } + + /* public armureEffect(...) */ } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java index 3f09d2c..648bf9c 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Bourse.java @@ -27,9 +27,14 @@ public class Bourse extends Objet { if (cout <= this.valeur) return (this.valeur=this.valeur-cout); else { int manque = cout-this.valeur; - System.out.println("L'achat est impossible, il vous manque :"+manque); - return -manque; + System.out.println("L'achat est impossible, il vous manque : "+manque); + return manque; } } + public int fusionBourse(Bourse sacPiece) { + this.valeur += sacPiece.valeur; + return this.valeur; + } + } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java index ad7bf6d..72485c9 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java @@ -1,12 +1,121 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class EtreVivant { - -} + +/** + * + */ +package modeles; + +/** + * @author Nicolas + * + */ +public class EtreVivant { + + private String nom; + protected int pVieMax; + protected int pVie; + private int pAttaque; + protected Salle salle; + private boolean vivant; + /** + * @param nom + * @param pVieMax + * @param pVie + * @param pAttaque + * @param salle + * @param vivant + */ + public EtreVivant(String nom, int pVieMax, int pAttaque, Salle salle) { + super(); + this.nom = nom; + this.pVieMax = pVieMax; + this.pVie = pVieMax; + this.pAttaque = pAttaque; + this.salle = salle; + this.vivant = true; + } + /** + * @return the nom + */ + public String getNom() { + return nom; + } + /** + * @param nom the nom to set + */ + public void setNom(String nom) { + this.nom = nom; + } + /** + * @return the pVieMax + */ + public int getpVieMax() { + return pVieMax; + } + /** + * @param pVieMax the pVieMax to set + */ + public void setpVieMax(int pVieMax) { + this.pVieMax = pVieMax; + } + /** + * @return the pVie + */ + public int getpVie() { + return pVie; + } + /** + * @param pVie the pVie to set + */ + public void setpVie(int pVie) { + this.pVie = pVie; + } + /** + * @return the pAttaque + */ + public int getpAttaque() { + return pAttaque; + } + /** + * @param pAttaque the pAttaque to set + */ + public void setpAttaque(int pAttaque) { + this.pAttaque = pAttaque; + } + /** + * @return the salle + */ + public Salle getSalle() { + return salle; + } + /** + * @param salle the salle to set + */ + public void setSalle(Salle salle) { + this.salle = salle; + } + /** + * @return the vivant + */ + public boolean isVivant() { + return vivant; + } + /** + * @param vivant the vivant to set + */ + public void setVivant(boolean vivant) { + this.vivant = vivant; + } + + public int getPvMax() { + return this.pVieMax; + } + + + + + + + + + +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Labyrinthe.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Labyrinthe.java index 42b67e1..544c663 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Labyrinthe.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Labyrinthe.java @@ -1,12 +1,23 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Labyrinthe { - -} +/** + * + */ +package modeles; + +import java.util.*; + +/** + * @author flavien + * + */ +public class Labyrinthe { + protected List listePersonnage=new ArrayList(); + protected ListlisteSalle= new ArrayList(); + protected List listeArme= new ArrayList(); + protected List listeArmure=new ArrayList(); + + public void generateLabyrinthe() { + } + + + +} From 955bc6724b4fee4a5d7e4e8793efd7f3b44dec2c Mon Sep 17 00:00:00 2001 From: Theo_Dubo Date: Thu, 18 Apr 2019 14:12:07 +0000 Subject: [PATCH 4/5] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?JAVA/PROJET-PMT=5FSTRI1A/src/modeles'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PROJET-PMT_STRI1A/src/modeles/Marche.java | 24 +++--- .../src/modeles/Monstre.java | 36 +++++--- .../src/modeles/Personnage.java | 84 ++++++++++++++++--- JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java | 34 +++++--- 4 files changed, 130 insertions(+), 48 deletions(-) diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java index dd7d35b..256ba45 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java @@ -1,12 +1,12 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Marche extends Salle { - -} +/** + * + */ +package modeles; + +/** + * @author flavien + * + */ +public class Marche extends Salle { + +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java index 16e1343..577e964 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java @@ -1,12 +1,24 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Monstre extends EtreVivant { - -} +/** + * + */ +package modeles; + +/** + * @author Nicolas + * + */ +public class Monstre extends EtreVivant { + + /** + * @param arme + * @param armure + * @param bourse + */ + public Monstre(String nom, int pAttaque, Salle salle) { + super(nom, 5, pAttaque, salle); + + } + + + +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Personnage.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Personnage.java index d9399b2..3d938ee 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Personnage.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Personnage.java @@ -1,12 +1,72 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Personnage extends EtreVivant { - -} +package modeles; + +/** + * @author Nicolas + * + */ +public class Personnage extends EtreVivant { + private Arme arme; + private Armure armure; + private Bourse bourse; + public Personnage(String nom, int pVieMax,int pAttaque, Salle salle) { + super(nom, pVieMax, pAttaque, salle); + } + + public void equiper(Arme arme) { + + arme.setProprietaire(this); + this.arme=arme; + } +public void equiper(Armure armure) { + armure.setProprietaire(this); + this.armure=armure; + } + + public void utiliser(Potion potion) { + soin(); + System.out.println("Pv au maximum"); + + } + public void seDeplacer(Salle salle) { + this.salle=salle; + } + public void allerMarche(Salle marche){ + this.salle=marche; + } + public void soin() { + this.pVie=this.pVieMax; + } + public void attaquer(Monstre monstre) { + if(arme!=null) { + monstre.pVie=monstre.pVie-(arme.getpArme()+getpAttaque()); + } + else { + monstre.pVie=monstre.pVie=getpAttaque(); + } +} + public Bourse getBourse() { + return this.bourse; + } + + public void getValeurBourse() { + System.out.println(this.getBourse().getValeur()); + } + /** + * @return the arme + */ + public Arme getArme() { + return arme; + } + + /** + * @return the armure + */ + public Armure getArmure() { + return armure; + } + + public void soin(int heal) { + if (pVie+heal > pVieMax)pVie=pVieMax; + else pVie+=heal; + } +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java index e5de82d..cd520f5 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java @@ -1,12 +1,22 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Porte { - -} +/** + * + */ +package modeles; + +/** + * @author flavien + * + */ +public class Porte { + private boolean ouvert; + private char orientation; + + public boolean estOuverte() { + return ouvert; + } + + public char getOrientation() { + return orientation; + } + +} From 146ae8115ec76ba6a13fb95bcc89e6a3f1b8aeb8 Mon Sep 17 00:00:00 2001 From: Theo_Dubo Date: Thu, 18 Apr 2019 14:12:20 +0000 Subject: [PATCH 5/5] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?JAVA/PROJET-PMT=5FSTRI1A/src/modeles'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PROJET-PMT_STRI1A/src/modeles/Potion.java | 4 +- JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java | 51 ++++++++++++++----- .../src/modeles/sauvegarde.java | 24 ++++++--- 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java index bd441c2..5e57481 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Potion.java @@ -18,9 +18,7 @@ public class Potion extends Objet { public void utilisation() { super.utilisation(); - this.getProprietaire().soin(this.getProprietaire().getPVmax()); // - - + this.getProprietaire().soin(this.getProprietaire().getpVieMax()); } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java index 48aee2d..161e168 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java @@ -1,12 +1,39 @@ -/** - * - */ -package modeles; - -/** - * @author flavien - * - */ -public class Salle { - -} +/** + * + */ +package modeles; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author flavien + * + */ +public class Salle { + private int positionX; + private int positionY; + private boolean sortie; + private List listeEnnemie= new ArrayList(); + + public String getType(){ + return "salle"; + } + + public int getPositionX() { + return this.positionX; + } + + public int getPositionY() { + return this.positionY; + } + + public boolean estSortie() { + return sortie; + } + + public boolean estVide() { + return listeEnnemie.isEmpty(); + } +} + diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java index cc1d9da..4e3b248 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/sauvegarde.java @@ -13,12 +13,12 @@ public class sauvegarde { f.createNewFile(); FileWriter fw= new FileWriter(f,true); for (int i =0; i