refactor: 整理技能与战斗相关的配置与逻辑

1.  新增技能飞行距离配置项,支持自定义直线技能飞行距离
2.  调整英雄后退击退范围从30改为20
3.  重构击退逻辑,统一敌我双方的边界钳制处理
4.  优化Boss数值配置,固定基础面板为初始英雄2倍强度
5.  修正技能6006的动画资源引用为atk1
6.  调整近战英雄默认停火距离从80改为60
7.  更新注释文档与配置注释,优化代码可读性
This commit is contained in:
panFD
2026-08-14 00:36:26 +08:00
parent 4fee02d82e
commit df0dedba75
12 changed files with 301 additions and 55 deletions

View File

@@ -423,30 +423,20 @@ export class HeroViewComp extends CCComp {
if (this.isBackingUp) return;
this.isBackingUp = true; // 🔥 设置后退状态
if (this.model.fac == FacSet.MON) {
// 基础击退距离,加上额外的距离强化
let dist = FightSet.BACK_RANG + distance;
let tx = this.node.position.x + dist;
if (tx > 320) tx = 320;
tween(this.node)
.to(0.1, { position: v3(tx, this.node.position.y, 0) })
.call(() => {
this.isBackingUp = false; // 🔥 动画完成后重置状态
})
.start();
}
// 基础击退距离 + 额外距离强化,双方阵营统一
const dist = FightSet.BACK_RANG + distance;
const isHero = this.model.fac == FacSet.HERO;
// 边界钳制HERO 不越过 BoxSet.LETF_ENDMON 不越过 BoxSet.RIGHT_END
const tx = isHero
? Math.max(BoxSet.LETF_END, this.node.position.x - dist)
: Math.min(BoxSet.RIGHT_END, this.node.position.x + dist);
if (this.model.fac == FacSet.HERO) {
let dist = 5 + distance;
let tx = this.node.position.x - dist;
if (tx < -320) tx = -320;
tween(this.node)
.to(0.1, { position: v3(tx, this.node.position.y, 0) })
.call(() => {
this.isBackingUp = false; // 🔥 动画完成后重置状态
})
.start();
}
tween(this.node)
.to(0.1, { position: v3(tx, this.node.position.y, 0) })
.call(() => {
this.isBackingUp = false; // 🔥 动画完成后重置状态
})
.start();
}
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem

View File

@@ -28,6 +28,8 @@ export class MoveComp extends ecs.Comp {
baseY: number = 0;
/** 出生序,用于同条件渲染排序稳定 */
spawnOrder: number = 0;
/** 击退速度(像素/秒),受击瞬间赋值,每帧指数衰减至 0 */
knockbackVelocity: number = 0;
reset() {
this.direction = 1;
@@ -35,6 +37,7 @@ export class MoveComp extends ecs.Comp {
this.moving = true;
this.baseY = 0;
this.spawnOrder = 0;
this.knockbackVelocity = 0;
}
}
@@ -146,7 +149,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
const dist = Math.abs(selfX - enemyX);
const attackRange = model.dis;
/** 近战贴身作战:攻击距离 dis(100) 大于技能范围(60),推进到与敌人相隔 60 才停下,保证技能可命中且不过度贴身 */
const stopRange = model.type === 0 ? 80 : attackRange;
const stopRange = model.type === 0 ? 60 : attackRange;
const inRange = dist <= stopRange;
if (inRange) {