growth

Stats in League of Legends do not increase linearly with champion level. Use this function to calculate the stat multiplier.

import { growth } from "@lolmath/calc";

growth(lvl)

Arguments

  • lvl (Number): The current champion level

Returns

(Number) the stat multiplier

Examples

const base = 658;
const perLevel = 109;
const lvl = 13;
const stat = base + growth(lvl) * perLevel; // 1851.55

lerp

Interpolates a value between a minimum and maximum based on a given ratio.

import { lerp } from "@lolmath/calc";

lerp(min, max, ratio)

Arguments

  • min (Number): The minimum value.

  • max (Number): The maximum value.

  • ratio (Number): The ratio between 0 and 1 to interpolate the value.

Returns

(Number) The interpolated value.

Examples

// Teemo Q: 80 / 125 / 170 / 215 / 260
const min = 80;
const max = 260;
const level = 3;

const damage = lerp(min, max, linear5(level)); // 170

lerp18

Interpolates a value between min and max based on an 18-level scaling.

import { lerp18 } from "@lolmath/calc";

lerp18(min, max, level)

Arguments

  • min (Number): The minimum value.

  • max (Number): The maximum value.

  • level (Number): The current level (1 to 18).

Returns

(Number) The interpolated value.

Examples

const damage = lerp18(80, 260, 10); // 170

lerp3

Interpolates a value between min and max based on a 3-level scaling.

import { lerp3 } from "@lolmath/calc";

lerp3(min, max, level)

Arguments

  • min (Number): The minimum value.

  • max (Number): The maximum value.

  • level (Number): The current level (1 to 3).

Returns

(Number) The interpolated value.

Examples

const damage = lerp3(80, 180, 2); // 130

lerp5

Interpolates a value between min and max based on a 5-level scaling.

import { lerp5 } from "@lolmath/calc";

lerp5(min, max, level)

Arguments

  • min (Number): The minimum value.

  • max (Number): The maximum value.

  • level (Number): The current level (1 to 5).

Returns

(Number) The interpolated value.

Examples

const damage = lerp5(80, 260, 3); // 170

linear

Linear scaling function. Returns a multiplier that is 0 at level 1 and 1 at maxLevel.

import { linear } from "@lolmath/calc";

linear(maxLvl, lvl)

Arguments

  • maxLvl (Number): The level at which the scaling is 1

  • lvl (Number): The current level of the ability

Returns

(Number) the scaling multiplier

Examples

// Teemo Q: 80 / 125 / 170 / 215 / 260
const base = 80;
const end = 180; // 260 - base
const maxLvl = 5;
const damage = base + linear(maxLvl, lvl) * end; // 105

linear18

The scaling for abilities that max out at level 18.

import { linear18 } from "@lolmath/calc";

linear18(lvl)

Arguments

  • lvl (Number): The current level of the ability

Returns

(Number) the scaling multiplier


linear3

The scaling for abilities that max out at level 3.

import { linear3 } from "@lolmath/calc";

linear3(lvl)

Arguments

  • lvl (Number): The current level of the ability

Returns

(Number) the scaling multiplier


linear5

The scaling for abilities that max out at level 5.

import { linear5 } from "@lolmath/calc";

linear5(lvl)

Arguments

  • lvl (Number): The current level of the ability

Returns

(Number) the scaling multiplier