import type { AbilityDef, BuffDef, LevelDef, UnitDef } from '../config/BattleConfigTypes'; import { InMemoryConfigProvider } from '../config/InMemoryConfigProvider'; /** * test-only fixture:内置示例配置(单元测试 / 快速验证用,非生产路径)。 * 未在 mx 模块公开导出;业务层应使用自己的 IConfigProvider 实现。 * @returns 预置刀塔、史莱姆、近战攻击与两波出怪的内存配置 */ export function createSampleBattleConfig(): InMemoryConfigProvider { const config = new InMemoryConfigProvider(); const towerBlade: UnitDef = { id: 'tower_blade', name: '刀塔', team: 'player', components: { health: { maxHp: 100 }, combat: { attack: 25, attackSpeed: 1, range: 225, critRate: 0.1, critDamage: 1.5 }, abilities: ['atk_melee'], occupancy: { shape: [[0, 0]] }, }, deploy: { cost: 50, sellRatio: 0.7 }, presentation: { prefab: 'tower_blade' }, }; const enemySlime: UnitDef = { id: 'enemy_slime', name: '史莱姆', team: 'enemy', components: { health: { maxHp: 80 }, movement: { speed: 1 }, tags: ['Ground'], }, }; const atkMelee: AbilityDef = { id: 'atk_melee', triggers: [{ type: 'OnTick', interval: 1 }], conditions: [{ type: 'HasTargetInRange' }], targeting: { team: 'enemy', selector: 'Nearest', shape: 'Single', maxCount: 1, rangeRef: 'attackRange', }, timeline: [ { at: 0, effects: [{ type: 'DealDamage', params: { scale: 1 } }], }, ], }; const burnBuff: BuffDef = { id: 'burn', duration: 3, maxStacks: 3, }; const sampleLevel: LevelDef = { id: 'sample_1', mapRows: 10, mapCols: 8, cellSize: 93, wallHp: 100, startGold: 200, waves: [ { id: 'w1', spawns: [{ unitDefId: 'enemy_slime', count: 5, interval: 1.2, spawnPoint: 2 }], }, { id: 'w2', spawns: [{ unitDefId: 'enemy_slime', count: 8, interval: 0.8, spawnPoint: 4 }], }, ], }; config.units.set(towerBlade.id, towerBlade); config.units.set(enemySlime.id, enemySlime); config.abilities.set(atkMelee.id, atkMelee); config.buffs.set(burnBuff.id, burnBuff); config.levels.set(sampleLevel.id, sampleLevel); return config; }