ChargeStackActiveAbilityDefinition ​
Inherits: ActiveAbilityDefinition < PassiveAbilityDefinition < AbilityDefinition < DatabaseResource < Resource
Charge-based ability system with configurable regeneration modes.
Description ​
SHARED mode (default): Sequential charge regeneration like most games. INDEPENDENT mode: Parallel charge regeneration for burst abilities.
Properties ​
int | max_charges | 2 |
bool | start_with_full_charges | true |
StackCooldownType | charge_regeneration_mode | StackCooldownType.SHARED |
Methods ​
void | handle_completion( ability_instance: AbilityInstance ) |
AbilityInstance.AbilityUseAttemptResult | validate_ability_usage( ability_instance: AbilityInstance, from_action: bool ) |
void | cleanup_ability_logic( ability_instance: AbilityInstance ) |
void | initialize_charge_system( ability_instance: AbilityInstance ) |
float | get_next_charge_time_remaining( ability_instance: AbilityInstance ) |
bool | has_charges_available( ability_instance: AbilityInstance ) |
bool | is_at_max_charges( ability_instance: AbilityInstance ) |
float | get_full_recharge_time( ability_instance: AbilityInstance ) |
float | get_charge_utilization_percent( ability_instance: AbilityInstance ) |
void | force_regenerate_charges( ability_instance: AbilityInstance, charge_count: int ) |
void | reset_charges_to_max( ability_instance: AbilityInstance ) |
Dictionary | get_charge_system_info( ability_instance: AbilityInstance ) |
bool | should_show_cooldown_ui( ability_instance: AbilityInstance ) |
String | get_tooltip_description() |
void | restore_regeneration( ability_instance: AbilityInstance, cooldown_remaining: float, independent_remaining: Array ) |
Enumerations ​
enum StackCooldownType ​
The options of stack cooldown type: shared, independent.
- SHARED =
0- One shared cooldown - charges regenerate sequentially (default) - INDEPENDENT =
1- Each charge has its own timer - charges can regenerate simultaneously
Property descriptions ​
Charge Stack Settings
int max_charges = 2 ​
Maximum number of charges this ability can hold
bool start_with_full_charges = true ​
Whether to start with full charges (true) or build them up over time (false = start with 1)
Charge Regeneration Mode
StackCooldownType charge_regeneration_mode = StackCooldownType.SHARED ​
How charges come back: shared (one after the other) or independent (each has its own timer).
Method descriptions ​
void handle_completion( ability_instance: AbilityInstance ) ​
Uses up a charge and starts its regeneration.
AbilityInstance.AbilityUseAttemptResult validate_ability_usage( ability_instance: AbilityInstance, from_action: bool ) ​
Checks whether the user can use the ability: it needs a charge.
void cleanup_ability_logic( ability_instance: AbilityInstance ) ​
Stops the charge timers.
void initialize_charge_system( ability_instance: AbilityInstance ) ​
Sets the charges and their timers up for an ability instance.
float get_next_charge_time_remaining( ability_instance: AbilityInstance ) ​
How many seconds until the next charge comes back.
bool has_charges_available( ability_instance: AbilityInstance ) ​
Does the ability have a charge to use?
bool is_at_max_charges( ability_instance: AbilityInstance ) ​
Does the ability have all its charges?
float get_full_recharge_time( ability_instance: AbilityInstance ) ​
How many seconds until every charge is back.
float get_charge_utilization_percent( ability_instance: AbilityInstance ) ​
The charges left as a percentage of the maximum.
void force_regenerate_charges( ability_instance: AbilityInstance, charge_count: int ) ​
Gives charges back at once (not above the maximum).
void reset_charges_to_max( ability_instance: AbilityInstance ) ​
Gives every charge back and stops the timers.
Dictionary get_charge_system_info( ability_instance: AbilityInstance ) ​
The state of the charges as a dictionary (current, maximum, regenerating ...).
bool should_show_cooldown_ui( ability_instance: AbilityInstance ) ​
Should the interface show a cooldown (a charge is missing and one is coming back)?
String get_tooltip_description() ​
The text of the tooltip, with the charges.
void restore_regeneration( ability_instance: AbilityInstance, cooldown_remaining: float, independent_remaining: Array ) ​
Brings charge regeneration back after a load: cooldown_remaining is what was left of the shared cooldown, independent_remaining the time left of each independent charge timer (-1 = not running). Missing charges with nothing saved regenerate from the start