Data Expression - funovus/editor-wiki GitHub Wiki
Table of Contents
- [Data\Expression](#dataexpression)
* [Value](#value)
* [Divide](#divide)
* [Multiply](#multiply)
* [Subtract](#subtract)
* [Add](#add)
* [Compare](#compare)
* [Logic Not](#logic-not)
* [Logic And](#logic-and)
* [Logic Or](#logic-or)
* [Named Expression](#named-expression)
* [Exponent](#exponent)
* [Modulo](#modulo)
* [If](#if)
|
Data\Expression {dataExpression}
Expressions are a powerful feature of the ROC editor that allows you to write formulas and plug them into various fields of game data.
Similar to Validators, expressions are evaluated and return a result. Expressions are more flexible as they can be configured to write user defined formulas, and unlike validators they can return numeric or boolean values depending on context.
In numeric cases, true is treated as 1
and false is treated as 0
. In boolean cases, non-zero numbers are treated as true
and 0 is treated as false
. Note that expressions can also be used as validators.
The most common use case for expressions are for creating custom damage formulas, such as damage = ([caster]STRENGTH * 10) - [target]ARMOR)
, where STRENGTH
and ARMOR
are arbitrary attributes defined as tags.
Supported Fields
Expressions can be plugged into a number of existing data fields and can also be used with data binding in custom UI. These are the currently supported data fields:
- Behavior/PeriodicInterval
- Effect/ApplyBehavior/Duration
- Effect/Damage/DamageAmount
- Effect/EnumerateUnitList/StepCount
- Effect/Heal/HealAmount
- Effect/ModifyUnit/ModifyMana/Amount
- Effect/ModifyUnit/ModifyShield/Amount
- Mover/Orbiting/Radius
These are the types of values you can include or reference in expression formulas.
Returns a constant value.
Returns true or false.
Returns an integer value.
Returns a floating point number (with decimal).
Returns a random number between the min and max value.
MessageType: RangeInt
Returns an integer value.
MessageType: RangeDouble
Returns a floating point number (with decimal).
The damage amount is multiplied by this value (default 0).
Returns the literal damage value when used within a damage effect.
The heal amount is multiplied by this value (default 0).
Returns the literal heal value when used within a heal effect.
Returns the tag count of a specific tag on a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Which tag is evaluated.
Returns the level of a unit. Currently limited in usefulness.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the level of an ability. Currently limited in usefulness.
Which ablity is evaluated.
Returns the level of a wild sky upgrade.
Which upgrade is evaluated.
Returns the level of an upgrade.
Which upgrade is evaluated.
Returns the remaining path distance for a unit with waypoints.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the current cooldown remaining for an ability.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Which ablity is evaluated.
When checked, the expression returns the total cooldown duration, rather than time remaining.
Returns the current health of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the max health of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the current health fraction of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the current mana of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the max mana of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the current mana fraction of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the current shields of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the max shields of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the current shield fraction of a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Returns the current stack count of a behavior on a unit.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Which behavior is evaluated.
Returns the elapsed time that a behavior has been on a unit.
Note that this duration is reset to 0 when the stack count is refreshed.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Which behavior is evaluated.
Returns the duration that a behavior has been on a unit.
Returns the maximum duration of a behavior on a unit. Note that this duration is not extended when the stack count is refreshed.
EnumType: ValidatorExpressions.UnitLocation
Which unit is evaluated.
Which behavior is evaluated.
Returns the sum of the listed expressions.
Functionally similar to Add but used as an expression value rather than a top-level operator.
Returns 1 if the effect tree is the result of a critical hit with a weapon or ability. This can be used to create damage expressions that deal increased damage on critical hits. For example this psuedo-expression would cause a damage effect to deal 150% damage on critical hit.
Multiply( EffectCrticial * DamageAmount(1) * Constant(0.5) )
Swap out the constant for value derived from tag count to support dynamic critical hit damage multipliers.
Returns the distance between units.
EnumType: ValidatorExpressions.UnitLocation
EnumType: ValidatorExpressions.UnitLocation
Divide a value by another.
Multiply multiple values together. Supports nested expressions.
Subtract a value from another.
Add multiple values together. Supports nested expressions.
Compares two values/expressions and returns true or false based on the result.
Returns the flipped value or expression (true becomes false, false becomes true).
Returns true if all listed values/expressions are true.
Returns true if any listed values/expressions are true.
Used to reference another expression. This is useful for combining multiple expressions or breaking complex expressions into smaller abstractions.
Returns value to the power of another. Similar to the ^
operator in Lua.
Returns the remainder of a value after being divided by another. Similar to the %
operator in Lua.
Returns the sum of the Values expressions if the Compare condition returns true. Otherwise returns the same of the Else Values expressions.