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

@@ -92,16 +92,25 @@ export interface IRogueGlobalConfig {
* 默认配置
*/
export const DefaultRogueConfig: IRogueGlobalConfig = {
maxMonsterCount: 10, // 默认同屏10只 (原25) - 追求极致质量
maxMonsterCount: 5, // 默认同屏5只 - 降低数量,提高单体质量
spawnLogicInterval: 1.0, // 每秒计算一次
spawnInterval: 2.5, // 队列出怪间隔2.5秒 (原1.2) - 降低频率适配总量
baseBudget: 1.0, // 基础预算 (原2.5) - 降低产出适配总量
spawnInterval: 2.0, // 队列出怪间隔
baseBudget: 1.0, // 基础预算
timeDifficultyFactor: 0.5, // 每分钟增加50%预算
survivalHpThreshold: 0.4, // 40%血量触发保护
survivalBudgetMultiplier: 0.7, // 保护时预算打7折
maxSpawnPerLogic: 2 // 单次最多生成2只 (原3)
maxSpawnPerLogic: 2 // 单次最多生成2只
};
// 精英怪和Boss刷新时间配置 (时间单位: 秒)
export const SpecialMonsterSchedule = [
{ time: 60, uuid: 5601, type: MonType.ELITE, level: 5, desc: "1分钟: 精英自爆兵" },
{ time: 180, uuid: 5601, type: MonType.ELITE, level: 10, desc: "3分钟: 精英自爆兵" },
{ time: 300, uuid: 5701, type: MonType.BOSS, level: 15, desc: "5分钟: 兽人首领" },
{ time: 600, uuid: 5701, type: MonType.BOSS, level: 25, desc: "10分钟: 兽人首领" },
{ time: 900, uuid: 5701, type: MonType.BOSS, level: 30, desc: "15分钟: 最终Boss" }
];
// 当前配置实例
let currentConfig: IRogueGlobalConfig = { ...DefaultRogueConfig };
@@ -157,16 +166,6 @@ export function calculateBudget(timeInSeconds: number, heroHpRatio: number = 1.0
export function generateMonstersFromBudget(timeInSeconds: number, heroHpRatio: number = 1.0): IMonsConfig[] {
const config = getRogueConfig();
// 15分钟后只生成Boss
if (timeInSeconds >= 15 * 60) {
return [{
uuid: 5701,
type: MonType.BOSS,
level: Math.floor(timeInSeconds / 60),
position: 2
}];
}
const budget = calculateBudget(timeInSeconds, heroHpRatio);
const weights = getSpawnWeights(timeInSeconds);
const monsters: IMonsConfig[] = [];
@@ -193,9 +192,9 @@ export function generateMonstersFromBudget(timeInSeconds: number, heroHpRatio: n
if (currentBudget >= cost) {
currentBudget -= cost;
// 随机刷怪只生成普通怪精英和Boss由固定时间控制
let type = MonType.NORMAL;
if (uuid === 5701) type = MonType.BOSS;
else if (MonsterCost[uuid] >= 10) type = MonType.ELITE;
// 即使随机到了高Cost怪在这里也只按普通怪处理或者在配置中彻底移除高Cost怪
monsters.push({
uuid: uuid,
@@ -217,6 +216,7 @@ export function generateMonstersFromBudget(timeInSeconds: number, heroHpRatio: n
* @param stage 当前波次
* @param timeInSeconds 游戏进行时间(秒)
* @returns 波次因子 (0-1之间15分钟时达到最大)
* @returns 波次因子 (0-1之间15分钟时达到最大)
*/
function calculateWaveFactor(stage: number, timeInSeconds: number = 0): number {
const MAX_GAME_TIME = 15 * 60; // 15分钟 = 900秒
@@ -428,17 +428,21 @@ function getSpawnWeights(timeInSeconds: number): SpawnWeight[] {
{ uuid: 5301, weight: 30 }
];
} else if (minutes < 14) {
// 8-14min: 阵地博弈 - 40% 战士, 30% 刺客, 20% 攻城/治疗/精英
// 8-14min: 阵地博弈 - 移除精英怪,只保留普通怪
return [
{ uuid: 5201, weight: 40 },
{ uuid: 5301, weight: 30 },
{ uuid: 5401, weight: 10 },
{ uuid: 5603, weight: 10 },
{ uuid: 5701, weight: 10 }
{ uuid: 5401, weight: 15 },
{ uuid: 5603, weight: 15 }
];
} else {
// 15min: 剧情杀/决战 - 100% Boss
return [{ uuid: 5701, weight: 100 }];
// 15min+: 混合兵种Boss由固定时间控制
return [
{ uuid: 5201, weight: 30 },
{ uuid: 5301, weight: 30 },
{ uuid: 5401, weight: 20 },
{ uuid: 5603, weight: 20 }
];
}
}