diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
commit | 72863ffa31e27f4c6be862d80472cfb897fccaea (patch) | |
tree | ce04be8d77b10c797c8ff854c8ff1a219eb1af46 /Effects/poison_effect.gd | |
parent | 63d2a59042fb9d90a586ad85d8364de7c38aea8e (diff) |
Diffstat (limited to 'Effects/poison_effect.gd')
-rw-r--r-- | Effects/poison_effect.gd | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Effects/poison_effect.gd b/Effects/poison_effect.gd new file mode 100644 index 0000000..b04786d --- /dev/null +++ b/Effects/poison_effect.gd @@ -0,0 +1,31 @@ +extends Effect + + +@onready var unit: Unit = get_parent() + +var level := 1 +var power := 0.0 + + +func _init() -> void: + is_stackable = true + + +func _ready(): + power = 1.0 + (level - 1) + + set_duration(2.0 + ((level - 1) * 0.1)) + + set_tick(1.0) + tick_finished.connect(func(): + unit.set_hp(unit.hp - power) + await get_tree().create_timer(0.1).timeout + ) + + +func add(): + unit.sprite.modulate += Color(0, 1, 0, 0) + + +func remove(): + unit.sprite.modulate -= Color(0, 1, 0, 0) |