public static bool Desequipar() { if (Program.ObteJuego().pl.FilledBag()) { ConsoleBuffer.ObteBuffer().InsertText("Tienes la mochila llena"); return(false); } else { ConsoleBuffer.ObteBuffer().InsertText("¿Que quieres desequiparte?"); ConsoleBuffer.ObteBuffer().InsertText(" >ARMA >GEMA >ARMADURA"); ConsoleBuffer.ObteBuffer().Print(1, ConsoleBuffer.ObteBuffer().height - 2, ">"); ConsoleBuffer.ObteBuffer().PrintBackground(); ConsoleBuffer.ObteBuffer().PrintText(ConsoleBuffer.ObteBuffer().height - 3); ConsoleBuffer.ObteBuffer().SmallMap(); ConsoleBuffer.ObteBuffer().PrintScreen(); Console.SetCursorPosition(2, ConsoleBuffer.ObteBuffer().height - 2); string tipo = Console.ReadLine().ToLower(); if (tipo.Equals("arma")) { if (Program.ObteJuego().pl.GetWeapon() != null) { for (int i = 0; i < Program.ObteJuego().pl.GetBag().Length; i++) { if (Program.ObteJuego().pl.GetBag()[i] == null) { Item rr = Program.ObteJuego().pl.DropWeapon(); ConsoleBuffer.ObteBuffer().InsertText("Te has desequipado " + rr.GetName()); Program.ObteJuego().pl.GetBag()[i] = rr; i = Program.ObteJuego().pl.GetBag().Length; } } return(true); } else { ConsoleBuffer.ObteBuffer().InsertText("No tienes arma equipada"); return(false); } } else if (tipo.Equals("gema")) { if (Program.ObteJuego().pl.EmptyGemas()) { ConsoleBuffer.ObteBuffer().InsertText("No tienes gemas equipadas"); return(false); } else { ConsoleBuffer.ObteBuffer().InsertText("¿Que gema quieres desequiparte?"); Program.ObteJuego().pl.ListOfGems(); ConsoleBuffer.ObteBuffer().Print(1, ConsoleBuffer.ObteBuffer().height - 2, ">"); ConsoleBuffer.ObteBuffer().PrintBackground(); ConsoleBuffer.ObteBuffer().PrintText(ConsoleBuffer.ObteBuffer().height - 3); ConsoleBuffer.ObteBuffer().PrintScreen(); Console.SetCursorPosition(2, ConsoleBuffer.ObteBuffer().height - 2); bool obj = int.TryParse(Console.ReadLine().ToLower(), out int gema); if (obj && gema >= 0 && gema < Program.ObteJuego().pl.GetGemas().Length&& Program.ObteJuego().pl.GetGemas()[gema] != null) { ItemGema r = Program.ObteJuego().pl.GetGemas()[gema]; Program.ObteJuego().pl.GetGemas()[gema] = null; for (int i = 0; i < Program.ObteJuego().pl.GetBag().Length; i++) { if (Program.ObteJuego().pl.GetBag()[i] == null) { Program.ObteJuego().pl.GetBag()[i] = r; ConsoleBuffer.ObteBuffer().InsertText("Te has desequipado '" + r.GetName() + "'"); i = Program.ObteJuego().pl.GetBag().Length; } } return(true); } else if (obj) { ConsoleBuffer.ObteBuffer().InsertText("Tiene que ser un número"); } else { ConsoleBuffer.ObteBuffer().InsertText("El número no es válido"); } return(false); } } else if (tipo.Equals("armadura")) { if (Program.ObteJuego().pl.GetArmor() != null) { for (int i = 0; i < Program.ObteJuego().pl.GetBag().Length; i++) { if (Program.ObteJuego().pl.GetBag()[i] == null) { Item rr = Program.ObteJuego().pl.DropArmor(); ConsoleBuffer.ObteBuffer().InsertText("Te has desequipado " + rr.GetName()); Program.ObteJuego().pl.GetBag()[i] = rr; i = Program.ObteJuego().pl.GetBag().Length; } } return(true); } else { ConsoleBuffer.ObteBuffer().InsertText("No tienes armadura equipada"); return(false); } } else { ConsoleBuffer.ObteBuffer().InsertText("Comando no válido"); return(false); } } }
public static bool LookAtBag() { Item[] bag = Program.pl.GetBag(); for (int i = 0; i < bag.Length; i++) { int ii = i; int x = 0; if (ii >= 5) { ii -= 5; x = 1; } if (bag[i] != null) { if (bag[i].GetType() == typeof(ItemArmor)) { ItemArmor equipo = (ItemArmor)bag[i]; Program.buffer.Print(1 + 50 * x, 2 + ii * 3, equipo.GetName()); string texto = ""; if (equipo.ModifierHp() < 0) { texto += "HP(" + equipo.ModifierHp() + ") "; } else { texto += "HP(+" + equipo.ModifierHp() + ") "; } if (equipo.ModifierDef() < 0) { texto += "DEF(" + equipo.ModifierDef() + ") "; } else { texto += "DEF(+" + equipo.ModifierDef() + ") "; } if (equipo.GetAvoidPercInt() < 0) { texto += "DEF PROB.(" + equipo.GetAvoidPercInt() + ")"; } else { texto += "DEF PROB.(+" + equipo.GetAvoidPercInt() + ")"; } Program.buffer.Print(5 + 50 * x, 3 + ii * 3, texto); } else if (bag[i].GetType() == typeof(ItemWeapon)) { ItemWeapon equipo = (ItemWeapon)bag[i]; Program.buffer.Print(1 + 50 * x, 2 + ii * 3, equipo.GetName()); string texto = ""; if (equipo.ModifierAtt() < 0) { texto += "ATT(" + equipo.ModifierAtt() + ") "; } else { texto += "ATT(+" + equipo.ModifierAtt() + ") "; } if (equipo.ModifierAttM() < 0) { texto += "ATT M.(" + equipo.ModifierAttM() + ") "; } else { texto += "ATT M.(+" + equipo.ModifierAttM() + ") "; } if (equipo.GetHitPercInt() < 0) { texto += "ATT PROB.(" + equipo.GetHitPercInt() + ")"; } else { texto += "ATT PROB.(+" + equipo.GetHitPercInt() + ")"; } Program.buffer.Print(5 + 50 * x, 3 + ii * 3, texto); } else if (bag[i].GetType() == typeof(ItemGema)) { ItemGema equipo = (ItemGema)bag[i]; Program.buffer.Print(1 + 50 * x, 2 + ii * 3, equipo.GetName()); string texto = ""; if (equipo.ModifierHp() < 0) { texto += "HP(" + equipo.ModifierHp() + ") "; } else { texto += "HP(+" + equipo.ModifierHp() + ") "; } if (equipo.ModifierAttM() < 0) { texto += "ATT M.(" + equipo.ModifierAttM() + ") "; } else { texto += "ATT M.(+" + equipo.ModifierAttM() + ") "; } if (equipo.ModifierManaM() < 0) { texto += "MANA M.(" + equipo.ModifierManaM() + ")"; } else { texto += "MANA M.(+" + equipo.ModifierManaM() + ")"; } Program.buffer.Print(5 + 50 * x, 3 + ii * 3, texto); } else if (bag[i].GetType() == typeof(ItemPocion)) { ItemPocion consumable = (ItemPocion)bag[i]; Program.buffer.Print(1 + 50 * x, 2 + ii * 3, consumable.GetName()); if (consumable.GetPocionType() == ItemPocion.PocionType.hp) { Program.buffer.Print(1 + 50 * x, 3 + ii * 3, " +" + consumable.GetFlatCant().ToString() + "% HP"); } else { Program.buffer.Print(1 + 50 * x, 3 + ii * 3, " +" + consumable.GetFlatCant().ToString() + "% Mana"); } } else { Program.buffer.Print(1 + 50 * x, 2 + ii * 3, bag[i].GetName()); } } } Program.buffer.PrintBackground(); Program.buffer.Print(1, Program.buffer.height - 2, "Pulsa cualquier boton para salir"); Program.buffer.Print(1, 0, "MOCHILA"); Program.SmallMap(); Program.buffer.PrintScreen(); Console.ReadKey(); return(true); }