From f86c08a77d8ecd1f48a7e9d6cc4f1a570dbf76be Mon Sep 17 00:00:00 2001 From: panw Date: Wed, 8 Apr 2026 09:10:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(map):=20=E5=B0=86=E6=88=98=E5=9C=BA?= =?UTF-8?q?=E6=A7=BD=E4=BD=8D=E4=BB=8E6=E4=B8=AA=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E5=88=B05=E4=B8=AA=E5=B9=B6=E8=B0=83=E6=95=B4=E5=88=B7?= =?UTF-8?q?=E6=80=AA=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 减少总槽位数量以简化战场布局 - 更新所有波次的怪物配置以匹配新槽位限制 - 调整Boss放置规则,现在只能放置在0、2号位 - 更新默认配置和文档注释以反映新的战场结构 --- assets/script/game/map/MissionMonComp.ts | 18 +++++++------- assets/script/game/map/RogueConfig.ts | 30 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/assets/script/game/map/MissionMonComp.ts b/assets/script/game/map/MissionMonComp.ts index 733593b3..99d8efb6 100644 --- a/assets/script/game/map/MissionMonComp.ts +++ b/assets/script/game/map/MissionMonComp.ts @@ -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 实体 ID,null 表示空闲 */ - private slotOccupiedEids: Array = Array(6).fill(null); + private slotOccupiedEids: Array = 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) { diff --git a/assets/script/game/map/RogueConfig.ts b/assets/script/game/map/RogueConfig.ts index 0ec0d9b2..e11ecc84 100644 --- a/assets/script/game/map/RogueConfig.ts +++ b/assets/script/game/map/RogueConfig.ts @@ -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 } ]