summaryrefslogtreecommitdiff
path: root/Effects/poison_effect.gd
blob: b04786d85af3a810158caa4f682f0a6861b2f3ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)