Skip to content

StatusEffectComponent ​

Inherits: RefCounted

Manages StatusEffectDefinition processing, diminishing returns, and immunity requests

Variables ​

Dictionaryactive_immunities{} # Key: status_effect_id, Value: number of active immun...
Dictionarystatus_effect_applications{} # Key: status_effect_id, Value: ApplicationTracker
ChronoManagerchrono_manager

Methods ​

voidset_immunity_active( status_effect_id: int, active: bool )
boolis_immune_to_status_effect( status_effect_id: int )
Array[int]get_active_immunities()
Dictionaryprocess_status_effect_application( status_effect_id: int, base_duration: float, source_entity: Variant = null, effect: EffectInstance = null )
intget_status_effect_application_count( status_effect_id: int )
boolis_currently_affected_by( status_effect_id: int )
Dictionaryget_all_tracked_applications()
Array[int]get_currently_active_status_effects()
boolhas_any_tracked_applications()
boolhas_any_active_immunities()
boolshould_break_status_effect( status_effect_id: int, damage_amount: float, current_health: float, max_health: float )
Dictionaryget_preview_for_next_application( status_effect_id: int, base_duration: float )
voidreset_all_application_trackers()
voidclear_immunity_state()
voidcleanup()
Arrayto_save_data()
voidfrom_save_data( data: Array )

Signals ​

immunity_requested( immunity_id: int, duration: float ) ​

========== SIGNALS ========== Immunity request signal - Entity should connect this to ImmunityComponent

status_effect_blocked_by_immunity( status_effect_id: int, immunity_id: int, source_entity: Variant, effect: EffectInstance ) ​

Enhanced status effect blocking events with context

status_effect_application_tracked( status_effect_id: int, application_count: int, effective_duration: float, source_entity: Variant, effect: EffectInstance ) ​

Enhanced application tracking events (for diminishing returns) with context

Variable descriptions ​

Dictionary active_immunities = # Key: status_effect_id, Value: number of active immunities ​

========== CORE PROPERTIES ========== Current immunity status (updated by Entity via ImmunityComponent signals)

Dictionary status_effect_applications = # Key: status_effect_id, Value: ApplicationTracker ​

Application tracking for diminishing returns - NO LONGER USES DELTA PROCESSING

ChronoManager chrono_manager ​

ChronoManager ref

Method descriptions ​

void set_immunity_active( status_effect_id: int, active: bool ) ​

Tells the component that an immunity covering this status effect began (active) or ended. Several immunities can cover one status effect, so they are counted: the protection ends when the last one ends

bool is_immune_to_status_effect( status_effect_id: int ) ​

Is at least one immunity covering this status effect right now?

Array[int] get_active_immunities() ​

The ids of the status effects the entity is immune to right now

Dictionary process_status_effect_application( status_effect_id: int, base_duration: float, source_entity: Variant = null, effect: EffectInstance = null ) ​

Works out what applying a status effect would do, and counts the application. Returns a dictionary: can_apply, effective_duration (the base duration shortened by diminishing returns), application_count, was_blocked, immunity_will_be_granted, immunity_id, immunity_duration and blocking_reason. An immune entity gets can_apply false. Asks for the temporary immunity when the definition grants one

int get_status_effect_application_count( status_effect_id: int ) ​

How many times this status effect was applied inside its reset window

bool is_currently_affected_by( status_effect_id: int ) ​

Is the entity not immune to the status effect, and has it been applied inside its reset window?

Dictionary get_all_tracked_applications() ​

A dictionary: status effect id to the number of applications counted

Array[int] get_currently_active_status_effects() ​

The ids of the status effects the entity is currently affected by

bool has_any_tracked_applications() ​

True when any status effect has been tracked

bool has_any_active_immunities() ​

True when any immunity covers a status effect right now

bool should_break_status_effect( status_effect_id: int, damage_amount: float, current_health: float, max_health: float ) ​

Does a hit of this size end the status effect? Asks the definition (break on damage and its threshold)

Dictionary get_preview_for_next_application( status_effect_id: int, base_duration: float ) ​

What the next application would do, without counting it: can_apply, would_be_blocked, current_applications, next_application_count, effective_duration, would_grant_immunity, immunity_name and blocking_reason

void reset_all_application_trackers() ​

Sets every diminishing returns counter back to 0

void clear_immunity_state() ​

Forgets which status effects the entity is immune to (when it dies or resets)

void cleanup() ​

Clears the immunity state and the application trackers

Array to_save_data() ​

The diminishing-returns counters (stun applications and so on) with the time their reset timer has left

void from_save_data( data: Array ) ​

Restores the counters of to_save_data