Skip to content

Class: AbilityInstance ​

csharp
[LogicUpdatePriority(-200)]
public abstract class AbilityInstance : Actor, ILogicUpdate, ICleanup, ICustomDestroyRoutine

Fields ​

NameDeclarationDescription
budgetCost`[BoxGroup("Ability Instance Settings", true, false, 0)]
public int budgetCost`
chain`[NonSerialized]
public ReactionChain chain`If this instance is part of reaction, you can provide ReactionChain in this variable. Available only on server.
currentCostSumpublic static int currentCostSum
currentCostSumPerPlayerpublic static Dictionary<DewPlayer, int> currentCostSumPerPlayer
endEffect`[BoxGroup("Ability Instance Settings", true, false, 0)]
[LabelText("End Effect (Attached To Caster)")]
public GameObject endEffect`
maxBudgetpublic static int maxBudget
startEffect`[BoxGroup("Ability Instance Settings", true, false, 0)]
[LabelText("Loop Effect (Attached To Caster)")]
public GameObject startEffect`
startEffectNoStop`[BoxGroup("Ability Instance Settings", true, false, 0)]
[LabelText("Start Effect (Attached To Caster)")]
public GameObject startEffectNoStop`
tvDefaultAllExceptSelfprotected AbilityTargetValidatorWrapper tvDefaultAllExceptSelf
tvDefaultHarmfulEffectTargetsprotected AbilityTargetValidatorWrapper tvDefaultHarmfulEffectTargets
tvDefaultUsefulEffectTargetsprotected AbilityTargetValidatorWrapper tvDefaultUsefulEffectTargets
useBudgetSystempublic static bool useBudgetSystem

Properties ​

NameDeclarationDescription
budgetPressurepublic BudgetPressure budgetPressure { get; }Returns current budget pressure. Costly ability instances must adjust their resource spending according to this value.Requires budgetCost to be set to non-zero value.
effectiveLevelpublic int effectiveLevel { get; }
gempublic Gem gem { get; set; }If this instance is from a gem, you can access the gem from here.
hasOngoingSequencespublic bool hasOngoingSequences { get; }
info`[SaveVar(SaveVarFlags.Default)]
public CastInfo info { get; set; }`
skillLevel`[SaveVar(SaveVarFlags.Default)]
public int skillLevel { get; set; }`Level of its origin skill trigger at the time this instance was cast. Defaults to -1 or that of parent's level.Parent type can either be SkillTrigger, AbilityInstance, or Gem.You can override level by setting this field when the instance is preparing.
statEntitypublic Entity statEntity { get; }

Methods ​

Budget_ShouldDoFullCalculations() ​

Should this instance skip calculations? Based on current budget pressure.Use this as a default suggested behavior.

csharp
public bool Budget_ShouldDoFullCalculations()

Returns: bool

Budget_ShouldPlayEffects() ​

Should this instance play effects? Based on current budget pressure.Use this as a default suggested behavior.

csharp
public bool Budget_ShouldPlayEffects()

Returns: bool

CreateDamage(SourceType, ScalingValue, float) ​

csharp
public DamageData CreateDamage(DamageData.SourceType type, ScalingValue value, float procCoefficient = 1)

Parameters:

NameTypeDescription
typeDamageData.SourceType
valueScalingValue
procCoefficientfloat

Returns: DamageData

CreateStatusEffect<T>(T, Entity, Action<T>) ​

Create a new status effect and attach it to an entity.This can return null if the creation fails:e.g. Trying to apply a status effect with isKilledByUnstoppable flag to an unstoppable/invulnerable entity.

csharp
public T CreateStatusEffect<T>(T prefab, Entity victim, Action<T> beforePrepare = null) where T : StatusEffect

Parameters:

NameTypeDescription
prefabT
victimEntity
beforePrepareSystem.Action&lt;T&gt;&lt;T&gt;
``T

Returns: T

CreateStatusEffect&lt;T&gt;(Entity, Action&lt;T&gt;) ​

Create a new status effect and attach it to an entity.This can return null if the creation fails:e.g. Trying to apply a status effect with isKilledByUnstoppable flag to an unstoppable/invulnerable entity.

csharp
public T CreateStatusEffect<T>(Entity victim, Action<T> beforePrepare = null) where T : StatusEffect

Parameters:

NameTypeDescription
victimEntity
beforePrepareSystem.Action&lt;T&gt;&lt;T&gt;
``T

Returns: T

Damage(ScalingValue, float) ​

csharp
public DamageData Damage(ScalingValue value, float procCoefficient = 1)

Parameters:

NameTypeDescription
valueScalingValue
procCoefficientfloat

Returns: DamageData

DefaultDamage(ScalingValue, float) ​

csharp
public DamageData DefaultDamage(ScalingValue value, float procCoefficient = 1)

Parameters:

NameTypeDescription
valueScalingValue
procCoefficientfloat

Returns: DamageData

DestroyOnCondition(Func&lt;bool&gt;) ​

Kill this instance when condition is met.

csharp
public AbilityInstance.WatchedCondition DestroyOnCondition(Func<bool> condition)

Parameters:

NameTypeDescription
conditionSystem.Func&lt;TResult&gt;&lt;bool&gt;

Returns: AbilityInstance.WatchedCondition

DestroyOnDeath(Entity, bool) ​

Kill this instance when the specified entity dies/gets destroyed.

csharp
public void DestroyOnDeath(Entity entity, bool includeKnockOuts = false)

Parameters:

NameTypeDescription
entityEntity
includeKnockOutsbool

DestroyOnDestroy(Actor) ​

Remove this instance when the specified actor gets destroyed.

csharp
public void DestroyOnDestroy(Actor actor)

Parameters:

NameTypeDescription
actorActor

GetActorReadableName() ​

csharp
public override string GetActorReadableName()

Returns: string

GetValue(ScalingValue) ​

csharp
public float GetValue(ScalingValue val)

Parameters:

NameTypeDescription
valScalingValue

Returns: float

GetValue(StarScalingValue) ​

csharp
public float GetValue(StarScalingValue value)

Parameters:

NameTypeDescription
valueStarScalingValue

Returns: float

GetValue&lt;T&gt;(T[]) ​

csharp
public T GetValue<T>(T[] val)

Parameters:

NameTypeDescription
valT[]
``T

Returns: T

GetValueInt(StarScalingValue) ​

csharp
public int GetValueInt(StarScalingValue value)

Parameters:

NameTypeDescription
valueStarScalingValue

Returns: int

Heal(ScalingValue) ​

csharp
public HealData Heal(ScalingValue amount)

Parameters:

NameTypeDescription
amountScalingValue

Returns: HealData

LogicUpdate(float) ​

csharp
public override void LogicUpdate(float dt)

Parameters:

NameTypeDescription
dtfloat

MagicDamage(ScalingValue, float) ​

csharp
public DamageData MagicDamage(ScalingValue value, float procCoefficient = 1)

Parameters:

NameTypeDescription
valueScalingValue
procCoefficientfloat

Returns: DamageData

OnCreate() ​

csharp
protected override void OnCreate()

OnCreateSequenced() ​

Started everywhere when this ability instance is created, running on LogicUpdates.This will stop running when this instance gets killed.Return SequenceInstructions (e.g.new SI.WaitForSeconds()) to yield this sequence.Returning null has same effect ofnew SI.WaitForNextLogicUpdate().

csharp
protected virtual IEnumerator OnCreateSequenced()

Returns: System.Collections.IEnumerator

OnDestroyActor() ​

csharp
protected override void OnDestroyActor()

OnPrepare() ​

Called on server right before this instance to be spawned.Configure this instance's initial state here.By default this sets skillLevel to parent's level.Parent type can either be SkillTrigger, AbilityInstance, or Gem.

csharp
protected override void OnPrepare()

OnStart() ​

csharp
public override void OnStart()

PhysicalDamage(ScalingValue, float) ​

csharp
public DamageData PhysicalDamage(ScalingValue value, float procCoefficient = 1)

Parameters:

NameTypeDescription
valueScalingValue
procCoefficientfloat

Returns: DamageData

PhysicalMagicDamage(ScalingValue, float) ​

csharp
public DamageData PhysicalMagicDamage(ScalingValue value, float procCoefficient = 1)

Parameters:

NameTypeDescription
valueScalingValue
procCoefficientfloat

Returns: DamageData

PureDamage(ScalingValue, float) ​

csharp
public DamageData PureDamage(ScalingValue value, float procCoefficient = 1)

Parameters:

NameTypeDescription
valueScalingValue
procCoefficientfloat

Returns: DamageData

ResetBudget() ​

csharp
public static void ResetBudget()

StartChargingChannel(ChargingChannel) ​

csharp
public void StartChargingChannel(ChargingChannel channel)

Parameters:

NameTypeDescription
channelChargingChannel

StartSequence(IEnumerator) ​

Start a sequence that will run while this instance is alive on LogicUpdates.

csharp
protected void StartSequence(IEnumerator sequence)

Parameters:

NameTypeDescription
sequenceSystem.Collections.IEnumerator

Maintained by the Shape of Dreams Modding Community