public override Items.Item getDrop() { Classes.Items.Type itemType = (Classes.Items.Type)((Level % 12) / 2 + ((Level % 12) % 2) + ((Level % 12 == 0) ? 6 : 0)); int grade = 0; for (int i = 0; i < Level; i += 12) grade = i / 12; Item itemToDrop = null; switch (rGen.Next(1, 5)) { case 1: itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " health potion"); break; case 2: itemToDrop = new Armor(itemType, grade, "Some " + itemType + "+" + grade + " armor! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " armor"); break; case 3: WeaponType wepType = (Classes.Items.WeaponType)rGen.Next(1, 4); itemToDrop = new Weapon(itemType, wepType, grade, "A " + itemType + "+" + grade + " " + wepType + "! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " " + wepType); break; case 4: itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " health potion"); break; } return itemToDrop; }
private void sellConsumable_Click(object sender, RoutedEventArgs e) { if (inGameScreen.Shop1.consumeBox.HasItems && inGameScreen.Shop1.consumeBox.SelectedIndex >= 0) { int selectedIndex = inGameScreen.Shop1.consumeBox.SelectedIndex; Consumable item = new Consumable(p1.itemInventory[selectedIndex].Grade, p1.itemInventory[selectedIndex].ItemType, p1.weaponInventory[selectedIndex].ItemDescription, p1.weaponInventory[selectedIndex].ItemName); int val = (int)(0.5 * ItemValue(item.Grade, item.ItemType)); p1.CurrentGold += val; p1.RemoveItemFromInventory(p1.itemInventory[selectedIndex]); } inGameScreen.Shop1.consumeBox.SelectedIndex = 0; }
public int CompareTo(Consumable item) { int ret = (Grade - item.Grade) + ((int)ItemType - (int)item.ItemType) + (HealthRegen - item.HealthRegen); return ret; }
public int CompareTo(Consumable item) { int ret = (Grade - item.Grade) + ((int)ItemType - (int)item.ItemType) + (HealthRegen - item.HealthRegen); return(ret); }