import type { UnitDef } from 'db://assets/mx/module/battle'; import { towerUnitId, weapon1Tag } from './Weapon1BattleIds'; /** Weapon1 单行 → MX UnitDef(仅部署占位,无普攻/大招逻辑) */ export class Weapon1TowerBuilder { static build(w: ITableHero): UnitDef { return { id: towerUnitId(w.id), name: w.name, team: 'player', components: { health: { maxHp: 100 }, tags: [weapon1Tag(w.id)], occupancy: { shape: [[0, 0]], blocksPath: true }, }, presentation: { prefab: w.name }, }; } static buildAll(rows: readonly ITableHero[]): { units: Map; weapon1ToUnit: Map; } { const units = new Map(); const weapon1ToUnit = new Map(); for (const w of rows) { const unit = this.build(w); units.set(unit.id, unit); weapon1ToUnit.set(w.id, unit.id); } return { units, weapon1ToUnit }; } }