Skip to content

LevelBasedValue

seelderr edited this page Jan 3, 2025 · 3 revisions

Description

A LevelBasedValue is a value that scales with a level. This is a structure that vanilla minecraft uses to define enchantments, and we re-use it in Dragon Survival to define various attributes for a DragonAbility.

Types

Clamped

The value is clamped between a min and a max.

Schema

{
  "value": [LevelBasedValue],    // [Mandatory]  || The base LevelBasedValue to clamp.
  "min": [number]                // [Mandatory]  || The minimum value allowed.
  "max": [number]                // [Mandatory]  || The maximum value allowed.
}

Constant

The value is constant.

Schema

{
   "value": [number],            // [Mandatory]  || The constant value.
}

Fraction

The value is the division of two LevelBasedValues.

Schema

{
    "numerator": [LevelBasedValue]   // [Mandatory] || The numerator.
    "denominator": [LevelBasedValue] // [Mandatory] || The denominator.
}

Levels Squared

The value is the square of the current level.

Schema

{
    "added": [number]   // [Mandatory] || An additional amount added to the squared result.
}

Linear

The value scales linearly.

Schema

{
    "base": [number]                     // [Mandatory] || The base value.
    "per_level_above_first": [number]    // [Mandatory] || The value added per level above first.
}

Lookup

The value is determined by a lookup table.

Schema

{
    "values": [number]                  // [Mandatory] || A list of values. The order determines which value is for which level.
    "fallback": [LevelBasedValue]       // [Mandatory] || A fallback LevelBasedValue if the level exceeds the size of the lookup table.
}
Datapack Documentation
Clone this wiki locally