Represents a skill tree node. WIP

Implements

Constructors

Properties

Accessors

Constructors

Properties

cost: [currency: CurrencyStatic<[], string, [], string>, cost: ((level: Decimal, context: SkillInit) => Decimal)]

The cost of the skill tree node. [currency, cost] - The currency and cost of the skill tree node.

description: string | ((level: Decimal, upgradeContext: UpgradeStatic, currencyContext: CurrencyStatic<[], string, [], string>) => string)

The description of the upgrade. Can be a string or a function that returns a string.

The current level of the upgrade.

The upgrade object that the description is being run on.

The currency static class that the upgrade is being run on.

// A dynamic description that returns a string
const description = (level) => `This upgrade is at level ${level}`;

// ... create upgrade here (see currencyStatic.addUpgrade)

const upgrade = currencyStatic.getUpgrade("upgradeID");

// Buy 1 level of the upgrade
currencyStatic.buyUpgrade("upgradeID", 1);

// Getter property
console.log(upgrade.description); // "This upgrade is at level 1"
effect: undefined | ((level: Decimal, context: SkillNode) => void)

The effect of the skill tree node.

The level of the skill tree node.

The skill tree node.

id: string

The ID of the upgrade. Used to retrieve the upgrade later.

maxLevel: Decimal

The maximum level of the upgrade. Warning: If not set, the upgrade will not have a maximum level and can continue to increase indefinitely.

name: string

The name of the upgrade. Defaults to the ID.

required: (RequiredSkill | SkillNode)[] | ((skillTreeContext: SkillTree) => (RequiredSkill | SkillNode)[])

The skill nodes that are required to unlock this skill node. See RequiredSkill for more information. Can also be a function that takes the skill tree context and returns the required skills.

Accessors