コード例 #1
0
    protected override void OnCreateCopy(InventoryItem addComponent)
    {
        HealingPotion healingPotion = (HealingPotion)addComponent;

        healingPotion.HealingPoints = HealingPoints;
        healingPotion.used          = used;
    }
コード例 #2
0
ファイル: Test_Item.cs プロジェクト: GuidoBekkers/STVRogue
        [TestCase("id5", int.MinValue)] // Check negative big heal value
        public void Test_HealingPotion_Constructor(String id, int healVal)
        {
            // Create the healing potion variable
            HealingPotion hPotion = null;

            // Create an exception variable, for debugging
            Exception exc = null;

            // Pre-Condition
            if (healVal <= 0)
            {
                // Check if the constructor throws an exception when the healing value is <= 0
                Assert.Throws <ArgumentException>(() => new HealingPotion(id, healVal));
            }
            // Post-Condition
            else
            {
                // Try creating the healing potion
                try
                {
                    hPotion = new HealingPotion(id, healVal);
                }
                catch (Exception e)
                {
                    exc = e;
                }

                // Check if the potion was actually made
                Assert.IsTrue(hPotion != null);

                // Check if the healing value was correctly set
                Assert.IsTrue(hPotion.HealValue == healVal);
            }
        }
コード例 #3
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            // Get the currently selected potion from the combobox
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            _player.UsePotion(potion);
        }
コード例 #4
0
        private void btnUsePotion_Click_1(object sender, EventArgs e)
        {
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            _player.CurrentHitPoints = (_player.CurrentHitPoints + potion.AmountToHeal);

            if (_player.CurrentHitPoints > _player.MaximumHitPoints)
            {
                _player.CurrentHitPoints = _player.MaximumHitPoints;
            }

            _player.RemoveItemFromInventory(potion, 1);
            _player.RaiseInventoryChangedEvent(potion);

            rtbMessages.Text += "You drink a " + potion.Name + Environment.NewLine;

            int damageToPlayer = RandomNumberGenerator.NumberBetween(0, _currentMonster.MaximumDamage);

            _player.CurrentHitPoints -= damageToPlayer;

            rtbMessages.Text          += "The " + _currentMonster.Name + " did " + damageToPlayer.ToString() + " damage to you" + Environment.NewLine;
            rtbMessages.SelectionStart = rtbMessages.Text.Length;
            rtbMessages.ScrollToCaret();

            if (_player.CurrentHitPoints <= 0)
            {
                rtbMessages.Text += "The " + _currentMonster.Name + " killed you." + Environment.NewLine;
                MoveTo(World.LocationByID(World.LOCATION_ID_HOME));
                rtbMessages.SelectionStart = rtbMessages.Text.Length;
                rtbMessages.ScrollToCaret();
            }
        }
コード例 #5
0
ファイル: ConsoleProgram.cs プロジェクト: Beamer64/RPG
        private static void DrinkPotion(string input)
        {
            Console.WriteLine("");
            string inputPotionName = input.Substring(6).Trim();

            if (string.IsNullOrEmpty(inputPotionName))
            {
                Console.WriteLine("You must enter the name of the potion to drink");
            }
            else
            {
                HealingPotion potionToDrink =
                    _player.Potions.SingleOrDefault(
                        x => x.Name.ToLower() == inputPotionName || x.NamePlural.ToLower() == inputPotionName);

                if (potionToDrink == null)
                {
                    Console.WriteLine("You do not have the potion: {0}", inputPotionName);
                }
                else
                {
                    _player.UsePotion(potionToDrink);
                }
            }
        }
コード例 #6
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            _player.CurrentHitPoints += potion.AmountToHeal;
            if (_player.CurrentHitPoints > _player.MaximumHitPoints)
            {
                _player.CurrentHitPoints = _player.MaximumHitPoints;
            }

            // remove potion from inventory

            /*for (int i = 0; i < _player.Inventory.Count; i++)
             * {
             *  if (_player.Inventory[i].Details.ID == potion.ID)
             *  {
             *      if (_player.Inventory[i].Quantity > 1)
             *      {
             *          _player.Inventory[i].Quantity -= 1;
             *      }
             *      else
             *      {
             *          _player.Inventory.RemoveAt(i);
             *      }
             *      break;
             *  }
             * }*/
            _player.RemoveItemFromInventory(potion, 1);
            // Display message
            rtbMessages.Text += "You drink a " + potion.Name + Environment.NewLine;
            // UpdatePotionListInUI();
            _player.MonsterAttack();
        }
コード例 #7
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            // use potion
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            _player.UsePotion(potion);
        }
コード例 #8
0
        public void PlayerIsHealedWhenHealthPotionUsedTest()
        {
            int    currentHitPoints       = 100;
            int    maximumHitPoints       = 1000;
            int    gold                   = 99;
            int    experiencePoints       = 500;
            int    level                  = 60;
            int    itemId                 = 1;
            int    hpId                   = 7;
            string hpName                 = "HP";
            string hpNamePlural           = "HPs";
            int    hpPower                = 123;
            int    expectedHpAfterHealing = 223;
            Player createPlayer           = new Player(currentHitPoints,
                                                       maximumHitPoints,
                                                       gold,
                                                       experiencePoints,
                                                       level);
            HealingPotion healingPotion = new HealingPotion(hpId, hpName, hpNamePlural, hpPower);

            createPlayer.AddItemToInventory(healingPotion);
            createPlayer.CurrentHitPoints = 100;
            int actualHpAfterHealing = createPlayer.CurrentHitPoints + healingPotion.AmountToHeal;

            Assert.AreEqual(expectedHpAfterHealing, actualHpAfterHealing);
        }
コード例 #9
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            _player.CurrentHitPoints = (_player.CurrentHitPoints + potion.AmountToHeal);

            if (_player.CurrentHitPoints > _player.MaximumHitPoints)
            {
                _player.CurrentHitPoints = _player.MaximumHitPoints;
            }

            _player.RemoveItemFromInventory(potion);

            rtbMessages.Text += "You drink a " + potion.Name + Environment.NewLine;

            // Monster's turn
            int damageToPlayer = RandomNumberGenerator.NumberBetween(0, _currentMonster.MaximumDamage);

            rtbMessages.Text += "The " + _currentMonster.Name + " did " + damageToPlayer.ToString() + " points of damage." + Environment.NewLine;

            _player.CurrentHitPoints -= damageToPlayer;

            if (_player.CurrentHitPoints <= 0)
            {
                rtbMessages.Text += "The " + _currentMonster.Name + " killed you." + Environment.NewLine;
                MoveTo(World.LocationByID(World.LOCATION_ID_HOME));
            }

            ScrollToBottomOfMessages();
        }
コード例 #10
0
ファイル: Test_Item.cs プロジェクト: GuidoBekkers/STVRogue
        [TestCase(1, 1, 1)] // Check the player being healed while at exactly max HP
        public void Test_HealingPotion_Use(int healVal, int playerStartHp, int playerMaxHp)
        {
            // Create an exception variable, for debugging
            Exception exc = null;

            // Create the healing potion
            HealingPotion hPotion = new HealingPotion("potionId", healVal);

            // TODO: implement actual player constructor
            // Create the player
            Player player = new Player("playerId", "playerName", playerMaxHp, 1);

            // Set the players' attributes
            player.Hp = playerStartHp;

            // Add the potion to the players' bag
            player.Bag.Add(hPotion);

            // Try using the potion
            try
            {
                hPotion.Use(player);
            }
            catch (Exception e)
            {
                exc = e;
            }

            // Post-Conditions
            // Check that the player's hp has not exceeded it's max hp
            Assert.IsTrue(player.Hp <= player.HpMax);

            // Check that the player has been healed the appropriate amount, or got capped at the max hp
            Assert.IsTrue(player.Hp == playerStartHp + hPotion.HealValue || player.Hp == player.HpMax);
        }
コード例 #11
0
        private void BtnUsePotion_Click(object sender, EventArgs e)
        {
            // get the currently selected potion from the combobox
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            potion.HealPlayer(potion, _player);
            rtbMessages.Text += "You drink a " + potion.Name + Environment.NewLine;

            int damageToPlayer = RandomNumberGenerator.NumberBetween(0, _currentMonster.MaximumDamage);

            rtbMessages.Text += "The " + _currentMonster.Name + " did " + damageToPlayer.ToString() + " damage to you!" + Environment.NewLine;

            _player.CurrenthitPoints -= damageToPlayer;

            lblHitPoints.Text = _player.CurrenthitPoints.ToString();

            if (_player.CurrenthitPoints <= 0)
            {
                rtbMessages.Text += "The " + _currentMonster.Name + " killed you..." + Environment.NewLine;

                MoveTo(World.LocationByID(World.LOCATION_ID_HOME));
            }

            lblHitPoints.Text = _player.CurrenthitPoints.ToString();
            UpdateInventoryListInUI();
            UpdatePotionListInUI();
        }
コード例 #12
0
        private void btnUseItem_Click(object sender, EventArgs e)
        {
            SecondaryItem secondaryItem = ((SecondaryItem)cboSecondaryItem.SelectedItem);

            if (secondaryItem.isPotion == true)
            {
                // Get the currently selected potion from the combobox
                HealingPotion potion = (HealingPotion)cboSecondaryItem.SelectedItem;

                if (potion.MinLevel > _player.Level)
                {
                    _player.RaiseMessage("You can't drink this potion.");
                    _player.RaiseMessage("You need to be level " + potion.MinLevel + ".");
                    return;
                }
                _player.UsePotion(potion);
            }
            else if (secondaryItem.isMagic == true)
            {
                DamageMagicScroll scroll = (DamageMagicScroll)secondaryItem;

                if (scroll.MinLevel > _player.Level)
                {
                    _player.RaiseMessage("You can't cast this spell.");
                    _player.RaiseMessage("You need to be level " + scroll.MinLevel + ".");
                    return;
                }
                _player.UseScroll(scroll);
            }

            else
            {
                _player.RaiseMessage("Bug: This item isn't an item type at all!");
            }
        }
コード例 #13
0
        /// <summary>
        /// use potion click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uxUsePotion_Click(object sender, EventArgs e)
        {
            //get the currently selected potion from the uxPotionBox
            HealingPotion potion = (HealingPotion)uxPotionsBox.SelectedItem;

            _player.UsePotion(potion);
        }
コード例 #14
0
        private void BtnUsePotion_Click(object sender, EventArgs e)
        {
            // Get the currently selected potion from the combobox
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            // Add healing amount to the player's current hit points
            _player.CurrentHitPoints = (_player.CurrentHitPoints + potion.AmountToHeal);

            // CurrentHitPoints cannot exceed player's MaximumHitPoints
            if (_player.CurrentHitPoints > _player.MaximumHitPoints)
            {
                _player.CurrentHitPoints = _player.MaximumHitPoints;
            }

            // Remove the potion from the player's inventory
            foreach (InventoryItem ii in _player.Inventory)
            {
                if (ii.Details.ID == potion.ID)
                {
                    ii.Quantity--;
                    break;
                }
            }

            // Display message
            rtbMessages.Text += "You drink a " + potion.Name + Environment.NewLine;

            MonsterAttack();

            // Refresh player data in UI
            lblHitPoints.Text = _player.CurrentHitPoints.ToString();
            ScrollMessagesToBottom();
        }
コード例 #15
0
ファイル: Test_Player.cs プロジェクト: GuidoBekkers/STVRogue
        public void Test_PlayerUse()
        {
            // Instance the player object
            Player p = new Player("pId", "Player", 2, 1);

            // Instance a rage potion
            RagePotion ragePotion = new RagePotion("rPotionId");

            // Instance a healing potion
            HealingPotion healingPotion = new HealingPotion("hPotionId", 1);

            // Add the items to the player's bag
            p.Bag.Add(ragePotion);
            p.Bag.Add(healingPotion);

            // Test the rage potion use
            p.Use(ragePotion);

            // Check if the player became enraged
            Assert.IsTrue(p.Enraged);

            // Set the player's health to 1
            p.Hp = 1;

            // Test the healing potion use
            p.Use(healingPotion);

            // Check if the player was healed and that the max health was not exceeded
            Assert.IsTrue(p.Hp == 2 && p.Hp <= p.HpMax);
        }
コード例 #16
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            // get the combobox selected potion
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            // add heal amnt to player hp
            _player.CurrentHitPoints += potion.AmountHeal;

            // hp can't exceed max
            if (_player.CurrentHitPoints > _player.MaxHitPoints)
            {
                _player.CurrentHitPoints = _player.MaxHitPoints;
            }

            // remove potion from inv
            foreach (InventoryItem ii in _player.Inventory)
            {
                if (ii.Details.ID == potion.ID)
                {
                    ii.Quantity--;
                    break;
                }
            }

            // display msg
            rtbMessages.Text += "You drink a " + potion.Name + Environment.NewLine;

            MonsterAttack(_currentMonster, _player);
            ScrollToBottomOfMessages();
        }
コード例 #17
0
ファイル: AdventureGameForm.cs プロジェクト: Abkenn/RPG-Game
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            // 3.1) Вземи текущия избран potion
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            player.UsePotion(potion);
        }
コード例 #18
0
ファイル: HealingPotionTests.cs プロジェクト: elisew111/STV
        public void TestHasHealingPotionFalse()
        {
            Player        player        = new Player("player");
            HealingPotion healingPotion = new HealingPotion("potion", 5);

            Assert.IsFalse(healingPotion.hasHealingPotion(player));
        }
コード例 #19
0
ファイル: AdventureTime.cs プロジェクト: Aledes/rpggame
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            //Get the currently selected potion from combobox
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            //Add healing amount to player's current HP
            _player.CurrentHitPoints = (_player.CurrentHitPoints + potion.AmountToHeal);

            // Current HP cannot exceed max HP
            if (_player.CurrentHitPoints > _player.MaximumHitPoints)
            {
                _player.CurrentHitPoints = _player.MaximumHitPoints;
            }

            //Remove the potion from the player's inventory
            foreach (InventoryItem ii in _player.Inventory)
            {
                if (ii.Details.ID == potion.ID)
                {
                    ii.Quantity--;
                    break;
                }
            }

            //Display message
            rtbMessages.Text += "You drink a " + potion.Name + Environment.NewLine;

            //Monster gets their turn to attack
            MonsterAttack();
        }
コード例 #20
0
 private static void ResolveDeath(Actor attacker, Actor defender)
 {
     if (defender is Player)
     {
         PlayerIsDead = true;
         KilledBy     = attacker.Name;
     }
     else if (defender is Monster)
     {
         if (defender is Dragon)
         {
             IsGameEnded = true;
         }
         Game.Player.Gold += defender.Gold;
         Game.Player.Kills++;
         Game.DungeonMap.RemoveMonster((Monster)defender);
         if (Dice.Roll("1D10") > 9)
         {
             HealingPotion hp = new HealingPotion(defender.X, defender.Y);
             Game.DungeonMap.Items.Add(hp);
             Game.MessageLog.Add($"  {defender.Name} died and dropped {defender.Gold} gold, you noticed a red bottle in its pocket");
         }
         Game.MessageLog.Add($"  {defender.Name} died and dropped {defender.Gold} gold");
     }
 }
コード例 #21
0
        private void UpdatertbLocation()
        {
            rtbLocation.Text = _player.CurrentLocation.Name + Environment.NewLine + _player.CurrentLocation.Description + Environment.NewLine;
            if (_player.CurrentLocation.MonsterLivingHere != null)
            {
                rtbLocation.Text += _currentMonster.Name + ":" + Environment.NewLine;
                rtbLocation.Text += "Max damage: " + _currentMonster.MaximumDamage + Environment.NewLine + "Min damage: " + _currentMonster.MinimumDamage + Environment.NewLine;
                rtbLocation.Text += "Hit points: " + _currentMonster.CurrentHitPoints + Environment.NewLine;
            }
            if (_player.CurrentLocation is Shop & _currentShopItem != null)
            {
                rtbLocation.Text += _currentShopItem.Name + ":" + Environment.NewLine;
                rtbLocation.Text += "Costs " + _currentShopItem.Value + " gold. Can be sold for " + _currentShopItem.Value / 2 + " gold." + Environment.NewLine;
                string type = _currentShopItem.GetType().ToString();

                switch (type)
                {
                case "Engine.Armor":
                    Armor armor = (Armor)_currentShopItem;
                    rtbLocation.Text += "Strength: " + armor.Strength + Environment.NewLine;
                    break;

                case "Engine.HealingPotion":
                    HealingPotion healingPotion = (HealingPotion)_currentShopItem;
                    rtbLocation.Text += "Healing amount: " + healingPotion.AmountToHeal + Environment.NewLine;
                    break;

                case "Engine.Weapon":
                    Weapon weapon = (Weapon)_currentShopItem;
                    rtbLocation.Text += "Minimum damage: " + weapon.MinimumDamage + Environment.NewLine;
                    rtbLocation.Text += "Maximum damage: " + weapon.MaximumDamage + Environment.NewLine;
                    break;
                }
            }
        }
コード例 #22
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            //Get the currently selected potion from the combobox
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            //Randomize Healing amount
            int amountToHeal = RandomNumberGenerator.NumberBetween(potion.AmountToHeal, potion.AmountToHeal + 3);

            //Add healing amount to the player's current hitpoint
            _player.CurrentHitPoints = (_player.CurrentHitPoints + amountToHeal);

            //CurrentHitPoints cannot exceed player's MaximumHitPoints
            if (_player.CurrentHitPoints < _player.MaximumHitPoints)
            {
                _player.CurrentHitPoints = _player.CurrentHitPoints;
            }

            //remove the potion from the player's inventory
            foreach (InventoryItem ii in _player.Inventory)
            {
                if (ii.Details.ID == potion.ID)
                {
                    ii.Quantity--;
                    break;
                }
            }

            //Display message
            rtbMessages.Text += "You drink a " + potion.Name + " and regain " + amountToHeal + " Hit Points." + Environment.NewLine;

            //Monster gets their turn to attack

            //Determine the amount of damage the monster does to the player
            int damageToPlayer = _currentMonster.CalculateDamage(_currentMonster.MaximumDamage);

            //If monster misses
            if (damageToPlayer == 0)
            {
                rtbMessages.Text += "The " + _currentMonster.Name + " misses you." + Environment.NewLine;
            }

            //display DAMAGE message
            rtbMessages.Text += "The " + _currentMonster.Name + " hits you for " + damageToPlayer + " point of damage." + Environment.NewLine;

            //substract the damage from the player's current hitpoint
            _player.CurrentHitPoints -= damageToPlayer;

            //See if player is dead
            if (!_player.isAlive())
            {
                //display message
                rtbMessages.Text += "The " + _currentMonster.Name + " killed you." + Environment.NewLine;

                //Move player to "Home"
                MoveTo(World.LocationByID(World.LOCATION_ID_HOME));
            }

            //Refresh the player's data in UI
            UpdateUI();
        }
コード例 #23
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            // Get the currently selected potion from the combobox
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            // Add healing amount to the player's current hit points
            _player.CurrentHitPoints = (_player.CurrentHitPoints + potion.AmountToHeal);

            // CurrentHitPoints cannot exceed player's MaximumHitPoints
            if (_player.CurrentHitPoints > _player.MaximumHitPoints)
            {
                _player.CurrentHitPoints = _player.MaximumHitPoints;
            }

            // Remove the potion from the player's inventory
            foreach (InventoryItem ii in _player.Inventory)
            {
                if (ii.Details.Id == potion.Id)
                {
                    ii.Quantity--;
                    break;
                }
            }

            // Display message
            rtbMessages.Focus();
            rtbMessages.AppendText("You drink a " + potion.Name + Environment.NewLine);
            rtbMessages.ScrollToCaret();

            // Monster gets their turn to attack

            // Determine the amount of damage the monster does to the player
            int damageToPlayer = RandomNumberGenerator.NumberBetween(0, _currentMonster.MaximumDamage);

            // Display message
            rtbMessages.Focus();
            rtbMessages.AppendText("The " + _currentMonster.Name + " did " + damageToPlayer.ToString() +
                                   " points of damage." + Environment.NewLine);
            rtbMessages.ScrollToCaret();

            // Subtract damage from player
            _player.CurrentHitPoints -= damageToPlayer;

            if (_player.CurrentHitPoints <= 0)
            {
                // Display message
                rtbMessages.Focus();
                rtbMessages.AppendText("The " + _currentMonster.Name + " killed you." + Environment.NewLine);
                rtbMessages.ScrollToCaret();

                // Move player to "Home"
                MoveTo(World.LocationById(World.LocationIdHome));
            }

            // Refresh player data in UI
            lblHitPoints.Text = _player.CurrentHitPoints.ToString();
            UpdateInventoryListInUi();
            UpdatePotionListInUi();
        }
コード例 #24
0
ファイル: ItemString.cs プロジェクト: McPalm/FEPonies
    /// <summary>
    /// Takes an itemname a string and returns an Item
    /// </summary>
    /// <param name="itemName">The string that is to be translated</param>
    /// <returns></returns>
    public static Item StringToItem(string itemName)
    {
        //TODO actually making this thing translate strings to items
        Item rv = new HealingPotion();

        rv.Name = "TestPotion";
        return(rv);
    }
コード例 #25
0
ファイル: HealingPotionTests.cs プロジェクト: elisew111/STV
        public void TestHasHealingPotionTrue()
        {
            Player        player        = new Player("player");
            HealingPotion healingPotion = new HealingPotion("potion", 5);

            player.bag.Add(healingPotion);
            Assert.IsTrue(healingPotion.hasHealingPotion(player));
        }
コード例 #26
0
        public void CanAddItemToBackPack()
        {
            var  backpack = new BackPack();
            var  hp       = new HealingPotion();
            bool isAdded  = backpack.AddItem(hp);

            Assert.IsTrue(isAdded);
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: dwachtel10/SWCProjects
        public static void PotionString()
        {
            HealingPotion potion = new HealingPotion();

            // Because HealingPotion doesn't have a ToString override
            // The Item class is checked and since it does, it uses that.
            Console.WriteLine(potion);
        }
コード例 #28
0
        public void HealingPotion_Constructor()
        {
            HealingPotion potion = new HealingPotion("HealingPotion1");

            Assert.IsTrue(potion.HPvalue >= 1 && potion.HPvalue <= 10);

            Assert.AreEqual("HealingPotion1", potion.id);
            Assert.IsFalse(potion.used);
        }
コード例 #29
0
        void Visit(HealingPotion healingPotion)
        {
            if (Life > healingPotion.Life)
            {
                return;
            }

            Life = healingPotion.Life;
        }
コード例 #30
0
        private void btnUsePotion_Click(object sender, EventArgs e)
        {
            // Получить текущее исцеляющее зелье из комбобокса
            HealingPotion potion = (HealingPotion)cboPotions.SelectedItem;

            // Добавить количество исцеленного здоровья
            player.CurrentHitPoints = (player.CurrentHitPoints + potion.AmountToHeal);

            // Здоровье не может превышать максимума
            if (player.CurrentHitPoints > player.MaximumHitPoints)
            {
                player.CurrentHitPoints = player.MaximumHitPoints;
            }

            // Удалить использованное исцеляющее зелье из инвенторя
            foreach (InventoryItem ii in player.Inventory)
            {
                if (ii.Details.ID == potion.ID)
                {
                    ii.Quantity--;
                    break;
                }
            }

            // Показать сообщение
            rtbMessages.Text += "Вы выпили " + potion.Name + Environment.NewLine;
            ScrollToBottomOfMessages();

            // Ход монстра

            // Определить наносимый урон игроку
            int damageToPlayer = RandomNumberGenerator.NumberBetween(0, currentMonster.MaximumDamage);

            // Показать сообщение
            rtbMessages.Text += currentMonster.Name + " нанес " + damageToPlayer.ToString() +
                                " очков урона." + Environment.NewLine;
            ScrollToBottomOfMessages();

            // Вычесть нанесенный урон игроку
            player.CurrentHitPoints -= damageToPlayer;

            if (player.CurrentHitPoints <= 0)
            {
                // Показать сообщение
                rtbMessages.Text += currentMonster.Name + " убил вас." + Environment.NewLine;
                ScrollToBottomOfMessages();

                // Перенести игрока домой
                MoveTo(World.LocationByID(World.LOCATION_ID_HOME));
            }

            // Обновить информацию об игроке
            lblHitPoints.Text = player.CurrentHitPoints.ToString();
            UpdateInventoryListInUI();
            UpdatePotionListInUI();
        }