Class: AbilityInstance
- Namespace:
Global - Assembly:
Dew.Core.dll - Inheritance / Derived: DewNetworkBehaviour → Actor → DamageInstance → MeleeAttackInstance → MockAbilityInstance → PickupInstance → Projectile → PunishmentInstance → StatusEffect
[LogicUpdatePriority(-200)]
public abstract class AbilityInstance : Actor, ILogicUpdate, ICleanup, ICustomDestroyRoutineFields
| Name | Declaration | Description |
|---|---|---|
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. | |
currentCostSum | public static int currentCostSum | |
currentCostSumPerPlayer | public static Dictionary<DewPlayer, int> currentCostSumPerPlayer | |
endEffect | `[BoxGroup("Ability Instance Settings", true, false, 0)] | |
| [LabelText("End Effect (Attached To Caster)")] | ||
| public GameObject endEffect` | ||
maxBudget | public 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` | ||
tvDefaultAllExceptSelf | protected AbilityTargetValidatorWrapper tvDefaultAllExceptSelf | |
tvDefaultHarmfulEffectTargets | protected AbilityTargetValidatorWrapper tvDefaultHarmfulEffectTargets | |
tvDefaultUsefulEffectTargets | protected AbilityTargetValidatorWrapper tvDefaultUsefulEffectTargets | |
useBudgetSystem | public static bool useBudgetSystem |
Properties
| Name | Declaration | Description |
|---|---|---|
budgetPressure | public 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. |
effectiveLevel | public int effectiveLevel { get; } | |
gem | public Gem gem { get; set; } | If this instance is from a gem, you can access the gem from here. |
hasOngoingSequences | public 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. | |
statEntity | public Entity statEntity { get; } |
Methods
Budget_ShouldDoFullCalculations()
Should this instance skip calculations? Based on current budget pressure.Use this as a default suggested behavior.
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.
public bool Budget_ShouldPlayEffects()Returns: bool
CreateDamage(SourceType, ScalingValue, float)
public DamageData CreateDamage(DamageData.SourceType type, ScalingValue value, float procCoefficient = 1)Parameters:
| Name | Type | Description |
|---|---|---|
type | DamageData.SourceType | |
value | ScalingValue | |
procCoefficient | float |
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.
public T CreateStatusEffect<T>(T prefab, Entity victim, Action<T> beforePrepare = null) where T : StatusEffectParameters:
| Name | Type | Description |
|---|---|---|
prefab | T | |
victim | Entity | |
beforePrepare | System.Action<T><T> | |
| `` | T |
Returns: T
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.
public T CreateStatusEffect<T>(Entity victim, Action<T> beforePrepare = null) where T : StatusEffectParameters:
| Name | Type | Description |
|---|---|---|
victim | Entity | |
beforePrepare | System.Action<T><T> | |
| `` | T |
Returns: T
Damage(ScalingValue, float)
public DamageData Damage(ScalingValue value, float procCoefficient = 1)Parameters:
| Name | Type | Description |
|---|---|---|
value | ScalingValue | |
procCoefficient | float |
Returns: DamageData
DefaultDamage(ScalingValue, float)
public DamageData DefaultDamage(ScalingValue value, float procCoefficient = 1)Parameters:
| Name | Type | Description |
|---|---|---|
value | ScalingValue | |
procCoefficient | float |
Returns: DamageData
DestroyOnCondition(Func<bool>)
Kill this instance when condition is met.
public AbilityInstance.WatchedCondition DestroyOnCondition(Func<bool> condition)Parameters:
| Name | Type | Description |
|---|---|---|
condition | System.Func<TResult><bool> |
Returns: AbilityInstance.WatchedCondition
DestroyOnDeath(Entity, bool)
Kill this instance when the specified entity dies/gets destroyed.
public void DestroyOnDeath(Entity entity, bool includeKnockOuts = false)Parameters:
| Name | Type | Description |
|---|---|---|
entity | Entity | |
includeKnockOuts | bool |
DestroyOnDestroy(Actor)
Remove this instance when the specified actor gets destroyed.
public void DestroyOnDestroy(Actor actor)Parameters:
| Name | Type | Description |
|---|---|---|
actor | Actor |
GetActorReadableName()
public override string GetActorReadableName()Returns: string
GetValue(ScalingValue)
public float GetValue(ScalingValue val)Parameters:
| Name | Type | Description |
|---|---|---|
val | ScalingValue |
Returns: float
GetValue(StarScalingValue)
public float GetValue(StarScalingValue value)Parameters:
| Name | Type | Description |
|---|---|---|
value | StarScalingValue |
Returns: float
GetValue<T>(T[])
public T GetValue<T>(T[] val)Parameters:
| Name | Type | Description |
|---|---|---|
val | T[] | |
| `` | T |
Returns: T
GetValueInt(StarScalingValue)
public int GetValueInt(StarScalingValue value)Parameters:
| Name | Type | Description |
|---|---|---|
value | StarScalingValue |
Returns: int
Heal(ScalingValue)
public HealData Heal(ScalingValue amount)Parameters:
| Name | Type | Description |
|---|---|---|
amount | ScalingValue |
Returns: HealData
LogicUpdate(float)
public override void LogicUpdate(float dt)Parameters:
| Name | Type | Description |
|---|---|---|
dt | float |
MagicDamage(ScalingValue, float)
public DamageData MagicDamage(ScalingValue value, float procCoefficient = 1)Parameters:
| Name | Type | Description |
|---|---|---|
value | ScalingValue | |
procCoefficient | float |
Returns: DamageData
OnCreate()
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().
protected virtual IEnumerator OnCreateSequenced()Returns: System.Collections.IEnumerator
OnDestroyActor()
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.
protected override void OnPrepare()OnStart()
public override void OnStart()PhysicalDamage(ScalingValue, float)
public DamageData PhysicalDamage(ScalingValue value, float procCoefficient = 1)Parameters:
| Name | Type | Description |
|---|---|---|
value | ScalingValue | |
procCoefficient | float |
Returns: DamageData
PhysicalMagicDamage(ScalingValue, float)
public DamageData PhysicalMagicDamage(ScalingValue value, float procCoefficient = 1)Parameters:
| Name | Type | Description |
|---|---|---|
value | ScalingValue | |
procCoefficient | float |
Returns: DamageData
PureDamage(ScalingValue, float)
public DamageData PureDamage(ScalingValue value, float procCoefficient = 1)Parameters:
| Name | Type | Description |
|---|---|---|
value | ScalingValue | |
procCoefficient | float |
Returns: DamageData
ResetBudget()
public static void ResetBudget()StartChargingChannel(ChargingChannel)
public void StartChargingChannel(ChargingChannel channel)Parameters:
| Name | Type | Description |
|---|---|---|
channel | ChargingChannel |
StartSequence(IEnumerator)
Start a sequence that will run while this instance is alive on LogicUpdates.
protected void StartSequence(IEnumerator sequence)Parameters:
| Name | Type | Description |
|---|---|---|
sequence | System.Collections.IEnumerator |