feat(怪物系统): 实现动态成长属性和改进刷怪逻辑
- 在Mon.ts中使用新的getMonAttr获取动态成长属性,包括速度 - 重构MissionMonComp.ts的刷怪逻辑,使用配置中的位置信息 - 重写RogueConfig.ts,实现基于波次和时间的动态属性成长系统 - 移除未使用的随机事件相关代码,简化刷怪队列结构
This commit is contained in:
@@ -6,7 +6,7 @@ import { MonStart } from "../common/config/heroSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
// 导入肉鸽配置
|
||||
import { MonType, EventType, getStageMonConfigs} from "./RogueConfig";
|
||||
import { getStageMonConfigs, MonType } from "./RogueConfig";
|
||||
import { BuffConf } from "../common/config/SkillSet";
|
||||
import { IndexSet } from "../common/config/GameSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -17,9 +17,9 @@ const { ccclass, property } = _decorator;
|
||||
export class MissionMonCompComp extends CCComp {
|
||||
// 添加刷怪队列 - 使用新的RogueConfig格式
|
||||
private MonQueue: Array<{
|
||||
uuid: number,
|
||||
position: number,
|
||||
type: MonType
|
||||
uuid: number,
|
||||
position: number,
|
||||
type: MonType,
|
||||
level: number,
|
||||
buffs: BuffConf[]
|
||||
}> = [];
|
||||
@@ -29,7 +29,6 @@ export class MissionMonCompComp extends CCComp {
|
||||
private spawnCount: number = 0; // 召唤计数器
|
||||
private pauseInterval: number = 5.0; // 暂停间隔时间(5秒)
|
||||
private isPausing: boolean = false; // 是否正在暂停
|
||||
private currentEvent: EventType | null = null; // 当前关卡的随机事件
|
||||
private eventProcessed: boolean = false; // 事件是否已处理
|
||||
/** 全局生成顺序计数器,用于层级管理 */
|
||||
private globalSpawnOrder: number = 0;
|
||||
@@ -58,10 +57,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
|
||||
// 处理随机事件
|
||||
if (this.currentEvent && !this.eventProcessed) {
|
||||
|
||||
this.eventProcessed = true;
|
||||
}
|
||||
|
||||
|
||||
// 处理刷怪队列
|
||||
if (this.MonQueue.length > 0 && !this.isSpawning) {
|
||||
@@ -116,38 +112,38 @@ export class MissionMonCompComp extends CCComp {
|
||||
// 根据新的关卡配置生成怪物
|
||||
private generateMonsters(monsConf: any[]) {
|
||||
const cStage = smc.data.mission;
|
||||
|
||||
|
||||
// 设置怪物总数
|
||||
// console.log("[MissionMonComp] generateMonsters",monsConf)
|
||||
if (!monsConf || monsConf.length === 0) {
|
||||
console.warn(`[MissionMonComp]:关卡${cStage}配置中没有怪物信息`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 为每个怪物配置生成怪物
|
||||
monsConf.forEach((mon: any, index: number) => {
|
||||
const { uuid, type,level, buffs } = mon;
|
||||
|
||||
// 位置循环使用 (0-4)
|
||||
const position = index % 5;
|
||||
|
||||
const { uuid, type, level, buffs, position } = mon;
|
||||
|
||||
// 使用配置中的位置,如果没有则使用索引
|
||||
const spawnPosition = position !== undefined ? position : (index % 5);
|
||||
|
||||
this.addToStageSpawnQueue(
|
||||
uuid,
|
||||
position,
|
||||
uuid,
|
||||
spawnPosition,
|
||||
type,
|
||||
level, // 默认等级1
|
||||
buffs // 强度倍率
|
||||
level,
|
||||
buffs
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
// console.log(`[MissionMonComp]:关卡${cStage}将生成 ${monsConf.length} 只怪物`);
|
||||
}
|
||||
|
||||
// 添加到关卡刷怪队列 - 使用新的配置格式
|
||||
private addToStageSpawnQueue(
|
||||
uuid: number,
|
||||
position: number,
|
||||
type: MonType,
|
||||
uuid: number,
|
||||
position: number,
|
||||
type: MonType = MonType.NORMAL,
|
||||
level: number = 1,
|
||||
buffs: BuffConf[] = []
|
||||
) {
|
||||
@@ -182,7 +178,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
private addMonster(
|
||||
uuid: number = 1001,
|
||||
i: number = 0,
|
||||
monType: MonType = MonType.NORMAL,
|
||||
monType: number = 0,
|
||||
lv: number = 1,
|
||||
buffs: BuffConf[] = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user