waited far too long for an initial commit but here we are
This commit is contained in:
6
Scripts/StatusEffects/StatusOnFire.gd
Normal file
6
Scripts/StatusEffects/StatusOnFire.gd
Normal file
@ -0,0 +1,6 @@
|
||||
extends StatusEffect
|
||||
class_name StatusOnFire
|
||||
|
||||
|
||||
func proc():
|
||||
affected.damage(stats.potency)
|
44
Scripts/StatusEffects/status_effect.gd
Normal file
44
Scripts/StatusEffects/status_effect.gd
Normal file
@ -0,0 +1,44 @@
|
||||
extends Node
|
||||
class_name StatusEffect
|
||||
|
||||
signal expired(effect : StatusEffect)
|
||||
|
||||
var stats : StatusStats
|
||||
|
||||
var affected :
|
||||
set(value):
|
||||
affected = value
|
||||
on_attached()
|
||||
var cooldown := 0.0
|
||||
var other_cooldown := 0.0
|
||||
var time_existed := 0.0
|
||||
|
||||
|
||||
func on_attached():
|
||||
pass
|
||||
|
||||
|
||||
func on_removed():
|
||||
expired.emit(self)
|
||||
|
||||
|
||||
func proc():
|
||||
pass
|
||||
|
||||
|
||||
func _ready():
|
||||
other_cooldown = 1.0 / stats.proc_frequency
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
time_existed += delta
|
||||
if time_existed >= stats.duration:
|
||||
on_removed()
|
||||
queue_free()
|
||||
return
|
||||
if stats.proc_frequency > 0.0:
|
||||
cooldown += delta
|
||||
if cooldown >= other_cooldown:
|
||||
cooldown -= other_cooldown
|
||||
proc()
|
||||
|
18
Scripts/StatusEffects/status_sticky.gd
Normal file
18
Scripts/StatusEffects/status_sticky.gd
Normal file
@ -0,0 +1,18 @@
|
||||
extends StatusEffect
|
||||
class_name StatusSticky
|
||||
|
||||
|
||||
func on_attached():
|
||||
super.on_attached()
|
||||
affected.movement_speed = affected.stats.movement_speed * (1.0 - stats.potency)
|
||||
|
||||
|
||||
func on_removed():
|
||||
super.on_removed()
|
||||
var siblings = get_parent().get_children()
|
||||
var stickies = 0
|
||||
for node in siblings:
|
||||
if node is StatusSticky:
|
||||
stickies += 1
|
||||
if stickies == 1:
|
||||
affected.movement_speed = affected.stats.movement_speed
|
Reference in New Issue
Block a user