You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
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<string, UnitDef>;
|
|
weapon1ToUnit: Map<number, string>;
|
|
} {
|
|
const units = new Map<string, UnitDef>();
|
|
const weapon1ToUnit = new Map<number, string>();
|
|
|
|
for (const w of rows) {
|
|
const unit = this.build(w);
|
|
units.set(unit.id, unit);
|
|
weapon1ToUnit.set(w.id, unit.id);
|
|
}
|
|
return { units, weapon1ToUnit };
|
|
}
|
|
}
|
|
|