怪物波次及等级++

This commit is contained in:
2025-07-11 10:55:48 +08:00
parent 3072e8eccd
commit 933987eab1
8 changed files with 438 additions and 177 deletions

View File

@@ -11,110 +11,17 @@
"speed": 1,
"wrapMode": 2,
"enableTrsBlending": false,
"_duration": 0.8333333333333334,
"_duration": 0,
"_hash": 500763545,
"_tracks": [
{
"__id__": 1
}
],
"_tracks": [],
"_exoticAnimation": null,
"_events": [],
"_embeddedPlayers": [],
"_additiveSettings": {
"__id__": 6
"__id__": 1
},
"_auxiliaryCurveEntries": []
},
{
"__type__": "cc.animation.ObjectTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 2
},
"proxy": null
},
"_channel": {
"__id__": 4
}
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
{
"__id__": 3
},
"spriteFrame"
]
},
{
"__type__": "cc.animation.ComponentPath",
"component": "cc.Sprite"
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 5
}
},
{
"__type__": "cc.ObjectCurve",
"_times": [
0,
0.08333333333333333,
0.16666666666666666,
0.25,
0.3333333333333333,
0.4166666666666667,
0.5,
0.5833333333333334,
0.6666666666666666,
0.75
],
"_values": [
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@e23f5",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@24262",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@6f3ad",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@b25c2",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@466e0",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@bde24",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@0f614",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@5450f",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@1b16f",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "093403fd-fec9-42ef-b952-5831234ff06e@37953",
"__expectedType__": "cc.SpriteFrame"
}
]
},
{
"__type__": "cc.AnimationClipAdditiveSettings",
"enabled": false,

View File

@@ -35,10 +35,13 @@
},
{
"__id__": 18
},
{
"__id__": 20
}
],
"_prefab": {
"__id__": 20
"__id__": 22
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -406,6 +409,48 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "46vE3s9lxEkZFP/Fm7EHJD"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 21
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a0ZWkb7iNE9qU/AYLFrtub"
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@@ -35,10 +35,13 @@
},
{
"__id__": 18
},
{
"__id__": 20
}
],
"_prefab": {
"__id__": 20
"__id__": 22
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -406,6 +409,48 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "46vE3s9lxEkZFP/Fm7EHJD"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 21
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "29ZFrA9ypDKYhdU+r1D6vj"
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@@ -32,13 +32,10 @@
},
{
"__id__": 10
},
{
"__id__": 12
}
],
"_prefab": {
"__id__": 14
"__id__": 12
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -203,35 +200,6 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "8ahZv91itPcYJm8S0veHYl"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"playOnLoad": true,
"_clips": [
{
"__uuid__": "2202bddf-38fc-4b0e-a004-ef962f61f49d",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": {
"__uuid__": "2202bddf-38fc-4b0e-a004-ef962f61f49d",
"__expectedType__": "cc.AnimationClip"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "7cJdSTCj5Eu4vDiD6FPj8P"
},
{
"__type__": "cc.Sprite",
"_name": "",
@@ -242,7 +210,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 13
"__id__": 11
},
"_customMaterial": null,
"_srcBlendFactor": 2,

View File

@@ -11,6 +11,249 @@ export const BossList = {
}
}
// 波次配置表 - 根据Design.md中的怪物波次系统设计
export const WaveConfig = {
// 第1-5波新手期
1: {
monsters: [
{ uuid: 5201, count: 3, type: "warrior" }, // 3只普通怪物
],
totalHp: 75,
totalAp: 24,
description: "新手期-基础威胁"
},
2: {
monsters: [
{ uuid: 5202, count: 4, type: "warrior" }, // 4只普通怪物
],
totalHp: 100,
totalAp: 32,
description: "新手期-数量增加"
},
3: {
monsters: [
{ uuid: 5204, count: 2, type: "warrior" }, // 2只普通
{ uuid: 5203, count: 1, type: "remote" }, // 1只远程
],
totalHp: 70,
totalAp: 28,
description: "新手期-引入远程威胁"
},
4: {
monsters: [
{ uuid: 5205, count: 5, type: "warrior" }, // 5只普通怪物
],
totalHp: 125,
totalAp: 40,
description: "新手期-数量挑战"
},
5: {
monsters: [
{ uuid: 5206, count: 3, type: "warrior" }, // 3只普通
{ uuid: 5220, count: 1, type: "remote" }, // 1只远程
],
totalHp: 95,
totalAp: 36,
description: "新手期-混合威胁"
},
// 第6-10波成长期
6: {
monsters: [
{ uuid: 5219, count: 2, type: "warrior" }, // 2只普通
{ uuid: 5224, count: 2, type: "remote" }, // 2只远程
],
totalHp: 90,
totalAp: 40,
description: "成长期-远程威胁增加"
},
7: {
monsters: [
{ uuid: 5221, count: 4, type: "warrior" }, // 4只普通
{ uuid: 5216, count: 1, type: "mage" }, // 1只法师
],
totalHp: 118,
totalAp: 47,
description: "成长期-引入法师威胁"
},
8: {
monsters: [
{ uuid: 5222, count: 1, type: "warrior" }, // 1只普通
{ uuid: 5223, count: 3, type: "remote" }, // 3只远程
],
totalHp: 85,
totalAp: 44,
description: "成长期-远程主导"
},
9: {
monsters: [
{ uuid: 5225, count: 3, type: "warrior" }, // 3只普通
{ uuid: 5226, count: 1, type: "remote" }, // 1只远程
{ uuid: 5217, count: 1, type: "mage" }, // 1只法师
],
totalHp: 113,
totalAp: 51,
description: "成长期-三类型混合"
},
10: {
monsters: [
{ uuid: 5227, count: 2, type: "warrior" }, // 2只普通
{ uuid: 5218, count: 2, type: "remote" }, // 2只远程
{ uuid: 5225, count: 1, type: "mage" }, // 1只法师
],
totalHp: 108,
totalAp: 56,
description: "成长期-平衡挑战"
},
// 第11-15波挑战期
11: {
monsters: [
{ uuid: 5201, count: 6, type: "warrior" }, // 6只普通怪物
],
totalHp: 150,
totalAp: 48,
description: "挑战期-数量压力"
},
12: {
monsters: [
{ uuid: 5202, count: 2, type: "warrior" }, // 2只普通
{ uuid: 5203, count: 3, type: "remote" }, // 3只远程
],
totalHp: 110,
totalAp: 52,
description: "挑战期-远程威胁"
},
13: {
monsters: [
{ uuid: 5204, count: 5, type: "warrior" }, // 5只普通
{ uuid: 5216, count: 2, type: "mage" }, // 2只法师
],
totalHp: 161,
totalAp: 70,
description: "挑战期-法师威胁"
},
14: {
monsters: [
{ uuid: 5205, count: 3, type: "warrior" }, // 3只普通
{ uuid: 5220, count: 2, type: "remote" }, // 2只远程
{ uuid: 5217, count: 2, type: "mage" }, // 2只法师
],
totalHp: 151,
totalAp: 74,
description: "挑战期-全面威胁"
},
15: {
monsters: [
{ uuid: 5206, count: 1, type: "warrior" }, // 1只普通
{ uuid: 5224, count: 4, type: "remote" }, // 4只远程
{ uuid: 5218, count: 2, type: "mage" }, // 2只法师
],
totalHp: 141,
totalAp: 78,
description: "挑战期-远程法师主导"
}
};
// 无限模式波次生成函数
export const getInfiniteWaveConfig = (waveNumber: number) => {
if (waveNumber <= 15) {
return WaveConfig[waveNumber];
}
// 第16波+ (无限模式)
const baseWarriorCount = 3 + Math.floor(waveNumber / 5);
const baseRemoteCount = 1 + Math.floor(waveNumber / 8);
const baseMageCount = Math.floor(waveNumber / 10);
// 最大单波总数限制: 12只
const totalMonsters = baseWarriorCount + baseRemoteCount + baseMageCount;
const maxMonsters = 12;
let warriorCount = baseWarriorCount;
let remoteCount = baseRemoteCount;
let mageCount = baseMageCount;
// 如果超过最大数量,按优先级削减
if (totalMonsters > maxMonsters) {
const excess = totalMonsters - maxMonsters;
// 优先削减普通怪物,保留远程和法师
warriorCount = Math.max(1, warriorCount - excess);
}
const monsters = [];
// 添加普通怪物
if (warriorCount > 0) {
const warriorIds = [5201, 5202, 5204, 5205, 5206, 5219, 5221, 5222, 5223];
const randomWarriorId = warriorIds[Math.floor(Math.random() * warriorIds.length)];
monsters.push({ uuid: randomWarriorId, count: warriorCount, type: "warrior" });
}
// 添加远程怪物
if (remoteCount > 0) {
const remoteIds = [5203, 5220, 5224];
const randomRemoteId = remoteIds[Math.floor(Math.random() * remoteIds.length)];
monsters.push({ uuid: randomRemoteId, count: remoteCount, type: "remote" });
}
// 添加法师怪物
if (mageCount > 0) {
const mageIds = [5216, 5217, 5218, 5225, 5226, 5227];
const randomMageId = mageIds[Math.floor(Math.random() * mageIds.length)];
monsters.push({ uuid: randomMageId, count: mageCount, type: "mage" });
}
// 计算总属性
let totalHp = 0;
let totalAp = 0;
monsters.forEach(monster => {
const baseHp = monster.type === "warrior" ? 25 : monster.type === "remote" ? 20 : 18;
const baseAp = monster.type === "warrior" ? 8 : monster.type === "remote" ? 12 : 15;
const level = 1 + Math.floor(waveNumber / 10);
const levelHp = Math.floor(baseHp * (1 + (level - 1) * 0.3));
const levelAp = Math.floor(baseAp * (1 + (level - 1) * 0.25));
totalHp += levelHp * monster.count;
totalAp += levelAp * monster.count;
});
return {
monsters: monsters,
totalHp: totalHp,
totalAp: totalAp,
description: `无限模式-第${waveNumber}`
};
};
// 获取怪物等级
export const getMonsterLevel = (waveNumber: number): number => {
return 1 + Math.floor(waveNumber / 1);
};
// 获取装备石掉落数量
export const getEquipStoneDrops = (monsterType: string, level: number = 1): number => {
const baseDrops = {
"warrior": 2, // 普通怪物
"remote": 3, // 远程怪物
"mage": 4 // 法师怪物
};
return Math.floor(baseDrops[monsterType] * (1 + (level - 1) * 0.2));
};
// 获取装备升级成本
export const getEquipUpgradeCost = (equipLevel: number, quality: number): number => {
const baseCosts = {
2: 50, // GREEN
3: 80, // BLUE
4: 120 // PURPLE
};
// 每次升级成本翻倍
return baseCosts[quality] * Math.pow(2, equipLevel - 1);
};
export const MonNum = [3,4,5]//对应关卡数MissionMons 的索引
export const MissionMons = [
[5201,5202,5203,5204,5205,5206],

View File

@@ -61,16 +61,24 @@ export const HQuality = {
ORANGE:5,
}
export const MonSet = {
0:{pos:v3(350,0,0)},
1:{pos:v3(400,0,0)},
2:{pos:v3(450,0,0)},
3:{pos:v3(500,0,0)},
4:{pos:v3(550,0,0)},
5:{pos:v3(600,0,0)},
6:{pos:v3(650,0,0)},
7:{pos:v3(700,0,0)},
8:{pos:v3(750,0,0)},
9:{pos:v3(800,0,0)},
0:{pos:v3(340,0,0)},
1:{pos:v3(360,0,0)},
2:{pos:v3(380,0,0)},
3:{pos:v3(400,0,0)},
4:{pos:v3(420,0,0)},
5:{pos:v3(440,0,0)},
6:{pos:v3(460,0,0)},
7:{pos:v3(480,0,0)},
8:{pos:v3(500,0,0)},
9:{pos:v3(520,0,0)},
10:{pos:v3(540,0,0)},
11:{pos:v3(560,0,0)},
12:{pos:v3(580,0,0)},
13:{pos:v3(600,0,0)},
14:{pos:v3(620,0,0)},
15:{pos:v3(640,0,0)},
16:{pos:v3(660,0,0)},
17:{pos:v3(680,0,0)},
}
// 经验值计算函数 - 复杂递增规律
@@ -228,43 +236,43 @@ export const HeroInfo = {
//主将
5001:{uuid:5001,name:"刺心.艾吉斯",path:"k1", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6005],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
buff:[
{buff_type:BuffAttr.PUNCTURE,value:10},
],info:"剑类专精,穿刺伤害额外+10%"},
5002:{uuid:5002,name:"飓风.格罗姆",path:"k2", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6006],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6006],
buff:[
{buff_type:BuffAttr.WFUNY,value:10},
],info:"斧类专精,风怒概率增加10%"},
5003:{uuid:5003,name:"碎颅.赫克托",path:"k4", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6007],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6007],
buff:[
{buff_type:BuffAttr.CRITICAL,value:10},
],info:"锤类专精,暴击概率增加10%"},
5004:{uuid:5004,name:"裂伤.塔米拉",path:"k3", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6008],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6008],
buff:[
{buff_type:BuffAttr.BURN_COUNT,value:1},
],info:"刀类专精,易伤效果额外持续1次"},
5005:{uuid:5005,name:"烈焰.艾尔文",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6005],
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
buff:[
],info:"说明"},
5006:{uuid:5006,name:"风暴.艾尔文",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6005],
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
buff:[
],info:"说明"},
5007:{uuid:5007,name:"战争.艾尔文",path:"zh3", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6005],
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
buff:[
],info:"说明"},
@@ -272,48 +280,48 @@ export const HeroInfo = {
//伙伴
5021:{uuid:5021,name:"幽灵射手",path:"a4", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.remote,hp:50,ap:15,dis:700,cd:1.5,speed:50,skills:[6002],
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
buff:[
],info:"说明"},
5022:{uuid:5022,name:"战争领主",path:"k5", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.warrior,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6001],
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
buff:[
],info:"说明"},
5023:{uuid:5023,name:"混沌法师",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6001],
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
buff:[
],info:"说明"},
5024:{uuid:5024,name:"火焰法师",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:15,dis:700,cd:1.5,speed:50,skills:[6001],
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001],
buff:[
],info:"说明"},
5025:{uuid:5025,name:"风暴精灵",path:"m4", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:15,dis:700,cd:1.5,speed:50,skills:[6001],
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001],
buff:[
],info:"说明"},
5026:{uuid:5026,name:"战争祭祀",path:"d2", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.mage,hp:50,ap:10,dis:700,cd:1.5,speed:50,skills:[6001],
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
buff:[
],info:"说明"},
5027:{uuid:5027,name:"暴风射手",path:"a5", quality:HQuality.BLUE,lv:1,kind:2,
type:HType.remote,hp:50,ap:15,dis:700,cd:1.5,speed:50,skills:[6002],
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
buff:[
],info:"说明"},
5028:{uuid:5028,name:"苍穹射手",path:"a3", quality:HQuality.BLUE,lv:1,kind:1,
type:HType.remote,hp:50,ap:15,dis:700,cd:1.5,speed:50,skills:[6002],
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
buff:[
],info:"说明"},

View File

@@ -68,8 +68,22 @@ export class Monster extends ecs.Entity {
hv.hero_name= hero.name;
hv.speed =hv.ospeed = hero.speed;
hv.dis = hero.dis;
hv.hp= hv.hp_max =hero.hp;
hv.ap = hero.ap;
// 根据Design.md设计文档计算怪物等级属性
const baseHp = hero.hp;
const baseAp = hero.ap;
// 怪物属性随等级增长 (根据Design.md中的公式)
// HP增长: Math.floor(baseHp * (1 + (level-1) * 0.3))
// AP增长: Math.floor(baseAp * (1 + (level-1) * 0.25))
const levelHp = Math.floor(baseHp * (1 + (lv - 1) * 0.3));
const levelAp = Math.floor(baseAp * (1 + (lv - 1) * 0.25));
hv.hp = hv.hp_max = levelHp;
hv.ap = levelAp;
console.log(`[Monster]: 怪物${hero.name}(等级${lv}) - 基础HP:${baseHp}->等级HP:${levelHp}, 基础AP:${baseAp}->等级AP:${levelAp}`);
hv.cd = hero.cd
hv.atk_skill=hero.skills[0]
hero.buff.forEach((buff:any)=>{

View File

@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
import { Monster } from "../hero/Mon";
import { BoxSet } from "../common/config/BoxSet";
import { HeroSet, MonSet } from "../common/config/heroSet";
import { FightSet, Missions, MonNum } from "../common/config/Mission";
import { FightSet, Missions, MonNum, WaveConfig, getInfiniteWaveConfig, getMonsterLevel } from "../common/config/Mission";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { smc } from "../common/SingletonModuleComp";
@@ -18,10 +18,10 @@ const { ccclass, property } = _decorator;
@ecs.register('MissionMonComp', false)
export class MissionMonCompComp extends CCComp {
timer:Timer=new Timer(1)
// 添加刷怪队列
private monsterQueue: Array<{uuid: number, position: number, isBoss: boolean}> = [];
// 添加刷怪队列 - 增加level字段
private monsterQueue: Array<{uuid: number, position: number, isBoss: boolean, level: number}> = [];
private isSpawning: boolean = false;// 是否正在生成怪物
private spawnInterval: number = 5; // 每个怪物生成间隔时间
private spawnInterval: number = 0.5; // 每个怪物生成间隔时间
private spawnTimer: number = 0; // 生成计时器
private is_fight:boolean = false;
onLoad(){
@@ -57,46 +57,77 @@ export class MissionMonCompComp extends CCComp {
this.timer=new Timer(FightSet.MON_WAVE_TIME)
}
test_call(){
this.addToSpawnQueue(5202, 0, true);
this.addToSpawnQueue(5202, 0, true, 1);
}
do_mon_wave(){
oops.message.dispatchEvent(GameEvent.WaveUpdate)
console.log("[MissionMonComp]:怪物登场,当前波次 :",smc.vmdata.mission_data.current_wave)
let mon_num = RandomManager.instance.getRandomInt(0, MonNum.length, 1);
for(let i=0;i<2;i++){
let x = RandomManager.instance.getRandomInt(0, Missions[0].length, 1);
this.addToSpawnQueue(Missions[0][x], 0, false);
// 使用新的波次配置系统
const currentWave = smc.vmdata.mission_data.current_wave;
const waveConfig = this.getWaveConfig(currentWave);
console.log(`[MissionMonComp]:第${currentWave}波配置:`, waveConfig.description);
console.log(`[MissionMonComp]:总HP: ${waveConfig.totalHp}, 总AP: ${waveConfig.totalAp}`);
// 根据波次配置生成怪物
this.generateMonstersFromConfig(waveConfig);
}
// 获取波次配置
private getWaveConfig(waveNumber: number) {
if (waveNumber <= 15) {
return WaveConfig[waveNumber];
} else {
return getInfiniteWaveConfig(waveNumber);
}
}
// 根据配置生成怪物
private generateMonstersFromConfig(waveConfig: any) {
const { monsters } = waveConfig;
const currentWave = smc.vmdata.mission_data.current_wave;
const monsterLevel = getMonsterLevel(currentWave);
// 新增:添加到刷怪队列
private addToSpawnQueue(uuid: number, position: number, isBoss: boolean = false) {
monsters.forEach((monsterGroup: any) => {
const { uuid, count, type } = monsterGroup;
// 为每个怪物组生成指定数量的怪物
for (let i = 0; i < count; i++) {
// 随机选择位置 (0-9)
this.addToSpawnQueue(uuid, i, false, monsterLevel);
}
});
console.log(`[MissionMonComp]:本波次将生成 ${monsters.reduce((total: number, group: any) => total + group.count, 0)} 只怪物,等级: ${monsterLevel}`);
}
// 新增:添加到刷怪队列 - 增加level参数
private addToSpawnQueue(uuid: number, position: number, isBoss: boolean = false, level: number = 1) {
this.monsterQueue.push({
uuid: uuid,
position: position,
isBoss: isBoss
isBoss: isBoss,
level: level
});
}
// 新增:从队列中生成下一个怪物
// 新增:从队列中生成下一个怪物 - 传递level参数
private spawnNextMonster() {
if (this.monsterQueue.length === 0) return;
const monsterData = this.monsterQueue.shift();
if (monsterData) {
this.addMonster(monsterData.uuid, monsterData.position, monsterData.isBoss);
this.addMonster(monsterData.uuid, monsterData.position, monsterData.isBoss, false, monsterData.level);
}
}
private addMonster(uuid:number=1001,i:number=0,is_boss:boolean=false) {
private addMonster(uuid:number=1001,i:number=0,is_boss:boolean=false,is_call:boolean=false,lv:number=1) {
let mon = ecs.getEntity<Monster>(Monster);
let scale = -1
let pos:Vec3 = v3(MonSet[i].pos);
mon.load(pos,scale,uuid,is_boss);
mon.load(pos,scale,uuid,is_boss,is_call,lv);
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {