Example #1
0
 private void defeated(monster mymons)
 {
     mymons.Hp   = mymons.Maxhp;
     mymons.Exp += 50;
     if (mymons.Exp >= mymons.Maxexp)
     {
         mymons.Exp    = 0;
         mymons.Level += 1;
         mymons.Maxexp = mymons.Level * 200;
         if (mymons.Level == 5)
         {
             mymons.evolve();
             statPlayer(mymons);
             MessageBox.Show("Evolved!");
         }
         if (mymons.Evolved == true)
         {
             mymons.Maxhp += mymons.Level * 300;
         }
         else
         {
             mymons.Maxhp += mymons.Level * 200;
         }
         mymons.Hp = mymons.Maxhp;
     }
     historyRtb.Text += mymons + " kalah !!!" + "\n";
     historyRtb.Text += "Mendapatkan EXP sebesar 10" + "\n";
     historyRtb.Text += "---------------------------" + "\n";
 }
Example #2
0
        private void randomButton_Click(object sender, EventArgs e)
        {
            int idx   = battleBox.SelectedIndex;
            int spawn = r.Next(1, 3);

            if (idx > -1)
            {
                historyRtb.Clear();
                monster mymons = dbmons[idx];
                mymons.Hp = mymons.Maxhp;
                enemy     = new monster();

                if (spawn == 1)
                {
                    battleDetails(enemy);
                }
                else if (spawn == 2)
                {
                    enemy.evolve();
                    battleDetails(enemy);
                }
                statPlayer(mymons);
                statEnemy(enemy);
                groupBox4.Enabled = true;
                groupBox5.Enabled = true;
            }
            else
            {
                MessageBox.Show("Pilih monster dulu!");
            }
        }
Example #3
0
        private void victory(monster mymons)
        {
            enemyNull();
            int reward = r.Next(1, 101);

            historyRtb.Text += mymons + " menang !!!" + "\n";
            historyRtb.Text += "---------------------------" + "\n";
            if (reward <= 10)
            {
                scroll          += 1;
                historyRtb.Text += mymons + " mendapat EXP sebesar 50, " + "Scroll sebanyak 1" + "\n";
            }
            else if (reward > 10)
            {
                int getmana = r.Next(5000, 8001);
                mana            += getmana;
                historyRtb.Text += mymons + " mendapat EXP sebesar 50, " + "Mana sebanyak " + getmana + "\n";
            }
            resource();
            mymons.Exp += 50;
            if (mymons.Exp >= mymons.Maxexp)
            {
                mymons.Exp    = 0;
                mymons.Level += 1;
                mymons.Maxexp = mymons.Level * 200;
                if (mymons.Level == 5)
                {
                    mymons.evolve();
                    statPlayer(mymons);
                    MessageBox.Show("Evolved");
                }
                if (mymons.Evolved == true)
                {
                    mymons.Maxhp += mymons.Level * 300;
                }
                else
                {
                    mymons.Maxhp += mymons.Level * 200;
                }
                mymons.Hp = mymons.Maxhp;
            }
        }