@cccode/fxr - v32.0.1
    Preparing search index...

    Class StateCondition

    Index

    Constructors

    • A condition for a state. If the condition is true, the state that the condition leads to will activate.

      Parameters

      • operator: Operator

        Controls what operation should be used for the condition.

      • unk1: number

        Unknown. Seems to always be 2 in vanilla Elden Ring. 3 seems to make the condition always false.

      • state: number

        If the condition is true, the state at this index will be checked next. If this index is -1, the effect will terminate instead.

      • leftOperandType: OperandType

        Controls what type of value the operand to the left of the operator should be.

      • leftOperandValue: number

        This does different things depending on the leftOperandType:

        Operand type Value description
        Literal The value is the operand's value.
        External The value refers to an external value to use as the operand's value.
        UnkMinus2 The value is ignored and should be null.
        StateTime The value is ignored and should be null.
      • rightOperandType: OperandType

        Controls what type of value the operand to the right of the operator should be.

      • rightOperandValue: number

        This does different things depending on the rightOperandType:

        Operand type Value description
        Literal The value is the operand's value.
        External The value refers to an external value to use as the operand's value.
        UnkMinus2 The value is ignored and should be null.
        StateTime The value is ignored and should be null.

      Returns StateCondition

    Properties

    leftOperandType: OperandType

    Controls what type of value the operand to the left of the operator should be.

    leftOperandValue: number

    This does different things depending on the leftOperandType:

    Operand type Value description
    Literal The value is the operand's value.
    External The value refers to an external value to use as the operand's value.
    UnkMinus2 The value is ignored and should be null.
    StateTime The value is ignored and should be null.
    operator: Operator

    Controls what operation should be used for the condition.

    rightOperandType: OperandType

    Controls what type of value the operand to the right of the operator should be.

    rightOperandValue: number

    This does different things depending on the rightOperandType:

    Operand type Value description
    Literal The value is the operand's value.
    External The value refers to an external value to use as the operand's value.
    UnkMinus2 The value is ignored and should be null.
    StateTime The value is ignored and should be null.
    state: number

    If the condition is true, the state at this index will be checked next. If this index is -1, the effect will terminate instead.

    unk1: number

    Unknown. Seems to always be 2 in vanilla Elden Ring. 3 seems to make the condition always false.

    Methods

    • Swaps the operands and changes the operator to match if the left operand is a literal value and the right operand is a non-literal value. This makes it a bit easier to read the expression, but doesn't affect functionality.

      Returns StateCondition

    • Parses a logical expression in a string and creates a StateCondition from it.

      Parameters

      • expression: string | StateCondition

        A string with a logical expression and optionally a then statement with a state index.

        expression = <operand> <operator> <operand> then <stateIndex>
        operand = <number> | External(<integer>) | StateTime | UnkMinus2
        operator = == | != | < | <= | > | >=
        stateIndex = <positive integer> | -1 | terminate
        

        External, StateTime, and UnkMinus2 are all case-insensitive and have shorter variations available. Here are some examples:

        ext(0)
        stateTime
        time
        minus2
        
        ext(0) >= 1 then -1
        time > 5 then 2
        1 != External(10000) then terminate
        

      Returns StateCondition

      A new StateCondition based on the expression.