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

/**
 *
 * @author Xabier
 */
public class SubNivel extends Inicio {
    /** Creates new form Cargar */
    public SubNivel() {
        initComponents();
    }

    /** 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();
        labelSubNivel = new javax.swing.JLabel();
        btnHP = new javax.swing.JButton();
        btnPP = new javax.swing.JButton();
        btnAtaque = new javax.swing.JButton();
        btnSefensa = new javax.swing.JButton();
        btnSuerte = new javax.swing.JButton();
        btnAgilidad = new javax.swing.JButton();
        labelParam = new javax.swing.JLabel();
        jCheckBox1 = new javax.swing.JCheckBox();
        btnContinuar = new javax.swing.JButton();
        textAtcEsp = new javax.swing.JTextField();

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

        labelSubNivel.setText("Enhorabuena, has subido del nivel "+pers.nivel+" al nivel "+(pers.nivel+1)+".");

        btnHP.setText("Subir HP (+5)");
        btnHP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHPActionPerformed(evt);
            }
        });

        btnPP.setText("Subir PP (+5)");
        btnPP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPPActionPerformed(evt);
            }
        });

        btnAtaque.setText("Subir Ataque (+1)");
        btnAtaque.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAtaqueActionPerformed(evt);
            }
        });

        btnSefensa.setText("Subir Defensa (+1)");
        btnSefensa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSefensaActionPerformed(evt);
            }
        });

        btnSuerte.setText("Subir Suerte (+1)");
        btnSuerte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSuerteActionPerformed(evt);
            }
        });

        btnAgilidad.setText("Subir Agilidad (+1)");
        btnAgilidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgilidadActionPerformed(evt);
            }
        });

        labelParam.setText("Elije el parámetro que quieres mejorar.");

        jCheckBox1.setEnabled(false);

        btnContinuar.setText("Continuar");
        btnContinuar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnContinuarActionPerformed(evt);
            }
        });

        textAtcEsp.setEditable(false);
        textAtcEsp.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        textAtcEsp.setText("No has aprendido ningun ataque especial");
        textAtcEsp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textAtcEspActionPerformed(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()
                        .addGap(88, 88, 88)
                        .addComponent(jCheckBox1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnContinuar))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(85, 85, 85)
                        .addComponent(labelSubNivel))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(45, 45, 45)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnHP, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
                            .addComponent(labelParam, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnPP, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
                            .addComponent(btnAtaque, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
                            .addComponent(btnSefensa, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
                            .addComponent(btnSuerte, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
                            .addComponent(btnAgilidad, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE))))
                .addGap(41, 41, 41))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(textAtcEsp, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(labelSubNivel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(labelParam)
                .addGap(9, 9, 9)
                .addComponent(btnHP)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnPP)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnAtaque)
                .addGap(16, 16, 16)
                .addComponent(btnSefensa)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnSuerte)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnAgilidad)
                .addGap(27, 27, 27)
                .addComponent(textAtcEsp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnContinuar)
                    .addComponent(jCheckBox1))
                .addContainerGap())
        );

        btnHP.getAccessibleContext().setAccessibleName("btnSubir HP (+5)");
        btnPP.getAccessibleContext().setAccessibleName("btnSubir PP (+5)");
        btnAtaque.getAccessibleContext().setAccessibleName("btnSubir Ataque (+1)");
        btnSefensa.getAccessibleContext().setAccessibleName("btnSubir Defensa (+1)");
        btnSuerte.getAccessibleContext().setAccessibleName("btnSubir Suerte (+1)");
        btnAgilidad.getAccessibleContext().setAccessibleName("btnSubir Agilidad (+1)");
        btnContinuar.getAccessibleContext().setAccessibleName("btnContinuar");

        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.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

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

    private void btnHPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHPActionPerformed
pers.nivel = pers.nivel + 1;
pers.hp_max = pers.hp_max + 5;
jCheckBox1.setSelected(rootPaneCheckingEnabled);
switch (pers.tipo){
        case 1: Elfo elf = new Elfo(); elf.AprenderAtac(pers); break;
        case 2: Mago mag = new Mago(); mag.AprenderAtac(pers); break;
        case 3: Ladron lad = new Ladron(); lad.AprenderAtac(pers); break;
        case 4: Orco orc = new Orco(); orc.AprenderAtac(pers); break;
        case 5: Soldado sold = new Soldado(); sold.AprenderAtac(pers); break;
        default: break;
        }
if (pers.aprender == true){
    textAtcEsp.setText("Has aprendido una nueva habilidad");
    pers.aprender = false;
}
    // TODO add your handling code here:
    }//GEN-LAST:event_btnHPActionPerformed

    private void btnPPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPPActionPerformed
pers.nivel = pers.nivel + 1;
pers.pp_max = pers.pp_max + 5;
jCheckBox1.setSelected(rootPaneCheckingEnabled);   
switch (pers.tipo){
        case 1: Elfo elf = new Elfo(); elf.AprenderAtac(pers); break;
        case 2: Mago mag = new Mago(); mag.AprenderAtac(pers); break;
        case 3: Ladron lad = new Ladron(); lad.AprenderAtac(pers); break;
        case 4: Orco orc = new Orco(); orc.AprenderAtac(pers); break;
        case 5: Soldado sold = new Soldado(); sold.AprenderAtac(pers); break;
        default: break;
        }
if (pers.aprender == true){
    textAtcEsp.setText("Has aprendido una nueva habilidad");
    pers.aprender = false;
}
// TODO add your handling code here:
    }//GEN-LAST:event_btnPPActionPerformed

    private void btnAtaqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtaqueActionPerformed
pers.nivel = pers.nivel + 1;
pers.atc = pers.atc + 1;
jCheckBox1.setSelected(rootPaneCheckingEnabled);
switch (pers.tipo){
        case 1: Elfo elf = new Elfo(); elf.AprenderAtac(pers); break;
        case 2: Mago mag = new Mago(); mag.AprenderAtac(pers); break;
        case 3: Ladron lad = new Ladron(); lad.AprenderAtac(pers); break;
        case 4: Orco orc = new Orco(); orc.AprenderAtac(pers); break;
        case 5: Soldado sold = new Soldado(); sold.AprenderAtac(pers); break;
        default: break;
        }
if (pers.aprender == true){
    textAtcEsp.setText("Has aprendido una nueva habilidad");
    pers.aprender = false;
}// TODO add your handling code here:
    }//GEN-LAST:event_btnAtaqueActionPerformed

    private void btnSefensaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSefensaActionPerformed
pers.nivel = pers.nivel + 1;
pers.def = pers.def + 1;
jCheckBox1.setSelected(rootPaneCheckingEnabled);
switch (pers.tipo){
        case 1: Elfo elf = new Elfo(); elf.AprenderAtac(pers); break;
        case 2: Mago mag = new Mago(); mag.AprenderAtac(pers); break;
        case 3: Ladron lad = new Ladron(); lad.AprenderAtac(pers); break;
        case 4: Orco orc = new Orco(); orc.AprenderAtac(pers); break;
        case 5: Soldado sold = new Soldado(); sold.AprenderAtac(pers); break;
        default: break;
        }
if (pers.aprender == true){
    textAtcEsp.setText("Has aprendido una nueva habilidad");
    pers.aprender = false;
}// TODO add your handling code here:
    }//GEN-LAST:event_btnSefensaActionPerformed

    private void btnSuerteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuerteActionPerformed
pers.nivel = pers.nivel + 1;
pers.suerte = pers.suerte + 1;
jCheckBox1.setSelected(rootPaneCheckingEnabled);
switch (pers.tipo){
        case 1: Elfo elf = new Elfo(); elf.AprenderAtac(pers); break;
        case 2: Mago mag = new Mago(); mag.AprenderAtac(pers); break;
        case 3: Ladron lad = new Ladron(); lad.AprenderAtac(pers); break;
        case 4: Orco orc = new Orco(); orc.AprenderAtac(pers); break;
        case 5: Soldado sold = new Soldado(); sold.AprenderAtac(pers); break;
        default: break;
        }
if (pers.aprender == true){
    textAtcEsp.setText("Has aprendido una nueva habilidad");
    pers.aprender = false;
}// TODO add your handling code here:
    }//GEN-LAST:event_btnSuerteActionPerformed

    private void btnAgilidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgilidadActionPerformed
pers.nivel = pers.nivel + 1;
pers.agilidad = pers.agilidad + 1;
jCheckBox1.setSelected(rootPaneCheckingEnabled);
switch (pers.tipo){
        case 1: Elfo elf = new Elfo(); elf.AprenderAtac(pers); break;
        case 2: Mago mag = new Mago(); mag.AprenderAtac(pers); break;
        case 3: Ladron lad = new Ladron(); lad.AprenderAtac(pers); break;
        case 4: Orco orc = new Orco(); orc.AprenderAtac(pers); break;
        case 5: Soldado sold = new Soldado(); sold.AprenderAtac(pers); break;
        default: break;
        }
if (pers.aprender == true){
    textAtcEsp.setText("Has aprendido una nueva habilidad");
    pers.aprender = false;
}// TODO add your handling code here:
    }//GEN-LAST:event_btnAgilidadActionPerformed

    private void btnContinuarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnContinuarActionPerformed
if ((jCheckBox1.isSelected() == true)){
           pers.hp = pers.hp_max;
           pers.pp = pers.pp_max;
           pers.exp = 0;
           this.hide();
           switch (pers.posicion){
               case 1: new villa1.NMenu().setVisible(true); break;
               case 2: new villa2.NMenu().setVisible(true); break;
           }
        }        // TODO add your handling code here:
    }//GEN-LAST:event_btnContinuarActionPerformed

    private void textAtcEspActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textAtcEspActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textAtcEspActionPerformed

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

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAgilidad;
    private javax.swing.JButton btnAtaque;
    private javax.swing.JButton btnContinuar;
    private javax.swing.JButton btnHP;
    private javax.swing.JButton btnPP;
    private javax.swing.JButton btnSefensa;
    private javax.swing.JButton btnSuerte;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel labelParam;
    private javax.swing.JLabel labelSubNivel;
    private javax.swing.JTextField textAtcEsp;
    // End of variables declaration//GEN-END:variables

}
