formulas and scaling - magemonkeystudio/fabled GitHub Wiki

📐 Formulas & Scaling

Fabled uses a powerful formula system to scale skill values, mechanics, and attributes dynamically based on player data. These formulas control how damage, mana, cooldown, range, and other values scale with class level, skill level, and attributes.


🔢 Formula Syntax

Formulas are parsed using a left-to-right order, not PEMDAS. Use parentheses to control grouping.

Example:

These two are equivalent and return 0:

2 - 5 * 4 + 2(5 + 1)^2
((2 - 5) * 4 + 2(5 + 1))^2

➕ Supported Operators

  • - Subtraction
  • * Multiplication
  • / Division
  • ^ Exponentiation
  • _ Logarithm

🧠 Available Functions

Function Description Example
abs(x) Absolute value abs(-1 * a)
ceil(x) Rounds up ceil(0.25 * v) + 4
cos(x) Cosine (degrees) cos(360 / v)
floor(x) Rounds down floor(v * 2.25 ^ 2)
sqrt(x) Square root sqrt(a * 0.3 + 2)
sq(x) Square (x²) sq(v) + 4
sign(x) Returns 1 if positive, -1 if negative, 0 if zero sign(cos(v * 20))
sin(x) Sine (degrees) sin(v ^ 2)
tan(x) Tangent (degrees) tan(v ^ 0.1)

📊 Formula Variables

Variable Description
a Value of the relevant attribute
v Skill level
c Class level
t Target’s class level

🎯 Examples

Flat Scaling

10 + a * 0.5

Increases value directly with attribute points.

Percentage Scaling

v(a * 0.05 + 1)

Scales skill level based on attribute percentage.

Conditional Scaling

Damage-value: 'a * 0.05 + 1*v:icon-key=fireball|a * 0.02 + 1*v'

Changes formula if a metadata condition is met.


📦 Where Formulas Apply

Formulas can be used in:

  • Skill cost, cooldown, cast range
  • Mechanics like Damage, Heal, Particle, etc.
  • Target settings like Area radius or Cone angle
  • Attribute stat modifiers and component scaling

🧩 Displaying Values

Use placeholders in skill/tooltip lore:

{name}: {attr:mana} mana - {attr:cooldown}s cooldown

These auto-update with the player’s data in-game.


🔗 Related Pages