GameStatList Get() Methods

v4.0

IEnumberable<GameStat> results

These will return an IEnumberable<GameStat> which you can cast .ToList() or .ToArray(), or continue to query against the results.

public IEnumerable<GameStat> GetAllCounters() // can not be trained or modified
public IEnumerable<GameStat> GetAllTrainable()
public IEnumerable<GameStat> GetAllModifiable()
public IEnumerable<GameStat> GetAllTrainableAndModifiable()
public IEnumerable<GameStat> GetAllIsModified() // FinalStat is higher or lower due to other modifications
public IEnumerable<GameStat> GetAllWhereFinalStatGreaterThanPointsAndValue() // FinalStat > Points + FinalValue
public IEnumerable<GameStat> GetAllWhereFinalStatLessThanPointsAndValue() // FinalStat < Points + FinalValue
public IEnumerable<GameStat> GetAllFinalStatGreaterThan(float value)
public IEnumerable<GameStat> GetAllFinalStatLessThan(float value)
public IEnumerable<GameStat> GetAllFinalStatIs(float value)
public IEnumerable<GameStat> GetAllPointsGreaterThan(float value)
public IEnumerable<GameStat> GetAllPointsLessThan(float value)
public IEnumerable<GameStat> GetAllPointsIs(float value)
public IEnumerable<GameStat> GetAllProficiencyGreaterThan(float value)
public IEnumerable<GameStat> GetAllProficiencyLessThan(float value)
public IEnumerable<GameStat> GetAllProficiencyIs(float value)

// These have an optional bool includePoints. When false, FinalValue will be considered, 
// otehrwise, FinalValue + Points will be considered.
public IEnumerable<GameStat> GetAllValueGreaterThan(float value, bool includePoints = true)
public IEnumerable<GameStat> GetAllValueLessThan(float value, bool includePoints = true)
public IEnumerable<GameStat> GetAllValueIs(float value, bool includePoints = true)

// Examples
Debug.Log($"IHaveStats Actor is not proficient in {GetAllProficiencyLessThan(1f).Count} stats");

foreach(var gameStat in GetAllTrainableAndModifiable().Where(x => x.Points > 10))
{
    gameStat.AddPoints(-1); // Remove one Point from each!
}

Dictionaries of GameStats

These methods each will return a Dictionary with a group of GameStat objects from the list. Most have addtional options in method signature. See the examples below the methods list.

public Dictionary<string, float> GetAllFinalStats(bool keyIsObjectName = true, bool recompute = false, bool recomputeTree = false)
public Dictionary<string, float> GetAllPoints(bool keyIsObjectName = true, bool countersOnly = true, bool includeBaseValue = false)
public Dictionary<string, GameStat> GetAllCounterStats(bool keyIsObjectName = true)
public Dictionary<string, GameStat> GetAllTrainableStats(bool keyIsObjectName = true)
public Dictionary<string, GameStat> GetAllModifiableStats(bool keyIsObjectName = true)
public Dictionary<string, GameStat> GetAllTrainableAndModifiableStats(bool keyIsObjectName = true)
public Dictionary<string, GameStat> GetAllModifiedStats(bool keyIsObjectName = true, bool includeAll = true, bool greaterThan = true)

Get all final stat values

Returns Dictionary<string, float> with all GameStats in the list.

/* Optional parameters
bool keyIsObjectName = true // if false, key will be Uid()
bool recompute = false // if true, stats will be recomputed
bool recomputeTree = false // if true, all stats in tree are recomputed
*/

var allFinalStats = gameStatList.GetAllFinalStats();

Get points of "Counter" stats or all stats

Returns Dictionary<string, float> with the Point value for all "Counter" stats, or all GameStats in the list. Counter stats are those which can't be trained or modified.

/* Optional parameters
bool keyIsObjectName = true // if false, key will be Uid()
bool countersOnly = true // if false, all stats will be included
*/

var allCounters = gameStatList.GetAllPoints();

Get GameStats for Counters, Trainable, Modifiable

Returns Dictionary<string, GameStat> with the those that are Counters, Trainable, Modifiable, or those that are both Trainable and Modifiable.

/* Optional parameters
bool keyIsObjectName = true // if false, key will be Uid()
*/

var allCounterGameStats = gameStatList.GetAllCounterStats();
var allTrainableGameStats = gameStatList.GetAllTrainableStats();
var allModifiableGameStats = gameStatList.GetAllModifiableStats();
var allSkillGameStats = gameStatList.GetAllTrainableAndModifiableStats();

Get Modified Stats

Returns Dictionary<string, GameStat> with the those that are currently modified, which means the Final Stat value is greater than or less than the sum of Points + BaseValue.

/* Optional parameters
bool keyIsObjectName = true // if false, key will be Uid()
bool includeAll = true // if false, will only include those greater than or less than
bool greaterThan = true // if false, we will only include those less than
*/

var allModifiedGameStats = gameStatList.GetAllModifiedStats();
var allStatsModifiedGreater = gameStatList.GetAllModifiedStats(true, false);
var allStatsModifiedLess = gameStatList.GetAllModifiedStats(true, false, false);

Last updated