28 lines
732 B
GDScript
28 lines
732 B
GDScript
class_name StatusEffect
|
|
extends Resource
|
|
## A status effect is a temporary effect that can be applied to a creature.
|
|
|
|
## Duration of the status effect in seconds.
|
|
@export var duration: float = 0.0
|
|
|
|
## Magnitude of the status effect.
|
|
@export var magnitude: float = 0.0
|
|
|
|
|
|
## Apply the status effect to a creature.
|
|
func apply(creature: Creature) -> void:
|
|
if self.has_method("_apply"):
|
|
self.call("_apply", creature)
|
|
|
|
|
|
## Remove the status effect from a creature.
|
|
func remove(creature: Creature) -> void:
|
|
if self.has_method("_remove"):
|
|
self.call("_remove", creature)
|
|
|
|
|
|
## Tick the status effect on a creature.
|
|
func tick(creature: Creature, delta: float) -> void:
|
|
if self.has_method("_tick"):
|
|
self.call("_tick", creature, delta)
|