GameConditionList Get() Methods

v4.0

Conditions have an additional concept for the "source" of the condition, which may modify the effect the condition has on the target. There are additional Get() methods which include this concept.

In the Get() methods below, the source will be required when addIfNull is true, and the GameCondition is added. Otherwise, these will return the current GameCondition, which whatever value is already present for the IHaveStats source.

// Get a single result
public virtual GameCondition Get(Condition condition, bool addIfNull = false, IHaveStats source = null)
public virtual GameCondition Get(GameCondition gameCondition, bool addIfNull = false, IHaveStats source = null)
public virtual GameCondition Get(string uid, bool addIfNull = false, IHaveStats source = null)

Additional Get() methods which do not handle addIfNull

public virtual bool TryGet(Condition condition, out GameCondition found)
public virtual bool TryGet(GameCondition gameCondition, out GameCondition found) => TryGet(gameCondition.Uid(), out found, source);
public virtual bool TryGet(string uid, out GameCondition found)
{
    found = Get(uid);
    return found != null;
}

// Get an IEnumberable<GameCondition> result -- none of these will handle addIfNull
public virtual IEnumerable<GameCondition> GetAll(Condition condition)
public virtual IEnumerable<GameCondition> GetAll(GameCondition gameCondition)
public virtual IEnumerable<GameCondition> GetAll(string uid)

public bool TryGetAll(Condition condition, out IEnumerable<GameCondition> found)
public bool TryGetAll(GameCondition gameCondition, out IEnumerable<GameCondition> found)
public bool TryGetAll(string uid, out IEnumerable<GameCondition> found, IHaveStats source = null)

Get conditions that are from a specific IHaveStats source

// Get one: Returns the first if there are multiple
public virtual GameCondition GetFromSource(Condition condition, IHaveStats source)
public virtual GameCondition GetFromSource(GameCondition gameCondition, IHaveStats source)
public virtual GameCondition GetFromSource(string uid, IHaveStats source)

public bool TryGetFromSource(Condition condition, out GameCondition found, IHaveStats source)
public bool TryGetFromSource(GameCondition gameCondition, out GameCondition found, IHaveStats source)
public bool TryGetFromSource(string uid, out GameCondition found, IHaveStats source)

// Get all
public virtual IEnumerable<GameCondition> GetAllFromSource(Condition condition, IHaveStats source)
public virtual IEnumerable<GameCondition> GetAllFromSource(GameCondition gameCondition, IHaveStats source)
public virtual IEnumerable<GameCondition> GetAllFromSource(string uid, IHaveStats source)

public bool TryGetAllFromSource(Condition condition, out IEnumerable<GameCondition> found, IHaveStats source)
public bool TryGetAllFromSource(GameCondition gameCondition, out IEnumerable<GameCondition> found, IHaveStats source)
public bool TryGetAllFromSource(string uid, out IEnumerable<GameCondition> found, IHaveStats source)

// Example
if (TryGetAllFromSource(magicCastingEnemy, out var found))
{
    // Do something with all of the conditions from magicCastingEnemy
}

Get by Display Name

public GameCondition GetDisplayName(string displayName)

Last updated