/// <summary> /// Drink Potion is a method that is specific to heros. I did not inherit it from Character. Therefore I don't need the override keyword. /// Also, I don't want to rewrite this method for every single class that inherits from hero, so I am making one to rule them all here. /// </summary> public void DrinkPotion(PotionName PotionName) { Potion p = Potions.Where(p => p.Name == PotionName).FirstOrDefault(); p.Drink(Name); // Potions give you a health boost. So make sure to increase your health bar! HealthBar += p.HealthBoostAmount; // Potions are a one time use, so remove it from your list of potions Potions.Remove(p); }
private void completePotion(PotionName p) { switch(p) { case PotionName.None: itemName = "Empty"; itemDescription = "Empty"; weight = 0; value = 0; potionEffect = PotionEffect.None; potency = 0; break; case PotionName.Health: itemName = "Health Potion"; itemDescription = ""; weight = 1; value = 1; potionEffect = PotionEffect.Health; potency = 4; break; case PotionName.Strength: itemName = "Strength Potion"; itemDescription = ""; weight = 1; value = 1; potionEffect = PotionEffect.Strength; potency = 4; break; case PotionName.Dexterity: itemName = "Dexterity Potion"; itemDescription = ""; weight = 1; value = 1; potionEffect = PotionEffect.Dexterity; potency = 4; break; default: break; } }
public Potion(PotionName potionName) { this.potionName = potionName; baseItemType = BaseItemType.Potion; completePotion(potionName); }
public void Setup(PotionName name) { colorPart.color = potions.Single(p => p.name == name).color; this.name = name; }