Table of Contents

Class ScalingFormula

Namespace
ElectricDrill.SoapRpgFramework.Scaling
Assembly
com.electricdrill.soap-rpg-framework.Runtime.dll

Represents a formula to calculate a value based on values returned by several scaling components. The calculation of each scaling component can either be based on the "self" entity (the entity that owns the formula) or the "target" entity (the entity that will be targeted by the action). For example, a scaling formula for an attack that deals the more damage the higher the enemy's armor is, can use the "self" entity to calculate the damage based on the attacker's stats and the "target" entity to calculate additional damage based on the target's armor. The final damage will be the sum of the value returned by the two scaling components.

public class ScalingFormula : ScriptableObject
Inheritance
object
ScalingFormula

Properties

TmpSelfScalingComponents

Gets the list of temporary scaling components for the "self" entity. These are not serialized and are used for runtime modifications.

public List<ScalingComponent> TmpSelfScalingComponents { get; }

Property Value

List<ScalingComponent>

TmpTargetScalingComponents

Gets the list of temporary scaling components for the "target" entity. These are not serialized and are used for runtime modifications.

public List<ScalingComponent> TmpTargetScalingComponents { get; }

Property Value

List<ScalingComponent>

Methods

CalculateValue(EntityCore)

Calculates the final value using only the "self" entity. This method assumes there are no target scaling components.

public long CalculateValue(EntityCore self)

Parameters

self EntityCore

The entity providing values for self-scaling components.

Returns

long

The calculated value.

CalculateValue(EntityCore, EntityCore)

Calculates the final value using both "self" and "target" entities.

public long CalculateValue(EntityCore self, EntityCore target)

Parameters

self EntityCore

The entity providing values for self-scaling components.

target EntityCore

The entity providing values for target-scaling components.

Returns

long

The calculated value.

CalculateValue(EntityCore, EntityCore, int)

Calculates the final value using both "self" and "target" entities, and a specific level for the base value. This method assumes the formula uses a scaling base value.

public long CalculateValue(EntityCore self, EntityCore target, int level)

Parameters

self EntityCore

The entity providing values for self-scaling components.

target EntityCore

The entity providing values for target-scaling components.

level int

The level to use for calculating the base value.

Returns

long

The calculated value.

CalculateValue(EntityCore, int)

Calculates the final value using the "self" entity and a specific level for the base scaling value. This method assumes there are no target scaling components and the formula uses a scaling base value.

public long CalculateValue(EntityCore self, int level)

Parameters

self EntityCore

The entity providing values for self-scaling components.

level int

The level to use for calculating the base value.

Returns

long

The calculated value.

GetBaseValue()

Returns the fixed base value of the formula. If useScalingBaseValue is true, an exception is thrown because a level is required.

public long GetBaseValue()

Returns

long

The fixed base value.

Exceptions

AssertionException

Thrown if useScalingBaseValue is true, since a level must be specified in that case.

GetBaseValue(int)

Returns the base value of the formula for the specified level. If useScalingBaseValue is true, the value is calculated using the associated growth formula. If useScalingBaseValue is false and a level is provided, an exception is thrown.

public long GetBaseValue(int level)

Parameters

level int

The level to use for calculating the base value.

Returns

long

The calculated base value.

Exceptions

AssertionException

Thrown if the growth formula is not set, if the level is less than or equal to zero, if the level exceeds the maximum allowed by the growth formula, or if useScalingBaseValue is false and a level is provided.

ResetTmpScalings()

Clears all temporary scaling components for both "self" and "target".

public void ResetTmpScalings()