public ItemArmor DropArmor() { ItemArmor temp = armadura; armadura = null; return(temp); }
public Player() { level = 1; Experiencia = 0; for (int i = 0; i < 5; i++) { bag[i] = new ItemPocion("Poción de vida", 50, ItemPocion.PocionType.hp); } armadura = new ItemArmor("Armadura Simple", 45); hpM = ((400 * level / 100 + 20) * (10 - excesoMaldito)) / 10; hp = hpM; att = 200 * level / 100 + 5; def = 200 * level / 100 + 5; speed = 200 * level / 100 + 5; mana = 10; manaM = 10; hitPerc = 0.1f; avoidPerc = armadura.GetAvoidPercFloat(); }
public void EquipItem(int num) { Item item = bag[num]; if (item.GetType().BaseType == typeof(ItemEquipable)) { if (item.GetType() == typeof(ItemWeapon)) { if (arma == null) { ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); arma = (ItemWeapon)item; bag[num] = null; } else { ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); ConsoleBuffer.ObteBuffer().InsertText("Te has desequipado " + arma.GetName()); ItemWeapon temp = arma; arma = (ItemWeapon)item; bag[num] = temp; } } else if (item.GetType() == typeof(ItemGema)) { bool check = true; for (int i = 0; i < gemas.Length; i++) { if (gemas[i] == null) { ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); gemas[i] = (ItemGema)item; bag[num] = null; i = bag.Length; check = false; } } if (check) { ConsoleBuffer.ObteBuffer().InsertText("¿Que gema quieres desequiparte?"); ListOfGems(); ConsoleBuffer.ObteBuffer().PrintBackground(); ConsoleBuffer.ObteBuffer().PrintText(ConsoleBuffer.ObteBuffer().height - 3); ConsoleBuffer.ObteBuffer().Print(1, 0, "PRINCIPAL"); ConsoleBuffer.ObteBuffer().Print(1, ConsoleBuffer.ObteBuffer().height - 2, ">"); ConsoleBuffer.ObteBuffer().SmallMap(); ConsoleBuffer.ObteBuffer().PrintScreen(); Console.SetCursorPosition(2, ConsoleBuffer.ObteBuffer().height - 2); bool obj = int.TryParse(Console.ReadLine(), out int num1); if (obj && num1 >= 0 && num1 < gemas.Length && gemas[num1] != null) { ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); ConsoleBuffer.ObteBuffer().InsertText("Te has desequipado " + item.GetName()); ItemGema temp = gemas[num1]; gemas[num1] = (ItemGema)item; bag[num] = temp; } else if (!obj) { ConsoleBuffer.ObteBuffer().InsertText("Tiene que ser un numero"); } else { ConsoleBuffer.ObteBuffer().InsertText("Esa posicion no es válida"); } } } else if (item.GetType() == typeof(ItemArmor)) { if (armadura == null) { ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); armadura = (ItemArmor)bag[num]; bag[num] = null; } else { ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); ConsoleBuffer.ObteBuffer().InsertText("Te has desequipado " + armadura.GetName()); ItemArmor temp = armadura; armadura = (ItemArmor)item; bag[num] = temp; } } } else { ConsoleBuffer.ObteBuffer().InsertText("Este objeto no es equipable"); } }
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); ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); i = bag.Length; } } } else if (GetWeapon() == null && item.GetType() == typeof(ItemWeapon)) { arma = (ItemWeapon)currentRoom.DropItem(num); ConsoleBuffer.ObteBuffer().InsertText("Te has equipado " + item.GetName()); } else if (GetArmor() == null && item.GetType() == typeof(ItemArmor)) { armadura = (ItemArmor)currentRoom.DropItem(num); ConsoleBuffer.ObteBuffer().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); ConsoleBuffer.ObteBuffer().InsertText("Has guardado en la mochila " + item.GetName()); i = bag.Length; } } } else { ConsoleBuffer.ObteBuffer().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); ConsoleBuffer.ObteBuffer().InsertText("Has guardado en la mochila " + item.GetName()); i = bag.Length; } } } else { ConsoleBuffer.ObteBuffer().InsertText("Tienes la mochila llena"); } } }