# Attack.gd
# Ressource für Angriffe — Schaden, Reichweite und Cooldown kommen von der ausgerüsteten Waffe
extends Resource
class_name Attack

enum DamageType { PHYSICAL, FIRE, ICE, LIGHTNING, POISON }

@export var name: String = "Unbenannt"
@export var damage_type: DamageType = DamageType.PHYSICAL
@export var icon: Texture2D = null

# Schaden berechnen — ohne Waffe = 1
func get_damage(weapon: Weapon) -> int:
	if weapon == null or weapon.weapon_type == Weapon.WeaponType.UNARMED:
		return 1
	return randi_range(weapon.min_damage, weapon.max_damage)

# Reichweite — ohne Waffe = 1.5
func get_range(weapon: Weapon) -> float:
	if weapon == null or weapon.weapon_type == Weapon.WeaponType.UNARMED:
		return 1.5
	return weapon.range

# Cooldown — ohne Waffe = 1.5s
func get_cooldown(weapon: Weapon) -> float:
	if weapon == null or weapon.weapon_type == Weapon.WeaponType.UNARMED:
		return 1.5
	return weapon.attack_speed
