game: add weapon mod system
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
class_name WeaponBase
|
||||
extends Node2D
|
||||
|
||||
enum WeaponTag {
|
||||
CAN_RETURN,
|
||||
CAN_BLEED,
|
||||
}
|
||||
|
||||
@export var attack_cd: float
|
||||
@export var attack_damage: float
|
||||
@export var attack_aoe: float
|
||||
@export var attack_duration: float
|
||||
@export var attack_range: float
|
||||
@export var attack_crit_chance: float = 0.05
|
||||
@export var tags: Array[String] = []
|
||||
@export var modifiers: Array[WeaponModBase] = []
|
||||
|
||||
@onready var active_cd_timer: Timer = $ActiveCDTimer
|
||||
|
||||
@@ -25,6 +33,10 @@ func do_active() -> void:
|
||||
_do_active()
|
||||
|
||||
|
||||
func add_mod(mod: WeaponModBase) -> void:
|
||||
modifiers.append(mod)
|
||||
|
||||
|
||||
func _do_active() -> void:
|
||||
push_error("%s does not implement do_active" % self)
|
||||
|
||||
@@ -53,3 +65,14 @@ func find_target_in_radius() -> EnemyBase:
|
||||
):
|
||||
closest = c
|
||||
return closest
|
||||
|
||||
|
||||
func get_calculated(key: String) -> Variant:
|
||||
return WeaponModBase.get_calculated(self, key)
|
||||
|
||||
|
||||
func has_property(key: String) -> bool:
|
||||
for prop in get_property_list():
|
||||
if prop.name == key:
|
||||
return true
|
||||
return false
|
||||
|
Reference in New Issue
Block a user