Type Parameters

Hierarchy

  • default

Constructors

  • Type Parameters

    Parameters

    • host: T

    Returns default<T>

Methods

  • Returns whether the stat exceeds its max value. If there is no max for this stat, returns false.

    Parameters

    Returns boolean

  • Returns the stat object of a given Stat. The return type is a vague IStat, but can be passed a type which extends IStatBase for automatic narrowing.

    Type Parameters

    Parameters

    • stat: Stat | IStat

      The Stat to get

    • allowFailure: boolean = false

    Returns STAT_DATA & (STAT_DATA extends IStatBase ? {
        base: STAT_DATA;
    } : undefined)

  • Returns the max of the given stat, or undefined if the stat isn't an IStatMax. Stat bonus is not applied.

    Parameters

    • stat: Stat | IStat
    • allowFailure: boolean = false

    Returns undefined | number

  • Returns the value of the given stat, or undefined if the stat does not exist. Stat bonus is not applied.

    Parameters

    • stat: Stat | IStat
    • allowFailure: boolean = false

    Returns undefined | number

  • Parameters

    Returns undefined | number

  • Returns the max of the given stat, or undefined if the stat isn't an IStatMax. Stat bonus is applied.

    Parameters

    Returns number

  • Returns the "percent" of the given stat, calculated with value / max. If there is no max for this stat, returns undefined.

    Parameters

    Returns number

  • Parameters

    • stat: Stat | IStat
    • Optional allowFailure: boolean

    Returns number

  • Returns the value of the given stat, or undefined if the stat does not exist. Stat bonus is applied.

    Parameters

    • stat: Stat | IStat
    • Optional allowFailure: true

    Returns undefined | number

  • Returns whether the given stat exists on this entity.

    Parameters

    Returns boolean

  • Returns whether the given stat has a max.

    Parameters

    Returns boolean

  • Increases the change timer for the given stat.

    Parameters

    • stat: Stat | IStat

      The stat to increase the change timer for.

    • Optional amt: number

      The amount to increase the change timer by. Defaults to the stat's changeTimerSpeed.

    Returns T

  • Initializes the given stat from a StatFactory instance.

    Parameters

    • stat: Stat
    • Optional initializer: ((factory: default) => any)

    Returns T

  • Parameters

    • stat: Stat
    • value: number
    • Optional initializer: ((factory: default) => any)

    Returns T

  • Decreases the change timer for the given stat.

    Parameters

    • stat: Stat | IStat

      The stat to decrease the change timer for.

    • Optional amt: number

      The amount to decrease the change timer by. Defaults to the stat's changeTimerSpeed.

    Returns T

  • Removes the given stat from this entity.

    Parameters

    Returns T

  • Parameters

    Returns T

  • Resets the change timer for the given stat.

    Parameters

    • stat: Stat | IStat

      The stat to reset the change timer for.

    Returns T

  • Sets the given Stat's value to the given amount. Assumes the given value includes any bonus. Triggers statChange

    Parameters

    Returns boolean

  • Sets the given Stat's max to the given amount. Triggers statMaxChange

    Parameters

    • stat: Stat | IStat

      The Stat to set.

    • max: number

      The amount to set the value to.

    • Optional newValue: number

      The new value for the stat, optional. Calls Stat.set internally.

    Returns T

  • Passes the "turn" for stats, decrements their changeTimers. If a stat's timer reaches 0, the stat value is changed by changeAmount and the changeTimer is reset to nextChangeTimer

    Returns default<T>

Generated using TypeDoc