69 lines
1.9 KiB
GDScript
69 lines
1.9 KiB
GDScript
## Configuration data for enemy waves.
|
|
##
|
|
## Defines spawn count, timing, enemy stats, and difficulty modifiers for each wave.
|
|
## Designed to be saved as a Resource (.tres file) for easy encounter design.
|
|
class_name WaveConfig
|
|
extends Resource
|
|
|
|
## Wave number (1-indexed)
|
|
@export var wave_number: int = 1
|
|
|
|
## Number of enemies to spawn in this wave
|
|
@export var enemy_count: int = 3
|
|
|
|
## Interval between enemy spawns in seconds
|
|
@export var spawn_interval: float = 1.0
|
|
|
|
## Enemy falling speed (units per second on Y-axis)
|
|
@export var enemy_speed: float = 5.0
|
|
|
|
## Base health per enemy
|
|
@export var enemy_health: int = 10
|
|
|
|
## Global difficulty multiplier for this wave (scales damage, health, count)
|
|
@export var difficulty_multiplier: float = 1.0
|
|
|
|
## Optional: Enemy type/archetype for variety (placeholder)
|
|
@export var enemy_type: StringName = &"basic"
|
|
|
|
## Optional: Special modifiers for the wave
|
|
@export var wave_modifiers: PackedStringArray = []
|
|
|
|
|
|
func _init(p_wave_number: int = 1) -> void:
|
|
wave_number = p_wave_number
|
|
_scale_difficulty()
|
|
|
|
|
|
## Auto-scale difficulty based on wave number
|
|
func _scale_difficulty() -> void:
|
|
difficulty_multiplier = 1.0 + (wave_number - 1) * 0.2
|
|
enemy_count = max(1, int(3 + (wave_number - 1) * 0.5))
|
|
enemy_health = int(10 * difficulty_multiplier)
|
|
enemy_speed = 5.0 + (wave_number - 1) * 0.5
|
|
|
|
|
|
## Get adjusted enemy count based on difficulty
|
|
func get_enemy_count() -> int:
|
|
return int(enemy_count * difficulty_multiplier)
|
|
|
|
|
|
## Get adjusted enemy health based on difficulty
|
|
func get_enemy_health() -> int:
|
|
return int(enemy_health * difficulty_multiplier)
|
|
|
|
|
|
## Get wave description for UI display
|
|
func get_wave_description() -> String:
|
|
return "Wave %d: %d enemies (Speed: %.1f, Health: %d)" % [
|
|
wave_number,
|
|
get_enemy_count(),
|
|
enemy_speed,
|
|
get_enemy_health()
|
|
]
|
|
|
|
|
|
## Check if wave has a specific modifier
|
|
func has_modifier(modifier_name: StringName) -> bool:
|
|
return modifier_name in wave_modifiers
|