feat: 大幅优化战斗体验与编队系统
1. 扩展英雄/怪物网格站位到10个槽位 2. 重构默认攻击距离计算逻辑,按职业动态适配 3. 重做英雄站位与移动系统,新增同阵营间距约束 4. 调整rogue模式怪物数量与强度配置,提升战斗爽感 5. 重构刷怪逻辑为匀速曲线+欠账补刷,优化刷怪节奏
This commit is contained in:
@@ -53,14 +53,18 @@ const { ccclass } = _decorator;
|
||||
export class MissionHeroComp extends CCComp {
|
||||
// ======================== 常量 ========================
|
||||
|
||||
/** 硬编码的6个英雄占位点 */
|
||||
/** 硬编码的英雄占位点(数量对齐 FightSet.HERO_MAX_NUM,落点 X 统一,英雄落地后由 MoveComp 自行移位到阵型目标) */
|
||||
public static readonly HERO_POSITIONS: Vec3[] = [
|
||||
v3(-220, BoxSet.GAME_LINE, 0), // index 0 (node_index 1): Top Front 第二
|
||||
v3(-140, BoxSet.GAME_LINE, 0), // index 1 (node_index 2): Mid Front 第一
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 2 (node_index 3): Bot Front 第三
|
||||
// v3(-280, BoxSet.GAME_LINE + 100, 0), // index 3 (node_index 4): Top Back
|
||||
// v3(-280, BoxSet.GAME_LINE, 0), // index 4 (node_index 5): Mid Back
|
||||
// v3(-280, BoxSet.GAME_LINE - 100, 0), // index 5 (node_index 6): Bot Back
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 0
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 1
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 2
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 3
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 4
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 5
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 6
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 7
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 8
|
||||
v3(-300, BoxSet.GAME_LINE, 0), // index 9
|
||||
];
|
||||
|
||||
/** 英雄出生时的掉落高度(从空中落到地面的像素差) */
|
||||
@@ -211,16 +215,16 @@ export class MissionHeroComp extends CCComp {
|
||||
if (m && m.posIndex >= 0) occupied.add(m.posIndex);
|
||||
}
|
||||
|
||||
// 优先中前(1) -> 上前(0) -> 下前(2) -> 中后(4) -> 上后(3) -> 下后(5)
|
||||
const slotPriority = [1, 0, 2, 4, 3, 5];
|
||||
// 按索引顺序填充空位(0..9),全部落点相同,英雄落地后自行移位
|
||||
const slotPriority = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
for (const idx of slotPriority) {
|
||||
if (!occupied.has(idx)) {
|
||||
if (!occupied.has(idx) && MissionHeroComp.HERO_POSITIONS[idx]) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
// 溢出:默认中前
|
||||
return 1;
|
||||
// 溢出兜底:复用 index 0(坐标有效,避免越界崩溃)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,7 +256,8 @@ export class MissionHeroComp extends CCComp {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
const finalPosIndex = posIndex >= 0 ? posIndex : this.pickPositionIndexForHero();
|
||||
const landingPos = MissionHeroComp.HERO_POSITIONS[finalPosIndex];
|
||||
// 兜底:索引越界或点位缺失时复用 index 0,保证 landingPos 一定有效
|
||||
const landingPos = MissionHeroComp.HERO_POSITIONS[finalPosIndex] ?? MissionHeroComp.HERO_POSITIONS[0];
|
||||
let spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
|
||||
hero.load(spawnPos, scale, uuid, landingPos.y, hero_lv, card_lv, finalPosIndex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user