ProbabilityItem<T>
ProbabilityItem<T> represents a single entry inside a ProbabilityList<T>. It stores the value itself plus the state and metadata that control how that item behaves during selection.
What this type is responsible for
A ProbabilityItem<T> can hold:
- the value itself
- base probability
- enabled / locked state
- weight
- influence provider settings
- depletion state and unit counts
- provider-interface capabilities discovered from the value type
Core item data
Core properties
ValueThe value stored by this item.
BaseProbabilityThe stored baseline probability, clamped between 0 and 1.
ProbabilityThe effective probability currently used during selection. If the item is influenced, this value is derived from BaseProbability, spread settings, and current influence.
EnabledDetermines whether the item is eligible for selection.
LockedPrevents certain list-level probability operations from changing this item's base probability.
WeightWeight representation used by weight-based list helpers.
BaseProbability is not the final answer.
If the item is influenced, Probability is the value that actually matters during selection.
Influence support
Influence properties
InfluenceSpreadThe allowed low/high probability range when influence is applied.
InvertInfluenceReverses the effect of the incoming influence value.
InfluenceProviderExternal provider used to influence this item, unless the value itself already implements the influence-provider interface.
ValueIsInfluenceProviderReturns true when the stored value itself implements IProbabilityInfluenceProvider.
IsInfluencedItemReturns true when the item is currently influenced by either an external provider or the value itself.
GetInfluencedProbabilityCalculates the resulting probability for a specific influence value.
Important behavior
If the stored value implements IProbabilityInfluenceProvider, RNGNeeds prefers that provider over an externally assigned one. That makes it possible for a value object to supply its own influence directly.
For the conceptual guide and examples, see Probability Influence.
Depletion and selectability
Depletable item properties
IsDepletableWhen true, picks consume units from this item while the parent list is depletable.
UnitsCurrent number of units remaining.
MaxUnitsMaximum units available after refill.
IsDepletedReturns true when the item is depletable and has no units left.
IsSelectableReturns true when the item is currently eligible for selection, taking enabled state and depletion into account.
RefillSets Units back to MaxUnits.
SetDepletableConfigures depletion state and unit counts together.
Provider capability discovery
Provider-interface helpers
GetProviderTypesInspects the value and reports which provider interfaces it implements.
IProbabilityInfluenceProviderLets a value or external object supply a live influence value that changes the item's effective probability.
IProbabilityItemInfoProviderLets a value provide extra item info for the editor UI.
IProbabilityItemColorProviderLets a value provide custom coloring for the editor UI.
Typical setup
var item = new ProbabilityItem<string>("Rare Gem", 0.2f);
item.Enabled = true;
item.Locked = false;
item.SetDepletable(true, units: 3, maxUnits: 3);