Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (button1.Text == "Combat")
     {
         des.Text     = "The oni yells prepare to DIE! He swings at you with his giant club!";
         button1.Text = "";
         button2.Text = "Block";
         button3.Text = "Dodge";
         button4.Text = "";
     }
     if (button1.Text == "Attack")
     {
         Random rnd    = new Random();
         int    attack = rnd.Next(1, 10);
         int    x      = attack + strength;
         if (x > 7)
         {
             des.Text     = "You hit the oni but he is Attacking you!";
             button1.Text = "";
             button2.Text = "Block";
             button3.Text = "Dodge";
             guard        = guard - 3;
             if (guard <= 0)
             {
                 bool r  = false;
                 win  xd = new win(r);
                 xd.Show();
                 Hide();
             }
         }
         else
         {
             des.Text     = "You missed and he is attacking you!";
             button1.Text = "";
             button2.Text = "Block";
             button3.Text = "Dodge";
         }
     }
     if (button1.Text == "Wolves")
     {
         des.Text     = "The oni says wrong answer and prepare to DIE! He swings his giant club\n at you!";
         button1.Text = "";
         button2.Text = "Block";
         button3.Text = "Dodge";
     }
 }
Exemple #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (button3.Text == "Dodge")
     {
         Random rnd   = new Random();
         int    Dodge = rnd.Next(1, 10);
         int    x     = Dodge + agil;
         if (x < 6)
         {
             des.Text    = "You weren't able to Dodge his attack and take three damage.";
             hel         = hel - 3;
             Health.Text = "" + hel;
             if (hel <= 0)
             {
                 Lose xd = new Lose();
                 xd.Show();
                 Hide();
             }
             button1.Text = "Attack";
             button2.Text = "";
             button3.Text = "";
         }
         else
         {
             des.Text     = "You dodged his attack.";
             button1.Text = "Attack";
             button2.Text = "";
             button3.Text = "";
         }
     }
     if (button3.Text == "Stars")
     {
         bool r  = true;
         win  xd = new win(r);
         xd.Show();
         Hide();
     }
 }