feat(战斗系统): 扩展为4条战斗线路并调整相关配置

- 将战斗线路从2条扩展为4条,新增LINE3和LINE4
- 修改Monster生成逻辑以支持4条线路
- 更新英雄刘邦的技能配置
- 调整基础攻击技能消耗为0
- 更新地图预制体以包含新增线路
This commit is contained in:
walkpan
2026-01-02 00:03:07 +08:00
parent ad4fd30314
commit ffa6bbec6f
5 changed files with 319 additions and 114 deletions

View File

@@ -28,17 +28,17 @@
"_active": true,
"_components": [
{
"__id__": 66
"__id__": 74
},
{
"__id__": 68
"__id__": 76
},
{
"__id__": 70
"__id__": 78
}
],
"_prefab": {
"__id__": 72
"__id__": 80
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -197,17 +197,17 @@
"_active": true,
"_components": [
{
"__id__": 59
"__id__": 67
},
{
"__id__": 61
"__id__": 69
},
{
"__id__": 63
"__id__": 71
}
],
"_prefab": {
"__id__": 65
"__id__": 73
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -257,17 +257,17 @@
"__id__": 28
},
{
"__id__": 50
"__id__": 58
}
],
"_active": true,
"_components": [
{
"__id__": 56
"__id__": 64
}
],
"_prefab": {
"__id__": 58
"__id__": 66
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -748,19 +748,25 @@
},
{
"__id__": 41
},
{
"__id__": 45
},
{
"__id__": 49
}
],
"_active": true,
"_components": [
{
"__id__": 45
"__id__": 53
},
{
"__id__": 47
"__id__": 55
}
],
"_prefab": {
"__id__": 49
"__id__": 57
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -793,7 +799,7 @@
},
{
"__type__": "cc.Node",
"_name": "LINE1",
"_name": "LINE3",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -864,7 +870,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b8C5CFg5lM4oUHMeSrc/sV"
"fileId": "a5LMIIbHtOKK10K5do5dSQ"
},
{
"__type__": "cc.PrefabInfo",
@@ -874,14 +880,14 @@
"asset": {
"__id__": 0
},
"fileId": "4dcNJaDM1CLI9q3fIqHZ/U",
"fileId": "a6CBSkrzZIurlX0D/HzXDp",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "HERO",
"_name": "LINE1",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -952,7 +958,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "dasmpuTSVM7qA3QW9/3XjQ"
"fileId": "b8C5CFg5lM4oUHMeSrc/sV"
},
{
"__type__": "cc.PrefabInfo",
@@ -962,14 +968,14 @@
"asset": {
"__id__": 0
},
"fileId": "eaiasKNEFO6qvodGhL4a0b",
"fileId": "4dcNJaDM1CLI9q3fIqHZ/U",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "LINE2",
"_name": "HERO",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -1040,7 +1046,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "ea767WaZRHo4s0bZQfN8zP"
"fileId": "dasmpuTSVM7qA3QW9/3XjQ"
},
{
"__type__": "cc.PrefabInfo",
@@ -1050,14 +1056,14 @@
"asset": {
"__id__": 0
},
"fileId": "60UdPtJn9ALLHCveLwT1bT",
"fileId": "eaiasKNEFO6qvodGhL4a0b",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "SKILL",
"_name": "LINE2",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -1128,7 +1134,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "47rZJ0Uv9HkIhkIUzm2ES9"
"fileId": "ea767WaZRHo4s0bZQfN8zP"
},
{
"__type__": "cc.PrefabInfo",
@@ -1138,90 +1144,28 @@
"asset": {
"__id__": 0
},
"fileId": "f0bFfyrcRF77DMu5a9MYtG",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 28
},
"_enabled": true,
"__prefab": {
"__id__": 46
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f91Y4OCX1NFKfSWOAvmdSa"
},
{
"__type__": "6639ayo4DFKZYCU2OBZzyb+",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 28
},
"_enabled": true,
"__prefab": {
"__id__": 48
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6fzmfjcbNPK6tOzQOKJfRV"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "77ZGG4JjxGiol1pDVFrjGQ",
"fileId": "60UdPtJn9ALLHCveLwT1bT",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "SkillLayer",
"_objFlags": 512,
"_name": "LINE4",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 7
"__id__": 28
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 51
},
{
"__id__": 53
"__id__": 46
}
],
"_prefab": {
"__id__": 55
"__id__": 48
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1258,12 +1202,250 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 50
"__id__": 45
},
"_enabled": true,
"__prefab": {
"__id__": 47
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "141kciXbJMsYSI6X6J/esh"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "5f0OKGVDRCNKxvM3xSrqhv",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "SKILL",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 28
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 50
}
],
"_prefab": {
"__id__": 52
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 49
},
"_enabled": true,
"__prefab": {
"__id__": 51
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "47rZJ0Uv9HkIhkIUzm2ES9"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "f0bFfyrcRF77DMu5a9MYtG",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 28
},
"_enabled": true,
"__prefab": {
"__id__": 54
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f91Y4OCX1NFKfSWOAvmdSa"
},
{
"__type__": "6639ayo4DFKZYCU2OBZzyb+",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 28
},
"_enabled": true,
"__prefab": {
"__id__": 56
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6fzmfjcbNPK6tOzQOKJfRV"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "77ZGG4JjxGiol1pDVFrjGQ",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "SkillLayer",
"_objFlags": 512,
"__editorExtras__": {},
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 59
},
{
"__id__": 61
}
],
"_prefab": {
"__id__": 63
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 58
},
"_enabled": true,
"__prefab": {
"__id__": 60
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
@@ -1286,11 +1468,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 50
"__id__": 58
},
"_enabled": true,
"__prefab": {
"__id__": 54
"__id__": 62
},
"light": null,
"_id": ""
@@ -1322,7 +1504,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 57
"__id__": 65
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1363,7 +1545,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 60
"__id__": 68
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1391,7 +1573,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 62
"__id__": 70
},
"camera": {
"__id__": 3
@@ -1406,10 +1588,10 @@
"__id__": 24
},
"entityLayer": {
"__id__": 47
"__id__": 55
},
"SkillLayer": {
"__id__": 53
"__id__": 61
},
"isFollowPlayer": true,
"_id": ""
@@ -1428,7 +1610,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 64
"__id__": 72
},
"_id": ""
},
@@ -1459,7 +1641,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 67
"__id__": 75
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1487,7 +1669,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 69
"__id__": 77
},
"_cameraComponent": {
"__id__": 3
@@ -1509,7 +1691,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 71
"__id__": 79
},
"_alignFlags": 45,
"_target": null,

View File

@@ -166,7 +166,7 @@ export const SkillSet: Record<number, SkillConfig> = {
// ========== 基础攻击 ========== 6001-6099
6001: {
uuid:6001,name:"挥击",sp_name:"atk_s1",icon:"3036",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,DType:DType.ATK,
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,cost:10,with:0,dis:80,
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,cost:0,with:0,dis:80,
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
buffs:[],neAttrs:[],info:"向最前方敌人扔出石斧,造成100%攻击的伤害",
},

View File

@@ -68,6 +68,8 @@ export const MonSet = {
export enum MonStart {
SLINE_1=130, //上线y
SLINE_2=110, //下线y
SLINE_3=150, //下线y
SLINE_4=90, //y起始点
START_X=240, //x起始点
START_I=60, //x轴间隔
}
@@ -124,7 +126,7 @@ export const HeroInfo: Record<number, heroInfo> = {
// 刘邦 - 领导型战士(善于用人,知人善任)
5001:{uuid:5001,name:"刘邦",path:"hk1", fac:FacSet.HERO, kind:1,as:1.5,
type:HType.warrior,lv:1,hp:200,mp:200,def:9,ap:15,dis:100,speed:120,skills:[6001,6100,6101,6102],
type:HType.warrior,lv:1,hp:200,mp:200,def:9,ap:15,dis:100,speed:120,skills:[6001,6001],
buff:[],tal:[],info:"楚汉争霸领袖,领导统御型战士"},
// 荆轲 - 刺客(敏捷型,高速度和暴击率)

View File

@@ -44,8 +44,10 @@ export class Monster extends ecs.Entity {
var node = instantiate(prefab);
let LINE1=scene.entityLayer!.node!.getChildByName("LINE1")!;
let LINE2=scene.entityLayer!.node!.getChildByName("LINE2")!;
let LINE3=scene.entityLayer!.node!.getChildByName("LINE3")!;
let LINE4=scene.entityLayer!.node!.getChildByName("LINE4")!;
// 🔥 设置初始 SiblingIndex - 防止溢出
const baseLane = lane === 0 ? LINE1 : LINE2;
const baseLane = lane === 0 ? LINE1 : lane === 1 ? LINE2 : lane === 2 ? LINE3 : LINE4;
node.parent = baseLane
const collider = node.getComponent(BoxCollider2D);
if (collider) collider.enabled = false; // 先禁用 // 延迟一帧启用碰撞体

View File

@@ -240,13 +240,32 @@ export class MissionMonCompComp extends CCComp {
let scale = -1;
// 使用 MonStart 计算怪物出生位置:
// x 从 START_X 开始,按 START_I 的间隔递增;
// y 在线路之间交替:偶数索引为 SLINE_1,奇数索引为 SLINE_2。
const x = MonStart.START_X + Math.floor(i / 2) * MonStart.START_I;
const y = (i % 2 === 0) ? MonStart.SLINE_1 : MonStart.SLINE_2;
let pos: Vec3 = v3(x, y, 0);
// y 在线路之间交替:0->SLINE_1, 1->SLINE_2, 2->SLINE_3, 3->SLINE_4
const x = MonStart.START_X + Math.floor(i / 4) * MonStart.START_I;
// 根据位置判断线路y=SLINE_1 为一线(lane=0)y=SLINE_2 为二线(lane=1)
const lane = y === MonStart.SLINE_1 ? 0 : 1;
let y = MonStart.SLINE_1;
let lane = 0;
switch (i % 4) {
case 0:
y = MonStart.SLINE_1;
lane = 0;
break;
case 1:
y = MonStart.SLINE_2;
lane = 1;
break;
case 2:
y = MonStart.SLINE_3;
lane = 2;
break;
case 3:
y = MonStart.SLINE_4;
lane = 3;
break;
}
let pos: Vec3 = v3(x, y, 0);
// 递增全局生成顺序 - 🔥 添加溢出保护
this.globalSpawnOrder = (this.globalSpawnOrder + 1) % 999; // 防止无限增长在999处循环重置