Class StatSetInstance
- Namespace
- ElectricDrill.SoapRpgFramework.Stats
- Assembly
- com.electricdrill.soap-rpg-framework.Runtime.dll
Represents an instance of a StatSet with actual values for each stat. Implements IEnumerable and IStatContainer to provide collection functionality.
public class StatSetInstance : IValueContainer<Stat>- Inheritance
- 
      objectStatSetInstance
- Implements
Constructors
StatSetInstance(StatSet)
Initializes a new StatSetInstance based on the provided StatSet. All stats from the StatSet are initialized with a value of 0.
public StatSetInstance(StatSet statSet)Parameters
- statSetStatSet
- The StatSet to base this instance on. 
Properties
this[Stat]
Gets or sets the value of the specified stat using indexer syntax.
public long this[Stat stat] { get; set; }Parameters
- statStat
- The stat to get or set. 
Property Value
- long
- The current value of the stat. 
Methods
AddValue(Stat, long)
Adds value to the specified stat. If the stat doesn't exist, it will be created with the specified value. Use negative values to subtract from the stat.
public void AddValue(Stat stat, long value)Parameters
- statStat
- The stat to modify. 
- valuelong
- The value to add (can be negative). 
Clone()
Creates a deep copy of this StatSetInstance.
public StatSetInstance Clone()Returns
- StatSetInstance
- A new StatSetInstance with the same stats and values. 
Contains(Stat)
Determines whether this instance contains the specified stat.
public bool Contains(Stat stat)Parameters
- statStat
- The stat to check for. 
Returns
- bool
- true if the instance contains the stat; otherwise, false. 
Get(Stat)
Gets the current value of the specified stat.
public long Get(Stat stat)Parameters
- statStat
- The stat to retrieve. 
Returns
- long
- The current value of the stat. 
GetAsPercentage(Stat)
Gets the value of the specified stat as a Percentage.
public Percentage GetAsPercentage(Stat stat)Parameters
- statStat
- The stat to get as a percentage. 
Returns
- Percentage
- The stat value wrapped in a Percentage object. 
GetEnumerator()
public IEnumerator<KeyValuePair<Stat, long>> GetEnumerator()Returns
- IEnumerator<KeyValuePair<Stat, long>>
Operators
operator +(StatSetInstance, StatSetInstance)
Adds the values of corresponding stats from two StatSetInstances. All stats present in the first instance must also be present in the second instance.
public static StatSetInstance operator +(StatSetInstance a, StatSetInstance b)Parameters
- aStatSetInstance
- The first StatSetInstance. 
- bStatSetInstance
- The second StatSetInstance. 
Returns
- StatSetInstance
- A new StatSetInstance with the sum of corresponding stat values. 
Exceptions
- KeyNotFoundException
- Thrown when a stat from instance 'a' is not found in instance 'b'.