package villa1;
import Globales.*;
import Monstruos.*;
/*
 * Cargar.java
 *
 * Created on 28-ago-2009, 0:18:44
 */

/**
 *
 * @author Xabier
 */
public class Taberna extends Inicio {

    /** Creates new form Cargar */
    public Taberna() {
        initComponents();
        if (pers.objtmision2 == true){
            this.hide();
            new villa1.Mision2().setVisible(true);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        labelTaberna = new javax.swing.JLabel();
        labelMisiones = new javax.swing.JLabel();
        btnVolver = new javax.swing.JButton();
        listaMisiones = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtExpl = new javax.swing.JTextArea();
        labelExpl = new javax.swing.JLabel();
        labelDatos = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtRecom = new javax.swing.JTextArea();
        labelAcepMis = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("RpG Java - Taberna");

        labelTaberna.setFont(new java.awt.Font("Tahoma", 2, 24)); // NOI18N
        labelTaberna.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        labelTaberna.setText(". Taberna .");

        labelMisiones.setText("Misiones disponibles:");

        btnVolver.setText("Volver");
        btnVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVolverActionPerformed(evt);
            }
        });

        listaMisiones.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Misión 1", "Misión 2", "Misión 3", "Misión 4" }));
        listaMisiones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                listaMisionesActionPerformed(evt);
            }
        });

        txtExpl.setColumns(20);
        txtExpl.setEditable(false);
        txtExpl.setRows(5);
        jScrollPane1.setViewportView(txtExpl);

        labelExpl.setText("Explicación:");

        labelDatos.setText("Datos Técnicos:");

        txtRecom.setColumns(20);
        txtRecom.setEditable(false);
        txtRecom.setRows(5);
        jScrollPane2.setViewportView(txtRecom);

        labelAcepMis.setText("Aceptar misión");
        labelAcepMis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                labelAcepMisActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(labelTaberna, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelDatos)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(labelAcepMis)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
                                        .addComponent(btnVolver))
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
                                .addGap(22, 22, 22))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelMisiones)
                            .addComponent(labelExpl)
                            .addComponent(listaMisiones, 0, 220, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(labelTaberna)
                .addGap(18, 18, 18)
                .addComponent(labelMisiones)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(listaMisiones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12)
                .addComponent(labelExpl)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelDatos)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnVolver)
                    .addComponent(labelAcepMis))
                .addGap(22, 22, 22))
        );

        btnVolver.getAccessibleContext().setAccessibleName("btnVolver");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVolverActionPerformed
        this.hide();
        new villa1.NMenu().setVisible(true);        // TODO add your handling code here:
    }//GEN-LAST:event_btnVolverActionPerformed

    private void listaMisionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listaMisionesActionPerformed
if (listaMisiones.getSelectedIndex() == 0){
        txtExpl.setText("Unos extraños monstruos han \ninvadido la villa. Debes vencer al \njefe de estos para hacer que se\n marchen de la ciudad. \nTu pueblo te necesita!");
        txtRecom.setText("Dinero: 100 leutas \nExperiencia: 100 \n\n Nivel Recomendado: +7");
}  
if (listaMisiones.getSelectedIndex() == 1){
        txtExpl.setText("Visita la villa 2,ve a la \ntaberna y recoge el objeto que te den.\nTraelo de vuelta aquí para \n completar la misión.\n");
        txtRecom.setText("Dinero: 100 leutas \n\n Nivel Recomendado: Ninguno");
}
// TODO add your handling code here:
    }//GEN-LAST:event_listaMisionesActionPerformed

    private void labelAcepMisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labelAcepMisActionPerformed
if ((listaMisiones.getSelectedIndex() == 0) && (pers.nivel >= 7) && (pers.mis1_vill1_fin == 0)){
            MonsMision mons = new MonsMision(40,20,15,15,20,100,100,"Dragón");
            rival = mons;
            batalla = new Globales.CBatalla();
            batalla.setVisible(true);
            this.hide();

}
if ((listaMisiones.getSelectedIndex() == 0) && (pers.nivel < 7)){
            txtRecom.setText("No tienes el nivel recomendado");
}
if ((listaMisiones.getSelectedIndex() == 1) && (pers.mis2_vill1_fin == 0)){
            pers.mision2 = true;
}
else {
    txtRecom.setText("Misión ya realizada.");
}// TODO add your handling code here:
    }//GEN-LAST:event_labelAcepMisActionPerformed

    /**
    * @param args the command line arguments
    */
   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnVolver;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JButton labelAcepMis;
    private javax.swing.JLabel labelDatos;
    private javax.swing.JLabel labelExpl;
    private javax.swing.JLabel labelMisiones;
    private javax.swing.JLabel labelTaberna;
    private javax.swing.JComboBox listaMisiones;
    private javax.swing.JTextArea txtExpl;
    private javax.swing.JTextArea txtRecom;
    // End of variables declaration//GEN-END:variables

}
