Adds a modifier and stats system to manage combat-related attributes. Introduces StatsComponent for storing entity statistics and ModifierManager for applying dynamic modifiers. Recalculates stats based on modifier type and priority. Updates projectile and weapon components to utilize the new stats system.
31 lines
No EOL
565 B
GDScript
31 lines
No EOL
565 B
GDScript
extends Area2D
|
|
class_name ProjectileBaseTwo
|
|
|
|
var lifetime_timer: Timer
|
|
|
|
var direction: Vector2
|
|
var target_position: Vector2
|
|
var ELEMENTS = Global.ELEMENTS
|
|
|
|
var has_collided: bool = false
|
|
|
|
var stats = {
|
|
"speed": 500.0,
|
|
"damage": 10.0,
|
|
"element": ELEMENTS.NONE,
|
|
"lifetime": 2,
|
|
"pierce_count": 0
|
|
}
|
|
|
|
func set_stat(stat_name: String, value: Variant):
|
|
stats[stat_name] = value
|
|
|
|
func get_stat(stat_name: String) -> Variant:
|
|
return stats.get(stat_name, null)
|
|
|
|
func destroy():
|
|
emit_signal("on_destroyed", self)
|
|
queue_free()
|
|
|
|
func _on_lifetime_timeout():
|
|
destroy() |