예제 #1
0
        public void PickItem(int num)
        {
            Item item = currentRoom.GetRoomItems()[num];

            if (item.GetType().BaseType == typeof(ItemEquipable))
            {
                if (!FilledGemas() && item.GetType() == typeof(ItemGema))
                {
                    for (int i = 0; i < gemas.Length; i++)
                    {
                        if (gemas[i] == null)
                        {
                            gemas[i] = (ItemGema)currentRoom.DropItem(num);
                            Program.buffer.InsertText("Te has equipado " + item.GetName());
                            i = bag.Length;
                        }
                    }
                }
                else if (GetWeapon() == null && item.GetType() == typeof(ItemWeapon))
                {
                    arma = (ItemWeapon)currentRoom.DropItem(num);
                    Program.buffer.InsertText("Te has equipado " + item.GetName());
                }
                else if (GetArmor() == null && item.GetType() == typeof(ItemArmor))
                {
                    armadura = (ItemArmor)currentRoom.DropItem(num);
                    Program.buffer.InsertText("Te has equipado " + item.GetName());
                }
                else if (!FilledBag())
                {
                    for (int i = 0; i < bag.Length; i++)
                    {
                        if (bag[i] == null)
                        {
                            bag[i] = currentRoom.DropItem(num);
                            Program.buffer.InsertText("Has guardado en la mochila " + item.GetName());
                            i = bag.Length;
                        }
                    }
                }
                else
                {
                    Program.buffer.InsertText("Tienes la mochila llena");
                }
            }
            else
            {
                if (!FilledBag())
                {
                    for (int i = 0; i < bag.Length; i++)
                    {
                        if (bag[i] == null)
                        {
                            bag[i] = currentRoom.DropItem(num);
                            Program.buffer.InsertText("Has guardado en la mochila " + item.GetName());
                            i = bag.Length;
                        }
                    }
                }
                else
                {
                    Program.buffer.InsertText("Tienes la mochila llena");
                }
            }
        }