aether-shards/src/units/Enemy.js

27 lines
770 B
JavaScript

import { Unit } from "./Unit.js";
/**
* Enemy.js
* NPC Unit controlled by the AI Controller.
*/
export class Enemy extends Unit {
constructor(id, name, def) {
// Construct with ID, Name, Type='ENEMY', and ModelID from def
super(id, name, "ENEMY", def.model || "MODEL_ENEMY_DEFAULT");
// AI Logic
this.archetypeId = def.ai_archetype || "BRUISER"; // e.g., 'BRUISER', 'KITER'
this.aggroRange = def.aggro_range || 8;
// Rewards
this.xpValue = def.xp_value || 10;
this.lootTableId = def.loot_table || "LOOT_TIER_1_COMMON";
// Hydrate Stats
if (def.stats) {
this.baseStats = { ...this.baseStats, ...def.stats };
this.currentHealth = this.baseStats.health;
this.maxHealth = this.baseStats.health;
}
}
}