refactor(map): 将战场槽位从6个减少到5个并调整刷怪配置

- 减少总槽位数量以简化战场布局
- 更新所有波次的怪物配置以匹配新槽位限制
- 调整Boss放置规则,现在只能放置在0、2号位
- 更新默认配置和文档注释以反映新的战场结构
This commit is contained in:
panw
2026-04-08 09:10:22 +08:00
parent 32997f0a04
commit f86c08a77d
2 changed files with 24 additions and 24 deletions

View File

@@ -4,13 +4,13 @@
*
* 职责:
* 1. 管理每一波怪物的 **生成计划**:根据 WaveSlotConfig 分配怪物到固定槽位。
* 2. 管理 6 个固定刷怪槽位的占用状态,支持 Boss 占 2 格。
* 2. 管理 5 个固定刷怪槽位的占用状态,支持 Boss 占 2 格。
* 3. 处理特殊插队刷怪请求MonQueue优先于常规刷新。
* 4. 自动推进波次:当前波所有怪物被清除后自动进入下一波。
*
* 关键设计:
* - 全场固定 6 个槽位(索引 0-5),每个槽位占固定 X 坐标。
* - Boss 占 2 个连续槽位,只能放在 0、2、4 号位。
* - 全场固定 5 个槽位(索引 0-4),每个槽位占固定 X 坐标。
* - Boss 占 2 个连续槽位,只能放在 0、2 号位。
* - slotOccupiedEids 记录每个槽位占用的怪物 ECS 实体 ID。
* - resetSlotSpawnData(wave) 在每波开始时读取配置,分配并立即生成所有怪物。
* - refreshSlotOccupancy() 定期检查槽位占用的实体是否仍存活,清除已死亡的占用。
@@ -63,7 +63,7 @@ export class MissionMonCompComp extends CCComp {
/** 怪物出生掉落高度 */
private static readonly MON_DROP_HEIGHT = 280;
/** 最大槽位数 */
private static readonly MAX_SLOTS = 6;
private static readonly MAX_SLOTS = 5;
// ======================== 编辑器属性 ========================
@@ -86,7 +86,7 @@ export class MissionMonCompComp extends CCComp {
// ======================== 运行时状态 ========================
/** 槽位占用状态:记录每个槽位当前占用的怪物 ECS 实体 IDnull 表示空闲 */
private slotOccupiedEids: Array<number | null> = Array(6).fill(null);
private slotOccupiedEids: Array<number | null> = Array(5).fill(null);
/** 全局生成顺序计数器(用于渲染层级排序) */
private globalSpawnOrder: number = 0;
/** 插队刷怪处理计时器 */
@@ -182,8 +182,8 @@ export class MissionMonCompComp extends CCComp {
// 查找空闲槽位
let slotIndex = -1;
if (slotsPerMon === 2) {
// Boss 只能放在 0, 2, 4(需要连续 2 格空闲)
for (const idx of [0, 2, 4]) {
// Boss 只能放在 0, 2需要连续 2 格空闲)
for (const idx of [0, 2]) {
if (!this.slotOccupiedEids[idx] && !this.slotOccupiedEids[idx + 1]) {
slotIndex = idx;
break;
@@ -331,8 +331,8 @@ export class MissionMonCompComp extends CCComp {
this.waveTargetCount = bosses.length + normals.length;
this.waveSpawnedCount = 0;
// Boss 优先分配(只能放在 0, 2, 4
let bossAllowedIndices = [0, 2, 4];
// Boss 优先分配(只能放在 0, 2
let bossAllowedIndices = [0, 2];
let assignedSlots = new Array(MissionMonCompComp.MAX_SLOTS).fill(null);
for (const boss of bosses) {

View File

@@ -9,8 +9,8 @@
* 4. 提供全局刷怪强度偏差系数SpawnPowerBias
*
* 设计说明:
* - 战场固定 6 个占位槽(索引 0-5)。
* - Boss 占 2 个槽位,只能放在 0、2、4 号位(确保有连续 2 格)。
* - 战场固定 5 个占位槽(索引 0-4)。
* - Boss 占 2 个槽位,只能放在 0、2 号位(确保有连续 2 格)。
* - MissionMonComp 在每波开始时读取本配置,决定刷怪组合。
*
* 注意:
@@ -112,34 +112,34 @@ export interface IWaveSlot {
// 大型 Boss 设为 2它会跨占位降落。
//
// 【规则约束】:
// - 全场固定 6 个槽位(索引 0-5)。
// - Boss 固定占用 2 个位置,且只能出现在 1、3、5 号位(对应索引 0, 2, 4)。
// - 每波怪物总槽位占用不能超过 6
// - 全场固定 5 个槽位(索引 0-4)。
// - Boss 固定占用 2 个位置,且只能出现在 1、3 号位(对应索引 0, 2
// - 每波怪物总槽位占用不能超过 5
// =========================================================================================
/** 各波次的怪物占位配置key = 波次编号) */
export const WaveSlotConfig: { [wave: number]: IWaveSlot[] } = {
/** 第 1 波:3 近战 + 3 远程 */
/** 第 1 波:2 近战 + 3 远程 */
1: [
{ type: MonType.Melee, count: 3 },
{ type: MonType.Melee, count: 2 },
{ type: MonType.Long, count: 3 }
],
/** 第 2 波2 近战 + 2 远程 + 2 辅助 */
/** 第 2 波2 近战 + 2 远程 + 1 辅助 */
2: [
{ type: MonType.Melee, count: 2 },
{ type: MonType.Long, count: 2 },
{ type: MonType.Support, count: 2 }
{ type: MonType.Support, count: 1 }
],
/** 第 3 波2 近战 + 1 近战Boss(占2格) + 2 远程 */
/** 第 3 波2 近战 + 1 近战Boss(占2格) + 1 远程 */
3: [
{ type: MonType.Melee, count: 2 },
{ type: MonType.MeleeBoss, count: 1, slotsPerMon: 2 },
{ type: MonType.Long, count: 2 }
{ type: MonType.Long, count: 1 }
],
/** 第 4 波2 近战 + 2 远程 + 1 远程Boss(占2格) */
/** 第 4 波2 近战 + 1 远程 + 1 远程Boss(占2格) */
4: [
{ type: MonType.Melee, count: 2 },
{ type: MonType.Long, count: 2 },
{ type: MonType.Long, count: 1 },
{ type: MonType.LongBoss, count: 1, slotsPerMon: 2 }
],
}
@@ -147,10 +147,10 @@ export const WaveSlotConfig: { [wave: number]: IWaveSlot[] } = {
/**
* 默认占位配置:
* 当 WaveSlotConfig 中找不到对应波次时使用此兜底配置。
* 默认 3 近战 + 3 远程。
* 默认 2 近战 + 3 远程。
*/
export const DefaultWaveSlot: IWaveSlot[] = [
{ type: MonType.Melee, count: 3 },
{ type: MonType.Melee, count: 2 },
{ type: MonType.Long, count: 3 }
]