feat: consume phase plans in boss generation
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
import { HeroInfo, HType, MonType, TriggerGrouped, UltCdLv, UltCdSet } from "../common/config/heroSet";
|
||||
import { SkillOverrides, SkillSet } from "../common/config/SkillSet";
|
||||
import { BossPhaseSet, validateBossPhaseSet } from "../common/config/BossPhaseSet";
|
||||
import { FacSet } from "../common/config/GameSet";
|
||||
import {
|
||||
SectionType, SectionConfig, getSectionConfig, calcMonsterAttrs,
|
||||
@@ -185,6 +186,22 @@ export function validateRogueConfig(): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
// 校验 Boss 阶段方案表合法性(恰 2 切换点 / trigger 条件 / hp_pct 前缀与递减 / 技能引用)
|
||||
for (const err of validateBossPhaseSet()) {
|
||||
errors.push(err);
|
||||
}
|
||||
|
||||
// 校验 heroInfo.phase_ids 引用的方案存在
|
||||
for (const key in HeroInfo) {
|
||||
const info = HeroInfo[key];
|
||||
if (!info.phase_ids) continue;
|
||||
for (const pid of info.phase_ids) {
|
||||
if (!BossPhaseSet[pid]) {
|
||||
errors.push(`HeroInfo[${key}] phase_ids 引用的方案 ${pid} 未在 BossPhaseSet 中定义`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
@@ -206,6 +223,8 @@ export interface GeneratedMonster {
|
||||
batch: number;
|
||||
/** 延迟刷出时间(秒),0 表示立即 */
|
||||
delay?: number;
|
||||
/** Boss 阶段方案 id(引用 BossPhaseSet,由 makeBoss 从 heroInfo.phase_ids 随机取一;未配置为 undefined) */
|
||||
phase_plan_id?: number;
|
||||
|
||||
/**
|
||||
* 怪物技能套装(技能注入通道,与 _testSkills 相同,在 Mon.load() 中写入 HeroAttrsComp)
|
||||
@@ -243,6 +262,11 @@ export const TestModeConfig = {
|
||||
atked: undefined as TriggerGrouped | undefined,
|
||||
dead: undefined as TriggerGrouped | undefined,
|
||||
fstart: undefined as TriggerGrouped | undefined,
|
||||
|
||||
/** 测试模式:Boss 阶段方案 id(0 = 不启用阶段;需配合 isBoss: true 才会挂载组件) */
|
||||
phasePlanId: 0 as number,
|
||||
/** 测试模式:是否以 Boss 身份刷出(影响层级/金币/阶段组件挂载) */
|
||||
isBoss: false,
|
||||
};
|
||||
|
||||
// ======================== 8. 生成引擎 ========================
|
||||
@@ -366,10 +390,11 @@ export class StageSpawningEngine {
|
||||
type: TestModeConfig.monType,
|
||||
hp: TestModeConfig.baseHp,
|
||||
ap: TestModeConfig.baseAp,
|
||||
isBoss: false,
|
||||
isBoss: TestModeConfig.isBoss,
|
||||
lv: 1,
|
||||
spawnIndex: i,
|
||||
batch: 0,
|
||||
phase_plan_id: TestModeConfig.phasePlanId || undefined,
|
||||
skills: {
|
||||
skill: TestModeConfig.skill,
|
||||
ults: TestModeConfig.ults,
|
||||
@@ -408,6 +433,7 @@ export class StageSpawningEngine {
|
||||
skills: {
|
||||
ults: this.pickBossUlts(range, stage),
|
||||
},
|
||||
phase_plan_id: this.pickPhasePlan(baseInfo),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -433,6 +459,13 @@ export class StageSpawningEngine {
|
||||
return uuids[Math.floor(Math.random() * uuids.length)];
|
||||
}
|
||||
|
||||
/** 从 Boss 允许的阶段方案中随机取一(未配置返回 undefined,Boss 退化为单阶段) */
|
||||
private pickPhasePlan(baseInfo?: { phase_ids?: number[] }): number | undefined {
|
||||
const ids = baseInfo?.phase_ids;
|
||||
if (!ids || ids.length === 0) return undefined;
|
||||
return ids[Math.floor(Math.random() * ids.length)];
|
||||
}
|
||||
|
||||
/**
|
||||
* 按定位抽取 Boss 大招(不重复),数量由关卡进度决定(getBossUltCount)
|
||||
* @returns 大招配置列表;池空时返回 undefined
|
||||
|
||||
Reference in New Issue
Block a user