Class AbilityInstance
Ability instance is an instance of spell / ability / skill, usually cast by an entity.
e.g. Flying fireball, basic attack projectiles, meteor rain spawner
Inheritance
object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
Mirror.NetworkBehaviour
AbilityInstance
Assembly: Dew.Core.dll
Syntax
[LogicUpdatePriority(-200)]
public abstract class AbilityInstance : Actor, ILogicUpdate, ICleanup, ICustomDestroyRoutine
Fields
budgetCost
Declaration
[BoxGroup("Ability Instance Settings", true, false, 0)]
public int budgetCost
Field Value
chain
If this instance is part of reaction, you can provide ReactionChain in this variable.
Available only on server.
Declaration
[NonSerialized]
public ReactionChain chain
Field Value
currentCostSum
Declaration
public static int currentCostSum
Field Value
currentCostSumPerPlayer
Declaration
public static Dictionary<DewPlayer, int> currentCostSumPerPlayer
Field Value
| Type |
Description |
| System.Collections.Generic.Dictionary<TKey, TValue><DewPlayer, int> |
|
endEffect
Declaration
[BoxGroup("Ability Instance Settings", true, false, 0)]
[LabelText("End Effect (Attached To Caster)")]
public GameObject endEffect
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
maxBudget
Declaration
public static int maxBudget
Field Value
startEffect
Declaration
[BoxGroup("Ability Instance Settings", true, false, 0)]
[LabelText("Loop Effect (Attached To Caster)")]
public GameObject startEffect
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
startEffectNoStop
Declaration
[BoxGroup("Ability Instance Settings", true, false, 0)]
[LabelText("Start Effect (Attached To Caster)")]
public GameObject startEffectNoStop
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
tvDefaultAllExceptSelf
Declaration
protected AbilityTargetValidatorWrapper tvDefaultAllExceptSelf
Field Value
tvDefaultHarmfulEffectTargets
Declaration
protected AbilityTargetValidatorWrapper tvDefaultHarmfulEffectTargets
Field Value
tvDefaultUsefulEffectTargets
Declaration
protected AbilityTargetValidatorWrapper tvDefaultUsefulEffectTargets
Field Value
useBudgetSystem
Declaration
public static bool useBudgetSystem
Field Value
Properties
budgetPressure
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.
Declaration
public BudgetPressure budgetPressure { get; }
Property Value
effectiveLevel
Declaration
public int effectiveLevel { get; }
Property Value
gem
If this instance is from a gem, you can access the gem from here.
Declaration
public Gem gem { get; set; }
Property Value
hasOngoingSequences
Declaration
public bool hasOngoingSequences { get; }
Property Value
info
Declaration
[SaveVar(SaveVarFlags.Default)]
public CastInfo info { get; set; }
Property Value
skillLevel
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.
Declaration
[SaveVar(SaveVarFlags.Default)]
public int skillLevel { get; set; }
Property Value
statEntity
Declaration
public Entity statEntity { get; }
Property Value
Methods
Budget_ShouldDoFullCalculations()
Should this instance skip calculations? Based on current budget pressure.
Use this as a default suggested behavior.
Declaration
public bool Budget_ShouldDoFullCalculations()
Returns
Budget_ShouldPlayEffects()
Should this instance play effects? Based on current budget pressure.
Use this as a default suggested behavior.
Declaration
public bool Budget_ShouldPlayEffects()
Returns
CreateDamage(SourceType, ScalingValue, float)
Declaration
public DamageData CreateDamage(DamageData.SourceType type, ScalingValue value, float procCoefficient = 1)
Parameters
Returns
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.
Declaration
public T CreateStatusEffect<T>(T prefab, Entity victim, Action<T> beforePrepare = null) where T : StatusEffect
Parameters
| Type |
Name |
Description |
| T |
prefab |
|
| Entity |
victim |
|
| System.Action<T><T> |
beforePrepare |
|
Returns
Type Parameters
CreateStatusEffect<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.
Declaration
public T CreateStatusEffect<T>(Entity victim, Action<T> beforePrepare = null) where T : StatusEffect
Parameters
| Type |
Name |
Description |
| Entity |
victim |
|
| System.Action<T><T> |
beforePrepare |
|
Returns
Type Parameters
Damage(ScalingValue, float)
Declaration
public DamageData Damage(ScalingValue value, float procCoefficient = 1)
Parameters
| Type |
Name |
Description |
| ScalingValue |
value |
|
| float |
procCoefficient |
|
Returns
DefaultDamage(ScalingValue, float)
Declaration
public DamageData DefaultDamage(ScalingValue value, float procCoefficient = 1)
Parameters
| Type |
Name |
Description |
| ScalingValue |
value |
|
| float |
procCoefficient |
|
Returns
DestroyOnCondition(Func<bool>)
Kill this instance when condition is met.
Declaration
public AbilityInstance.WatchedCondition DestroyOnCondition(Func<bool> condition)
Parameters
| Type |
Name |
Description |
| System.Func<TResult><bool> |
condition |
|
Returns
DestroyOnDeath(Entity, bool)
Kill this instance when the specified entity dies/gets destroyed.
Declaration
public void DestroyOnDeath(Entity entity, bool includeKnockOuts = false)
Parameters
| Type |
Name |
Description |
| Entity |
entity |
|
| bool |
includeKnockOuts |
|
DestroyOnDestroy(Actor)
Remove this instance when the specified actor gets destroyed.
Declaration
public void DestroyOnDestroy(Actor actor)
Parameters
| Type |
Name |
Description |
| Actor |
actor |
|
GetActorReadableName()
Declaration
public override string GetActorReadableName()
Returns
Overrides
GetValue(ScalingValue)
Declaration
public float GetValue(ScalingValue val)
Parameters
Returns
GetValue(StarScalingValue)
Declaration
public float GetValue(StarScalingValue value)
Parameters
Returns
GetValue<T>(T[])
Declaration
public T GetValue<T>(T[] val)
Parameters
| Type |
Name |
Description |
| T[] |
val |
|
Returns
Type Parameters
GetValueInt(StarScalingValue)
Declaration
public int GetValueInt(StarScalingValue value)
Parameters
Returns
Heal(ScalingValue)
Declaration
public HealData Heal(ScalingValue amount)
Parameters
Returns
LogicUpdate(float)
Declaration
public override void LogicUpdate(float dt)
Parameters
| Type |
Name |
Description |
| float |
dt |
|
Overrides
MagicDamage(ScalingValue, float)
Declaration
public DamageData MagicDamage(ScalingValue value, float procCoefficient = 1)
Parameters
| Type |
Name |
Description |
| ScalingValue |
value |
|
| float |
procCoefficient |
|
Returns
OnCreate()
Declaration
protected override void OnCreate()
Overrides
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 of new SI.WaitForNextLogicUpdate().
Declaration
protected virtual IEnumerator OnCreateSequenced()
Returns
| Type |
Description |
| System.Collections.IEnumerator |
|
OnDestroyActor()
Declaration
protected override void OnDestroyActor()
Overrides
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.
Declaration
protected override void OnPrepare()
Overrides
OnStart()
Declaration
public override void OnStart()
Overrides
PhysicalDamage(ScalingValue, float)
Declaration
public DamageData PhysicalDamage(ScalingValue value, float procCoefficient = 1)
Parameters
| Type |
Name |
Description |
| ScalingValue |
value |
|
| float |
procCoefficient |
|
Returns
PhysicalMagicDamage(ScalingValue, float)
Declaration
public DamageData PhysicalMagicDamage(ScalingValue value, float procCoefficient = 1)
Parameters
| Type |
Name |
Description |
| ScalingValue |
value |
|
| float |
procCoefficient |
|
Returns
PureDamage(ScalingValue, float)
Declaration
public DamageData PureDamage(ScalingValue value, float procCoefficient = 1)
Parameters
| Type |
Name |
Description |
| ScalingValue |
value |
|
| float |
procCoefficient |
|
Returns
ResetBudget()
Declaration
public static void ResetBudget()
StartChargingChannel(ChargingChannel)
Declaration
public void StartChargingChannel(ChargingChannel channel)
Parameters
StartSequence(IEnumerator)
Start a sequence that will run while this instance is alive on LogicUpdates.
Declaration
protected void StartSequence(IEnumerator sequence)
Parameters
| Type |
Name |
Description |
| System.Collections.IEnumerator |
sequence |
|
Implements
Extension Methods