Example #1
0
        public static int atualizarHP(Personagem pc, int num, bool temp)
        {
            pc.hp[1] += num;

            if (pc.hp[1] > pc.hp[0] && temp == false)
            {
                pc.hp[1] = pc.hp[0];
                return pc.hp[0];
            }
            return pc.hp[1];
        }
Example #2
0
 public static int atualizaSlotMagia(Personagem pc, int circulo, int pretendido)
 {
     if (pc.slots[circulo - 1] < pretendido)
     {
         MessageBox.Show("Slots esgotados!");
         return pc.slots[circulo - 1];
     }
     else
     {
         pc.slotsUsados[circulo - 1] = pretendido;
         return pretendido;
     }
 }
Example #3
0
        private List<Personagem> carregarListaPC()
        {
            string sql = "select * from personagem";
            SqlConnection con = new SqlConnection("Data Source=PEP-PC;Initial Catalog=DMC;Integrated Security=True");
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.CommandType = CommandType.Text;
            SqlDataReader reader;
            con.Open();
            try
            {
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Personagem P = new Personagem();
                    P.id = Convert.ToInt16(reader[0]);
                    P.nome = reader[1].ToString();
                    P.jogador = reader[2].ToString();
                    P.classe = reader[3].ToString();
                    P.raca = reader[4].ToString();
                    P.hp[0] = Convert.ToInt16(reader[5]);
                    P.hp[1] = Convert.ToInt16(reader[6]);
                    P.sorte = Convert.ToInt16(reader[7]);
                    P.inspiracao = Convert.ToInt16(reader[8]);
                    P.xp = Convert.ToInt16(reader[9]);
                    P.exaustao = Convert.ToInt16(reader[10]);
                    P.sorteAtual = Convert.ToInt16(reader[11]);

                    List<int[]> slots = carregarSlots(P);

                    for(int i =0; i < slots.Count; i++){

                        P.slots[i] = slots[i][0];
                        P.slotsUsados[i] = slots[i][1];

                    }

                    this.ListaPC.Add(P);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.ToString());
            }
            finally { con.Close(); }

            return ListaPC;
        }
Example #4
0
        public void descansoLongo(Personagem pc)
        {
            pc1hp.Text = (pc.hp[0]).ToString();
            pc.hp[1] = pc.hp[0];
            pc1hpalterar.Text = "";
            bxExaustaoPc1.SelectedIndex = (bxExaustaoPc1.SelectedIndex - 1);
            pc.exaustao--;
            for (var i = 0; i < 9; i++) { pc.slotsUsados[i] = 0; }

            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 0;
            comboBox4.SelectedIndex = 0;
            comboBox5.SelectedIndex = 0;
            comboBox6.SelectedIndex = 0;
            comboBox7.SelectedIndex = 0;
            comboBox8.SelectedIndex = 0;
            comboBox9.SelectedIndex = 0;
            if (bxSortePc1.SelectedIndex < personagem.sorte) bxSortePc1.SelectedIndex = personagem.sorte;
            MessageBox.Show("Descanso longo realizado");
        }
Example #5
0
        private List<int[]> carregarSlots(Personagem P)
        {
            string sql = "select Conhecido, Usado from SlotsMagicos where personagemId = " + P.id + " order by circuloId";
            SqlConnection con = new SqlConnection("Data Source=PEP-PC;Initial Catalog=DMC;Integrated Security=True");
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.CommandType = CommandType.Text;
            SqlDataReader reader;
            con.Open();

            List<int[]> slots = new List<int[]>();

            reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                int[] item = new int[2];
                item[0] = Convert.ToInt16(reader[0]);
                item[1] = Convert.ToInt16(reader[1]);
                slots.Add(item);
            }
            con.Close();
            return slots;
        }
Example #6
0
 public Form1(Personagem p)
 {
     InitializeComponent();
     personagem = p;
     PreencherFicha(personagem);
 }
Example #7
0
        private void PreencherFicha(Personagem p)
        {
            lblPc1.Text = p.nome;
            pc1hp.Text = p.hp[1].ToString();

            bxSortePc1.SelectedIndex = p.sorteAtual;
            bxInspiraPc1.SelectedIndex = p.inspiracao;
            bxExaustaoPc1.SelectedIndex = p.exaustao;

            lblSlotMax1Pc1.Text = p.slots[0].ToString();
            lblSlotMax2Pc1.Text = p.slots[1].ToString();
            lblSlotMax3Pc1.Text = p.slots[2].ToString();
            lblSlotMax4Pc1.Text = p.slots[3].ToString();
            lblSlotMax5Pc1.Text = p.slots[4].ToString();
            lblSlotMax6Pc1.Text = p.slots[5].ToString();
            lblSlotMax7Pc1.Text = p.slots[6].ToString();
            lblSlotMax8Pc1.Text = p.slots[7].ToString();
            lblSlotMax9Pc1.Text = p.slots[8].ToString();

            bxXP1.SelectedIndex = p.xp;

            comboBox1.SelectedIndex = p.slotsUsados[0];
            comboBox2.SelectedIndex = p.slotsUsados[1];
            comboBox3.SelectedIndex = p.slotsUsados[2];
            comboBox4.SelectedIndex = p.slotsUsados[3];
            comboBox5.SelectedIndex = p.slotsUsados[4];
            comboBox6.SelectedIndex = p.slotsUsados[5];
            comboBox7.SelectedIndex = p.slotsUsados[6];
            comboBox8.SelectedIndex = p.slotsUsados[7];
            comboBox9.SelectedIndex = p.slotsUsados[8];
        }