Skip to content

FormulaPipeline ​

Inherits: RefCounted

The one place that turns stat points into an effect value, so every effect type does it identically:

Description ​

points -> [DiminishingReturns] (optional) -> CalculationFormula -> optional max result

Also draws the sample points the editor graph and table use. See docs/systems/entity-stats.md, section 18.2.

Methods ​

floatcalculate( points: float, formula: CalculationFormula, returns: DiminishingReturns = null, context: FormulaContext = null, max_result: float = 0.0 ) static
floatclamp_percentage_decrease( percentage: float ) static
PackedVector2Arraysample( formula: CalculationFormula, returns: DiminishingReturns = null, context: FormulaContext = null, max_result: float = 0.0, from_points: float = 0.0, to_points: float = 1000.0, steps: int = 100 ) static
Vector2preview_range( formula: CalculationFormula, returns: DiminishingReturns = null ) static
Array[String]validate( formula: CalculationFormula, returns: DiminishingReturns = null ) static
floatgrowth_at( level: int, formula: CalculationFormula, returns: DiminishingReturns = null, context: FormulaContext = null, max_growth: float = 0.0 ) static

Method descriptions ​

float calculate( points: float, formula: CalculationFormula, returns: DiminishingReturns = null, context: FormulaContext = null, max_result: float = 0.0 ) ​

The effect value for points. A null formula gives 0. max_result > 0 caps the magnitude of the value ("dodge never above 75 %"); 0 means no cap. It is separate from the stat's own max_value, which caps the points.

float clamp_percentage_decrease( percentage: float ) ​

A percentage decrease must never push a number below 0: limits a "decrease by" percentage to 0..100

PackedVector2Array sample( formula: CalculationFormula, returns: DiminishingReturns = null, context: FormulaContext = null, max_result: float = 0.0, from_points: float = 0.0, to_points: float = 1000.0, steps: int = 100 ) ​

Points (x) and effect values (y) for the editor graph and table

Vector2 preview_range( formula: CalculationFormula, returns: DiminishingReturns = null ) ​

The x range the graph should draw: the formula's preferred range widened to the curve's, if any

Array[String] validate( formula: CalculationFormula, returns: DiminishingReturns = null ) ​

Configuration problems of the whole setup, from both slots

float growth_at( level: int, formula: CalculationFormula, returns: DiminishingReturns = null, context: FormulaContext = null, max_growth: float = 0.0 ) ​

Level growth of a stat or pool: the same two slots as an effect, with the LEVELS GAINED (level - 1) as the input, so level 1 has no growth ("+2 per level" is a Linear formula of 2). A null formula means no growth. max_growth > 0 caps the total growth. See docs/systems/entity-stats.md, section 18.6