Moves modifier logic to utilize a central StatsComponent for managing and applying stat modifications. This change centralizes stat management and simplifies the application of modifiers, enhancing code maintainability and reducing redundancy. It also moves modifier files to the correct directory.
12 lines
459 B
GDScript
12 lines
459 B
GDScript
class_name FireRateAdditive extends Modifier
|
|
|
|
@export var fire_rate_bonus: float = 1.0 # +1 shot per second
|
|
|
|
func _init():
|
|
id = "fire_rate_additive"
|
|
display_name = "Rapid Fire"
|
|
description = "Increases fire rate by %0.1f shots per second" % fire_rate_bonus
|
|
modifier_type = ModifierType.ADDITIVE
|
|
|
|
func apply_stats_modification(stats: StatsComponent) -> void:
|
|
stats.update_stat("ranged.attack_rate", stats.get_stat("ranged.attack_rate") + fire_rate_bonus)
|