コード例 #1
0
 public void CheckPotion(Healing potion)
 {
     if (potion.ID == 8)
     {
         RaiseMessage("You feel woozy from drinking this.");
         List <int> listNumbers = new List <int>();
         int        number      = 0;
         int        shuffle     = -50 + (Strength + Endurance + Speed + Intelligence + Sight);
         for (int i = 5; i != 0; i--)
         {
             do
             {
                 number = RandomNumberGen.NumberBetween(1, 5);
             } while (listNumbers.Contains(number));
             listNumbers.Add(number);
             if (shuffle <= 0)
             {
                 shuffle = 0;
             }
             int random = RandomNumberGen.NumberBetween(0, shuffle);
             if (random >= 100)
             {
                 random = 100;
             }
             else if (random <= 0)
             {
                 random = 1;
             }
             if (number == 5)
             {
                 Strength = random + 10;
             }
             else if (number == 4)
             {
                 Endurance = random + 10;
             }
             else if (number == 3)
             {
                 Speed = random + 10;
             }
             else if (number == 2)
             {
                 Sight = random + 10;
             }
             else if (number == 1)
             {
                 Intelligence = random + 10;
             }
             shuffle = shuffle - random;
         }
     }
     //
     if (potion.ID == 9)
     {
         RaiseMessage("This should protect way better than those rags.");
         AC = 10;
     }
 }
コード例 #2
0
        //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
        public void UsePotion(Healing potion)
        {
            RaiseMessage("You drink a " + potion.Name);

            HealPlayer(potion.AmountToHeal);
            if (potion.Something == true)
            {
                CheckPotion(potion);
            }
            RemoveItemFromInventory(potion);
            if (CurrentMonster != null)
            {
                LetTheMonsterAttack();
            }
        }
コード例 #3
0
 //////
 private void Inventor_Click(object sender, EventArgs e)
 {//use item
     if (Inventor.Text == "Medic")
     {
         //Player.CreateDefaultPlayer("M");
         textBox1.Text = "To Move with wasd." + Environment.NewLine;
         Start(true, this);
     }
     else
     {
         Healing potion = (Healing)cobpotion.SelectedItem;
         _player.UsePotion(potion);
         if (!_player.Potions.Any())
         {
             cobpotion.Visible = false;
             Inventor.Enabled  = false;
         }
     }
 }