Formulas

Description

The formulas.lua file specifies which formulas contain which functions and in what order they are executed. Generally, every formula consists of 1 or more functions.

Formula functions are split into 2 groups: OnCast and OnHit.

OnCast functions are executed when the action is cast, so once the charge bar is full. They usually calculate the chance for the action to miss, being reflected, the target countering it, being immune to it, etc.

OnHit functions are executed once the action (visually) hits the target. They usually calculate the damage the target should receive, what status effect they should get, etc.

Assignment

Functions are assigned to a group based on their goal.

For example, if an action heals the target, its formula should first check if the target can even be hit before actually modifying their hp. The former check is usually done via an OnCast function while the latter is done via an OnHit function.

So OnCast functions are usually used for smaller tasks and help with the processing of OnHit functions.

Layout

local onCastFormulas = {
  --more functions
  [30] = {16, 6}
}

local onHitFormulas = {
  --more functions
  [30] = {65, 103}
}

return onCastFormulas, onHitFormulas

Every table entry uses a formula identifier (e.g. 30) as the key and a table of formula functions (e.g. {16, 6}) as the value.

Notes

There can only be a maximum of 256 (0 -> 255) formulas.

Generally, if the formula of an action has no functions, it does absolutely nothing. However, they are a few actions in the game whose task is hardcoded into the executable (e.g. Shades of Black). The reason for that is because the actual task of Shades of Black is to transform into another action whose formula is then processed. So there is no point in assigning functions to the formula of Shades of Black as they will never be executed anyway.

Last updated