import { System } from '../core/System.js'; /** * System to handle health regeneration */ export class HealthRegenerationSystem extends System { constructor() { super('HealthRegenerationSystem'); this.requiredComponents = ['Health']; this.priority = 35; } process(deltaTime, entities) { entities.forEach(entity => { const health = entity.getComponent('Health'); if (!health || health.regeneration <= 0) return; // Regenerate health over time // Only regenerate if not recently damaged (5 seconds) const timeSinceDamage = (Date.now() - health.lastDamageTime) / 1000; if (timeSinceDamage > 5) { health.heal(health.regeneration * deltaTime); } }); } }