prototype vibe

This commit is contained in:
Marek Lenczewski
2026-04-16 17:20:57 +02:00
parent cf5979803e
commit f21e30eb55
72 changed files with 1330 additions and 70 deletions

View File

@@ -2,14 +2,17 @@ extends Node
var entities: Dictionary = {}
func register(entity: Node, base: EnemyStats) -> void:
func register(entity: Node, base: EnemyStats, scale: float = 1.0) -> void:
var max_hp: float = base.max_health * scale
var max_sh: float = base.max_shield * scale
entities[entity] = {
"base": base,
"health": base.max_health,
"max_health": base.max_health,
"health_regen": base.health_regen,
"shield": base.max_shield,
"max_shield": base.max_shield,
"scale": scale,
"health": max_hp,
"max_health": max_hp,
"health_regen": base.health_regen * scale,
"shield": max_sh,
"max_shield": max_sh,
"shield_regen_delay": base.shield_regen_delay,
"shield_regen_time": base.shield_regen_time,
"shield_regen_timer": 0.0,
@@ -24,6 +27,21 @@ func register(entity: Node, base: EnemyStats) -> void:
"attack_timer": 0.0,
}
func apply_scale(entity: Node, scale: float) -> void:
if entity not in entities:
return
var data: Dictionary = entities[entity]
var base: EnemyStats = data["base"]
data["scale"] = scale
data["max_health"] = base.max_health * scale
data["health"] = data["max_health"]
data["health_regen"] = base.health_regen * scale
data["max_shield"] = base.max_shield * scale
data["shield"] = data["max_shield"]
EventBus.health_changed.emit(entity, data["health"], data["max_health"])
if base.max_shield > 0:
EventBus.shield_changed.emit(entity, data["shield"], data["max_shield"])
func deregister(entity: Node) -> void:
entities.erase(entity)