Skill Dataset Attributes

A simple way of adding stats to datasets.

Skill datasets support attributes specifically designed add scaling stats with ease.

Attributes

Scaler

The Scaler attribute can be used on an int or float field to mark it as a value that scales with the level of the skill. This attribute accepts an ID (string).

[Scaler("damage")]
[NonSerialized] // Recommended to prevent it from appearing in the Skill Bank
public float damage;

Base Value

The BaseValue attribute can be used on an int or float field to mark it as a value that should be used as the base value for a Scaler field. This attribute accepts an ID (string), which must be the same as the Scaler field that it's meant to target.

[BaseValue("damage")]
public float baseDamage;

Scaling

The Scaling attribute can be used on an int or float or AnimationCurve field to mark it as the scaling source for a Scaler field. This attribute accepts an ID (string) and a scaling mode (ScalingMode). The ID must be the same as the Scaler field that it's meant to target. The scaling mode does not need to be defined if the attribute is used on an AnimationCurve field.

[Scaling("damage")]
public float damageScaling;

Scaling Modes

Name
Description

Linear

Linear scaling (base + scaling * level - 1).

Exponential

Ramped up scaling (base * scaling^(level - 1)).

Curve

Use an animation curve as the scaling source.

Example

Below is an example of what a custom dataset would look like if the above was implemented.

using Esper.SkillWeb;
using Esper.SkillWeb.Attributes;
using System;
using UnityEngine;

[CreateAssetMenu(fileName = "Custom Skill Dataset", menuName = "Skill Web/Datasets/Custom Skill Dataset")]
public class CustomDataset : DefaultSkillDataset
{
    [BaseValue("damage")]
    public float baseDamage;

    [Scaling("damage")]
    public float damageScaling;

    [Scaler("damage")]
    [NonSerialized]
    public float damage;

    public override string GetDescription()
    {
        string description = base.GetDescription();

        // Append the description to include the damage stat
        description += $"\n\nDamage: {damage}";

        return description;
    }
}

Last updated