Skip to content

ImmunityInstance ​

Inherits: RefCounted

Individual immunity instance that tracks a specific active immunity

Variables ​

ImmunityDefinitiondefinition
intimmunity_id
floatduration
Timertimer
ChronoManagerchrono_manager
boolpermanentfalse

Methods ​

floatget_time_remaining()
boolis_active()
boolis_immune_to( target: int )
ImmunityDefinition.ImmunityTypeget_immunity_type()
Stringget_immunity_type_string()
Stringget_display_string()
Dictionaryget_state_info()
Dictionaryto_save_data()
voidcleanup()

Signals ​

immunity_expired( immunity_instance: ImmunityInstance ) ​

========== SIGNALS ==========

time_remaining_changed( immunity_instance: ImmunityInstance, time_remaining: float ) ​

Emitted when the time left of the immunity changes.

Variable descriptions ​

ImmunityDefinition definition ​

========== CORE PROPERTIES ==========

int immunity_id ​

The id of the immunity.

float duration ​

How many seconds the immunity lasts (negative: until it is turned off).

Timer timer ​

The timer of the immunity.

ChronoManager chrono_manager ​

The manager of timers.

bool permanent = false ​

A permanent immunity has no timer and never expires (entity-wide immunities from StatsData)

Method descriptions ​

float get_time_remaining() ​

Seconds left (-1 for a permanent immunity, 0 when it has ended)

bool is_active() ​

Is the immunity running? A permanent one always is

bool is_immune_to( target: int ) ​

Does the immunity cover this target (a damage type, a status effect or a school id, by its type)? The exclusions of the definition are left out

ImmunityDefinition.ImmunityType get_immunity_type() ​

The type of the definition: damage type, status effect or school

String get_immunity_type_string() ​

The type as text, such as "DAMAGE_TYPE"

String get_display_string() ​

A line for the interface: the name and the seconds remaining

Dictionary get_state_info() ​

A dictionary with the id, name, duration, time remaining, type, protected targets and exclusions, for debugging and the editor

Dictionary to_save_data() ​

The id, duration, time remaining and whether it is permanent

void cleanup() ​

Stops and returns the timer