31 lines
998 B
GDScript
31 lines
998 B
GDScript
# weapon.gd
|
||
extends Resource
|
||
class_name iWeapon
|
||
# This acts as an interface base class.
|
||
|
||
# --- Common Stats ---
|
||
@export var weapon_name: String = "Unnamed Weapon"
|
||
@export var damage: float = 10.0
|
||
@export var attack_speed: float = 1.0 # attacks per second
|
||
@export var range: float = 1.5 # meters; melee = short, ranged = long
|
||
@export var knockback: float = 0.0
|
||
@export var stamina_cost: float = 5.0
|
||
|
||
# --- Ranged‑specific Stats ---
|
||
@export var projectile_scene: PackedScene # null for melee
|
||
@export var projectile_speed: float = 20.0
|
||
@export var ammo_type: String = "" # e.g. "arrows", "bullets"
|
||
@export var ammo_per_shot: int = 1
|
||
|
||
# --- Melee‑specific Stats ---
|
||
@export var swing_arc: float = 90.0 # degrees
|
||
@export var hitbox_size: float = 1.0
|
||
|
||
# --- Interface Methods ---
|
||
func attack(user):
|
||
push_error("Weapon.attack() not implemented in subclass")
|
||
return null
|
||
|
||
func can_attack(user) -> bool:
|
||
return true
|