class_name PiercingModifier extends Modifier

@export var pierce_count: int = 2

func _init():
		id = "piercing"
		display_name = "Piercing Shot"
		description = "Projectiles pass through %d enemies" % pierce_count

func modify_projectile(projectile):
		projectile.pierce_count = pierce_count
		projectile.connect("on_hit", _on_projectile_hit)
    
func _on_projectile_hit(projectile, _target):
		projectile.pierce_count -= 1
		if projectile.pierce_count <= 0:
			projectile.pierce_count = 0
			projectile.set_piercing(false)