/// <summary> /// Creates a new Consubmable component /// </summary> /// <param name="potency">The strength of the item's effect. A value of 0 is used for effects that don't get multiplied</param> /// <param name="duration">The duration of the effect in seconds. A value of 0 is instantaneous</param> /// <param name="useCount">How many times can this be used before being spent</param> public ConsumableComponent(RPGStatsComponent.StatsEffect effect, int potency, float duration = 0, int useCount = 1) { Effect = effect; Potency = potency; Duration = duration; this.useCount = useCount; }
public MiscItem GenerateRandomMiscItem() { string name = $"{adjectives[Random.Get(0, adjectives.Length)]} {nouns[Random.Get(0, nouns.Length)]}"; int cost = Random.Get(1, MAX_COST); int quantity = Random.Get(1, MAX_QUANTITY); MiscItem item = new MiscItem(name, cost, quantity); if (CHANCE_OF_CONSUMABLE >= Random.Get(0.0f, 1.0f)) { StatsEffect effect = (StatsEffect)Random.Get(0, RPGStatsComponent.StatsEffectCount); item.AddComponent(new ConsumableComponent(effect, Random.Get(-MAX_POTENCY, MAX_POTENCY))); } return(item); }