ASAbilitySpec
Inherits:
RefCountedRuntime instance of an ability.
Description
[ASAbilitySpec] represents an unlocked ability. It stores runtime state and provides methods to query execution data like cooldowns and costs.
Methods
| Return | Name |
|---|---|
void | add_sub_spec(
spec: ASAbilitySpec) |
Adds a sub-ability spec to this parent spec’s lifecycle. | |
ASAbility | get_ability(
)
const |
Returns the ability resource. | |
ASEffectSpec[] | get_active_effects(
)
const |
Returns all active effect instances created and managed by this specific ability execution. | |
float | get_cooldown_duration(
)
const |
Returns the base cooldown duration defined in the ability. | |
float | get_cooldown_remaining(
)
const |
Returns the time remaining for the cooldown on the owner ASC. | |
float | get_cost_amount(
attribute: StringName)
const |
Returns the cost for a specific attribute. | |
int | get_current_phase_index(
)
const |
Returns the index of the currently active phase. | |
float | get_duration_remaining(
)
const |
Returns the time remaining in seconds for the current phase or ability duration. | |
ASEffect[] | get_effects_for_target(
target_type: int)
const |
Returns effects filtered by their target type ([constant ASEffect.TARGET_SELF] or [constant ASEffect.TARGET_OTHERS]). | |
bool | get_is_active(
)
const |
Returns true if the ability is currently running. | |
int | get_level(
)
const |
Returns the level of this instance. | |
ASComponent | get_owner(
)
const |
Returns the component that owns this spec. | |
ASAbilitySpec[] | get_sub_specs(
)
const |
Returns the list of active sub-specs (phases or sub-abilities) managed by this spec. | |
float | get_total_duration(
)
const |
Returns the initial total duration of the ability instance as calculated at activation. | |
void | init(
ability: ASAbility, level: int = 1) |
Initializes the spec. | |
bool | is_on_cooldown(
)
const |
Returns true if the ability tag is currently on cooldown. | |
void | remove_sub_spec(
spec: ASAbilitySpec) |
Removes a sub-ability spec. | |
void | set_duration_remaining(
duration: float) |
Manually modifies the remaining duration. Can be used for duration extensions or reductions. | |
void | set_is_active(
active: bool) |
Sets the active state. | |
void | set_level(
level: int) |
Sets the instance level. | |
void | set_total_duration(
duration: float) |
Sets the total expected duration for this instance. This value is used as the reference for progress calculations. | |
bool | tick(
delta: float) |
Advances the internal timers of the spec. Returns true if the duration has expired or the ability logic has signaled completion. | |