feat(刷怪): 添加特殊怪物定时刷怪机制

- 在 MissionComp 中添加特殊刷怪检查,根据时间表触发精英/Boss
- MissionMonComp 监听刷怪事件,将特殊怪物插入队列头部优先生成
- 调整刷怪配置,移除随机刷怪中的精英/Boss,改为固定时间生成
- 降低同屏怪物数量,提高单体质量,优化游戏节奏
This commit is contained in:
panw
2026-01-30 16:51:08 +08:00
parent c902d9ca0a
commit afe659b0fc
3 changed files with 75 additions and 23 deletions

View File

@@ -43,6 +43,32 @@ export class MissionMonCompComp extends CCComp {
onLoad(){
this.on(GameEvent.FightReady,this.fight_ready,this)
this.on(GameEvent.NewWave,this.fight_ready,this)
// 监听特殊刷怪事件 (精英/Boss)
this.on("SpawnSpecialMonster", this.onSpawnSpecialMonster, this);
}
/**
* 处理特殊刷怪事件
* @param event 事件名
* @param args 参数 { uuid, type, level, position?, buffs? }
*/
private onSpawnSpecialMonster(event: string, args: any) {
if (!args) return;
console.log(`[MissionMonComp] 收到特殊刷怪指令:`, args);
// 插入队列头部,优先生成
this.MonQueue.unshift({
uuid: args.uuid,
position: args.position !== undefined ? args.position : 2, // 默认中间
type: args.type,
level: args.level,
buffs: args.buffs || []
});
// 让刷怪计时器立即满足条件,以便尽快生成
// 注意:不直接调用 spawnNextMonster 是为了保持 update 循环的一致性
const config = getRogueConfig();
this.spawnTimer = config.spawnInterval + 0.1;
}
/** 视图层逻辑代码分离演示 */