diff --git a/JDR/nbproject/project.properties b/JDR/nbproject/project.properties index 3ee6bff..d303e1e 100644 --- a/JDR/nbproject/project.properties +++ b/JDR/nbproject/project.properties @@ -1,9 +1,10 @@ annotation.processing.enabled=true annotation.processing.enabled.in.editor=false -annotation.processing.processor.options= annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=JDR +application.vendor=emile.lalorcey build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: @@ -32,6 +33,7 @@ dist.jar=${dist.dir}/JDR.jar dist.javadoc.dir=${dist.dir}/javadoc dist.jlink.dir=${dist.dir}/jlink dist.jlink.output=${dist.jlink.dir}/JDR +endorsed.classpath= excludes= includes=** jar.compress=false @@ -72,7 +74,7 @@ jlink.additionalmodules= jlink.additionalparam= jlink.launcher=true jlink.launcher.name=JDR -main.class=jdr.JDR +main.class=Presentation.Plateau_de_jeu manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false diff --git a/JDR/src/Presentation/Plateau_de_jeu.form b/JDR/src/Presentation/Plateau_de_jeu.form index 5d483b8..aa78683 100644 --- a/JDR/src/Presentation/Plateau_de_jeu.form +++ b/JDR/src/Presentation/Plateau_de_jeu.form @@ -2,36 +2,77 @@
- - - - - - + - + - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + @@ -53,7 +94,7 @@ - + @@ -62,7 +103,7 @@ - + @@ -77,7 +118,7 @@ - + @@ -111,9 +152,14 @@ + + + + + - + @@ -126,7 +172,7 @@ - + @@ -155,23 +201,27 @@ - - - - - - - - + + + + + + + + + + + + - - - + + + - + @@ -179,8 +229,8 @@ - - + + @@ -191,6 +241,11 @@ + + + + + @@ -205,7 +260,7 @@ - + @@ -240,18 +295,18 @@ - + - + - + - + @@ -321,24 +376,24 @@ - - - - - + + + + + - - + + @@ -361,12 +416,14 @@ + + + - @@ -383,24 +440,24 @@ - - - - - + + + + + - - + + @@ -423,6 +480,9 @@ + + + diff --git a/JDR/src/Presentation/Plateau_de_jeu.java b/JDR/src/Presentation/Plateau_de_jeu.java index 3e0e40c..6d9e74a 100644 --- a/JDR/src/Presentation/Plateau_de_jeu.java +++ b/JDR/src/Presentation/Plateau_de_jeu.java @@ -5,6 +5,8 @@ package Presentation; import javax.swing.DefaultComboBoxModel; +import javax.swing.Icon; +import javax.swing.JOptionPane; import metier.Jeu; import metier.Personnage; @@ -34,8 +36,6 @@ public class Plateau_de_jeu extends javax.swing.JFrame { // //GEN-BEGIN:initComponents private void initComponents() { - jScrollPane1 = new javax.swing.JScrollPane(); - jList1 = new javax.swing.JList<>(); jPanel1 = new javax.swing.JPanel(); JPFondListePerso = new javax.swing.JPanel(); jLImageListePerso = new javax.swing.JLabel(); @@ -57,19 +57,22 @@ public class Plateau_de_jeu extends javax.swing.JFrame { jScrollPane4 = new javax.swing.JScrollPane(); jTADefenseurCaracteristiques = new javax.swing.JTextArea(); jBGo = new javax.swing.JButton(); - - jList1.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; - public int getSize() { return strings.length; } - public String getElementAt(int i) { return strings[i]; } - }); - jScrollPane1.setViewportView(jList1); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenuJeu = new javax.swing.JMenu(); + jMInewGame = new javax.swing.JMenuItem(); + jMInewPlayer = new javax.swing.JMenuItem(); + jMIopenGame = new javax.swing.JMenuItem(); + jMIsave = new javax.swing.JMenuItem(); + jMIquit = new javax.swing.JMenuItem(); + jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); JPFondListePerso.setBackground(new java.awt.Color(102, 0, 0)); JPFondListePerso.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); - JPFondListePerso.add(jLImageListePerso, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 10, 130, 80)); + + jLImageListePerso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/adj_1.jpg"))); // NOI18N + JPFondListePerso.add(jLImageListePerso, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 0, 190, 100)); jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); @@ -78,10 +81,12 @@ public class Plateau_de_jeu extends javax.swing.JFrame { jTextArea1.setRows(5); jScrollPane2.setViewportView(jTextArea1); - JPFondListePerso.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 100, 148, 360)); + JPFondListePerso.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, 210, 350)); jPJeu.setBackground(new java.awt.Color(255, 255, 255)); + jLChoixPerso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/famille_1.jpg"))); // NOI18N + jLChoixPersoText.setText("Choix Des personnages"); jPCHoixPersoFond.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); @@ -112,31 +117,31 @@ public class Plateau_de_jeu extends javax.swing.JFrame { jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + jTAAttaquantCaracteristiques.setBackground(new java.awt.Color(102, 0, 0)); jTAAttaquantCaracteristiques.setColumns(20); jTAAttaquantCaracteristiques.setRows(5); jTAAttaquantCaracteristiques.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); - jTAAttaquantCaracteristiques.setOpaque(false); jScrollPane3.setViewportView(jTAAttaquantCaracteristiques); javax.swing.GroupLayout jPAttaquantLayout = new javax.swing.GroupLayout(jPAttaquant); jPAttaquant.setLayout(jPAttaquantLayout); jPAttaquantLayout.setHorizontalGroup( jPAttaquantLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPAttaquantLayout.createSequentialGroup() - .addGap(25, 25, 25) - .addComponent(jLImageAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(51, Short.MAX_VALUE)) .addGroup(jPAttaquantLayout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPAttaquantLayout.createSequentialGroup() + .addContainerGap(68, Short.MAX_VALUE) + .addComponent(jLImageAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(59, 59, 59)) ); jPAttaquantLayout.setVerticalGroup( jPAttaquantLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPAttaquantLayout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLImageAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(15, Short.MAX_VALUE)) ); @@ -146,6 +151,7 @@ public class Plateau_de_jeu extends javax.swing.JFrame { jScrollPane4.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane4.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + jTADefenseurCaracteristiques.setBackground(new java.awt.Color(102, 0, 0)); jTADefenseurCaracteristiques.setColumns(20); jTADefenseurCaracteristiques.setRows(5); jScrollPane4.setViewportView(jTADefenseurCaracteristiques); @@ -154,21 +160,21 @@ public class Plateau_de_jeu extends javax.swing.JFrame { jPDefenseur.setLayout(jPDefenseurLayout); jPDefenseurLayout.setHorizontalGroup( jPDefenseurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPDefenseurLayout.createSequentialGroup() - .addGap(31, 31, 31) - .addComponent(jLImageDefenseur, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(38, Short.MAX_VALUE)) .addGroup(jPDefenseurLayout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPDefenseurLayout.createSequentialGroup() + .addContainerGap(64, Short.MAX_VALUE) + .addComponent(jLImageDefenseur, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(64, 64, 64)) ); jPDefenseurLayout.setVerticalGroup( jPDefenseurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPDefenseurLayout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) + .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLImageDefenseur, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); @@ -178,17 +184,17 @@ public class Plateau_de_jeu extends javax.swing.JFrame { jPCHoixPersoFondLayout.setHorizontalGroup( jPCHoixPersoFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPCHoixPersoFondLayout.createSequentialGroup() - .addGap(81, 81, 81) + .addGap(101, 101, 101) .addComponent(jCBoxAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jCBoxDefenseur, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(75, 75, 75)) + .addGap(107, 107, 107)) .addGroup(jPCHoixPersoFondLayout.createSequentialGroup() .addGap(27, 27, 27) .addComponent(jPAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE) .addComponent(jPDefenseur, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(38, 38, 38)) + .addGap(26, 26, 26)) ); jPCHoixPersoFondLayout.setVerticalGroup( jPCHoixPersoFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -215,7 +221,7 @@ public class Plateau_de_jeu extends javax.swing.JFrame { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPChoixPersoLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPCHoixPersoFond, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(70, 70, 70)) + .addContainerGap()) ); jPChoixPersoLayout.setVerticalGroup( jPChoixPersoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -238,26 +244,28 @@ public class Plateau_de_jeu extends javax.swing.JFrame { jPJeu.setLayout(jPJeuLayout); jPJeuLayout.setHorizontalGroup( jPJeuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPJeuLayout.createSequentialGroup() - .addContainerGap(15, Short.MAX_VALUE) - .addComponent(jPChoixPerso, javax.swing.GroupLayout.PREFERRED_SIZE, 528, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(54, 54, 54)) .addGroup(jPJeuLayout.createSequentialGroup() .addGroup(jPJeuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPJeuLayout.createSequentialGroup() - .addGap(215, 215, 215) - .addComponent(jLChoixPerso, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPJeuLayout.createSequentialGroup() - .addGap(236, 236, 236) - .addComponent(jBGo))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(jPJeuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPJeuLayout.createSequentialGroup() + .addGap(236, 236, 236) + .addComponent(jBGo)) + .addGroup(jPJeuLayout.createSequentialGroup() + .addGap(172, 172, 172) + .addComponent(jLChoixPerso, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPJeuLayout.createSequentialGroup() + .addGap(0, 15, Short.MAX_VALUE) + .addComponent(jPChoixPerso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) ); jPJeuLayout.setVerticalGroup( jPJeuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPJeuLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jLChoixPerso, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(32, 32, 32) + .addComponent(jLChoixPerso) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPChoixPerso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jBGo) @@ -272,7 +280,7 @@ public class Plateau_de_jeu extends javax.swing.JFrame { .addContainerGap() .addComponent(jPJeu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(JPFondListePerso, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(JPFondListePerso, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( @@ -287,6 +295,50 @@ public class Plateau_de_jeu extends javax.swing.JFrame { .addContainerGap()) ); + jMenuJeu.setText("Jeu"); + + jMInewGame.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + jMInewGame.setText("New Game"); + jMInewGame.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMInewGameActionPerformed(evt); + } + }); + jMenuJeu.add(jMInewGame); + + jMInewPlayer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, 0)); + jMInewPlayer.setText("New Player"); + jMInewPlayer.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMInewPlayerActionPerformed(evt); + } + }); + jMenuJeu.add(jMInewPlayer); + + jMIopenGame.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + jMIopenGame.setText("Open Game"); + jMenuJeu.add(jMIopenGame); + + jMIsave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + jMIsave.setText("Save"); + jMenuJeu.add(jMIsave); + + jMIquit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + jMIquit.setText("Exit"); + jMIquit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMIquitActionPerformed(evt); + } + }); + jMenuJeu.add(jMIquit); + + jMenuBar1.add(jMenuJeu); + + jMenu2.setText("Edit"); + jMenuBar1.add(jMenu2); + + setJMenuBar(jMenuBar1); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -301,49 +353,70 @@ public class Plateau_de_jeu extends javax.swing.JFrame { .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(14, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// //GEN-END:initComponents + + private void jBGoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGoActionPerformed + //Attaquant + String attaque = (String) jCBoxAttaquant.getSelectedItem(); + String nomAttaque = attaque.split(":")[1]; + Personnage attaquant = leJeu.rechercherPerso(nomAttaque); + + //Defenseur + String defense = (String) jCBoxDefenseur.getSelectedItem(); + String nomDefense = defense.split(":")[1]; + Personnage defenseur = leJeu.rechercherPerso(nomDefense); + + //Combat + if(defenseur.equals(attaquant)){ + combatImpossible(defenseur); + }else{ + attaquant.rencontrer(defenseur); + //mise à jour ath + + } + majStatistiquesPersos(); + + }//GEN-LAST:event_jBGoActionPerformed + + private void jCBoxDefenseurActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBoxDefenseurActionPerformed + // TODO add your handling code here: + String perso = (String) jCBoxDefenseur.getSelectedItem(); + String nomPerso = perso.split(":")[1]; + Personnage Perso = leJeu.rechercherPerso(nomPerso); + jTADefenseurCaracteristiques.setText(Perso.toString()); + }//GEN-LAST:event_jCBoxDefenseurActionPerformed + private void jCBoxAttaquantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBoxAttaquantActionPerformed // TODO add your handling code here: String perso = (String) jCBoxAttaquant.getSelectedItem(); String nomPerso = perso.split(":")[1]; Personnage Perso = leJeu.rechercherPerso(nomPerso); - jTAAttaquantCaracteristiques.setText(Perso.toString()); + jTAAttaquantCaracteristiques.setText(Perso.toString()); }//GEN-LAST:event_jCBoxAttaquantActionPerformed private void jCBoxAttaquantInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_jCBoxAttaquantInputMethodTextChanged }//GEN-LAST:event_jCBoxAttaquantInputMethodTextChanged - - private void jCBoxDefenseurActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBoxDefenseurActionPerformed + private void jMInewPlayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMInewPlayerActionPerformed // TODO add your handling code here: - String perso = (String) jCBoxDefenseur.getSelectedItem(); - String nomPerso = perso.split(":")[1]; - Personnage Perso = leJeu.rechercherPerso(nomPerso); - jTADefenseurCaracteristiques.setText(Perso.toString()); - }//GEN-LAST:event_jCBoxDefenseurActionPerformed + }//GEN-LAST:event_jMInewPlayerActionPerformed + + private void jMInewGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMInewGameActionPerformed + + }//GEN-LAST:event_jMInewGameActionPerformed + + private void jMIquitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIquitActionPerformed + + }//GEN-LAST:event_jMIquitActionPerformed - private void jBGoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGoActionPerformed - //Attaquant - String attaque = (String) jCBoxAttaquant.getSelectedItem(); - String nomAttaque = attaque.split(":")[1]; - Personnage attaquant = leJeu.rechercherPerso(nomAttaque); - //Defenseur - String defense = (String) jCBoxAttaquant.getSelectedItem(); - String nomDefense = defense.split(":")[1]; - Personnage defenseur = leJeu.rechercherPerso(nomDefense); - //Combat - attaquant.rencontrer(defenseur); - //mise à jour ath - majStatistiquesPersos(); - }//GEN-LAST:event_jBGoActionPerformed - + private void majStatistiquesPersos(){ String persos = "Jeu : "+leJeu.getnomJeu(); for(Personnage Perso:leJeu.getmesPersonnages()){ @@ -353,6 +426,16 @@ public class Plateau_de_jeu extends javax.swing.JFrame { persos += "----------------"; } jTextArea1.setText(persos); + jTAAttaquantCaracteristiques.setText(""); + jTADefenseurCaracteristiques.setText(""); + } + + private void combatImpossible(Personnage perso){ + String message = "Mais vous êtes devenu fou"; + String titre = "Folie Incontestable !!"; + Icon img = new javax.swing.ImageIcon("/img/folie.png"); + JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE, img); + perso.varierEnergie(-1); } /** * @param args the command line arguments @@ -400,14 +483,20 @@ public class Plateau_de_jeu extends javax.swing.JFrame { private javax.swing.JLabel jLImageAttaquant; private javax.swing.JLabel jLImageDefenseur; private javax.swing.JLabel jLImageListePerso; - private javax.swing.JList jList1; + private javax.swing.JMenuItem jMInewGame; + private javax.swing.JMenuItem jMInewPlayer; + private javax.swing.JMenuItem jMIopenGame; + private javax.swing.JMenuItem jMIquit; + private javax.swing.JMenuItem jMIsave; + private javax.swing.JMenu jMenu2; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenu jMenuJeu; private javax.swing.JPanel jPAttaquant; private javax.swing.JPanel jPCHoixPersoFond; private javax.swing.JPanel jPChoixPerso; private javax.swing.JPanel jPDefenseur; private javax.swing.JPanel jPJeu; private javax.swing.JPanel jPanel1; - private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; diff --git a/JDR/src/img/folie.jpg b/JDR/src/img/folie.jpg new file mode 100644 index 0000000..0b5a5d2 Binary files /dev/null and b/JDR/src/img/folie.jpg differ