public void usaritem(string nombre, LcdLabel hp, ComboBox cbitem, Label dialog) { int heal; string fullhealth = s.getdata("select * from personaje", "HP"); switch (nombre) { case "Pomada": heal = 4; hp.Text = (int.Parse(hp.Text) + heal).ToString(); dialog.Text = "Uso pomada"; if (int.Parse(hp.Text) >= int.Parse(fullhealth)) { hp.Text = fullhealth; } break; case "Ciabatta™ chica de jamon": Stream stream = Properties.Resources.aet; sfx.playsound(stream); string ciabata = string.Format("update personaje set HP = (HP + '{0}'), ATK =(ATK + '{1}'), DEF = (DEF + '{2}')", 4, 1, 0); s.Exe(ciabata); dialog.Text = "Consumo una Ciabatta; mis musculos empiezan a crecer, mi mentalidad aumenta y\n mis agallas incrementan exageradamente"; hp.Text = s.getdata("select * from personaje", "HP"); break; } cbitem.Text = null; string remove = string.Format("delete from items where nombre = '{0}'", nombre); s.Exe(remove); s.populate(cbitem, "select * from items", "nombre"); }
void items(string nombre, int myatk, int enemyhp, int enemydef, Label _enemyhp, Label _log, Panel dialog, Panel cmd, TextBox mycommand, Timer timer1, ComboBox cbitem, LcdLabel myhp) { switch (nombre) { case "Granada": Stream stream = Properties.Resources.granada; sfx.playsound(stream); damage = 9 - enemydef; _enemyhp.Text = (int.Parse(_enemyhp.Text) - 9).ToString(); readmessage(("Sora lanza una granada: " + damage + " de daño" + "\n"), mycommand, timer1); break; case "Piedra": Stream piedra = Properties.Resources.piedra; sfx.playsound(piedra); damage = 3 - enemydef; _enemyhp.Text = (int.Parse(_enemyhp.Text) - 3).ToString(); readmessage(("Sora tira una piedra: " + damage + " de daño" + "\n"), mycommand, timer1); break; } _i.usaritem(cbitem.Text, myhp, cbitem, _log); string remove = string.Format("delete from items where nombre = '{0}'", nombre); s.Exe(remove); cbitem.Text = null; s.populate(cbitem, "select * from items", "nombre"); }