From d9282b746932c623a9a11c1538abeb4fd144cffe Mon Sep 17 00:00:00 2001 From: panw Date: Fri, 17 Oct 2025 10:54:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(movement):=20=E6=B7=BB=E5=8A=A0=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E9=80=9F=E5=BA=A6=E5=B1=9E=E6=80=A7=E5=B9=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=80=9F=E5=BA=A6=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在DBuff和Attrs中新增移动速度相关字段SPEED - 修改getAttrFieldFromDebuff映射,支持移动速度下降Debuff - 修正DbuffConf接口中deV拼写错误 - BattleMoveSystem中使用Attrs.SPEED替代原慢速减值计算速度 - HeroViewComp中修复deV字段拼写并更新减速效果处理逻辑 - 移除未使用和无效的状态类Debuff标记,优化逻辑判断 --- assets/script/game/common/config/SkillSet.ts | 10 ++++++---- .../game/common/ecs/position/BattleMoveSystem.ts | 13 ++++++------- assets/script/game/hero/HeroViewComp.ts | 10 +++++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index 6bba19a2..9ac6d359 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -111,6 +111,7 @@ export enum DBuff { DODGE = 12, //-闪避 - 对应Attrs.DODGE (闪避), BType.RATIO DBUFFUP=13, //edbuff效果提升 BUFF_DOWN = 14,// buff效果减弱 + SPEED = 15, //移动速度下降 - 对应Attrs.MOVE_SPEED (移动速度), BType.RATIO } @@ -142,6 +143,7 @@ export enum Attrs { BUFF_UP = 24, //buff效果提升 DBUFF_UP=25, //debuff效果提升 DIS=26, //攻击距离 + SPEED = 27, //移动速度加成,默认都是百分比 } export const getAttrs=()=>{ @@ -172,9 +174,7 @@ export const getAttrFieldFromDebuff = (debuffType: DBuff): number => { // 状态类 debuff(只需缓存,不影响属性) const stateDebuffSet = new Set([ DBuff.STUN, - DBuff.SLOW, DBuff.FROST, - DBuff.BURN, ]); // 检查是否是状态类 debuff @@ -200,6 +200,8 @@ export const getAttrFieldFromDebuff = (debuffType: DBuff): number => { [DBuff.DODGE]: Attrs.DODGE, // -闪避 -> 闪避 [DBuff.DBUFFUP]: Attrs.DBUFF_UP, // debuff提升 -> debuff提升 [DBuff.BUFF_DOWN]: Attrs.BUFF_UP, // buff减弱 -> buff效果 + [DBuff.SPEED]: Attrs.SPEED, // 移动速度下降 -> 移动速度 + }; const attrField = debuffAttrMap[debuffType]; @@ -287,9 +289,9 @@ export const HeroSkillList = [6001,6001,6001,6001,6001,6001] export interface DbuffConf { debuff: DBuff; // debuff类型 BType:BType //buff是数值型还是百分比型 - dev: number; // 效果值 (原deV) + deV: number; // 效果值 deC: number; // 持续时间 - deR: number; // 触发概率 (原deR) + deR: number; // 触发概率 } export interface BuffConf { buff:Attrs; diff --git a/assets/script/game/common/ecs/position/BattleMoveSystem.ts b/assets/script/game/common/ecs/position/BattleMoveSystem.ts index 565b4a55..6d48e87c 100644 --- a/assets/script/game/common/ecs/position/BattleMoveSystem.ts +++ b/assets/script/game/common/ecs/position/BattleMoveSystem.ts @@ -29,9 +29,9 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU if (!shouldStop) { //在攻击范围内停止移动 // if(view.fac==1){ - const hasStun = view.V_DBUFF.some(d => d.debuff === DBuff.STUN); - const hasFrost = view.V_DBUFF.some(d => d.debuff === DBuff.FROST); - if(view.is_stop||view.is_dead||hasStun||hasFrost) { + const isStun = view.V_DBUFF.some(d => d.debuff === DBuff.STUN); + const isFrost = view.V_DBUFF.some(d => d.debuff === DBuff.FROST); + if(view.is_stop||view.is_dead||isStun||isFrost) { view.status_change("idle"); return; //停止移动或者死亡不移动 } @@ -40,7 +40,6 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU view.status_change("idle"); return; } - // 英雄阵营特殊逻辑:根据职业区分行为 if (view.fac == FacSet.HERO) { const hasEnemies = this.checkEnemiesExist(e); @@ -65,7 +64,7 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU } // 继续向敌人方向移动 - const delta = ((view.speed-view.DEBUFF_SLOW)/3) * this.dt * move.direction; + const delta = (view.Attrs[Attrs.SPEED]/3) * this.dt * move.direction; const newX = view.node.position.x + delta; // 对于战士,允许更自由的移动范围 @@ -92,7 +91,7 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU if (Math.abs(currentX - finalTargetX) > 1) { // 确定移动方向 const direction = currentX > finalTargetX ? -1 : 1; - const delta = ((view.speed-view.DEBUFF_SLOW)/3) * this.dt * direction; + const delta = (view.Attrs[Attrs.SPEED]/3) * this.dt * direction; const newX = view.node.position.x + delta; // 设置朝向 @@ -124,7 +123,7 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU } // 计算移动量 - const delta = ((view.speed-view.DEBUFF_SLOW)/3) * this.dt * move.direction; + const delta =(view.Attrs[Attrs.SPEED]/3) * this.dt * move.direction; const newX = view.node.position.x + delta; // 限制移动范围 diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index fdfc7956..0b3dafac 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -40,7 +40,7 @@ const { ccclass, property } = _decorator; * const dbuffConf: DbuffConf = { * debuff: DBuff.STUN, // 眩晕 * BType: BType.VALUE, // 数值型 - * dev: 20, // 减少值 + * deV: 20, // 减少值 * deC: 3, // 持续3秒 * deR: 100 // 触发概率(100%) * }; @@ -386,7 +386,7 @@ export class HeroViewComp extends CCComp { for (const debuff of this.V_DBUFF) { // 跳过状态类 debuff(attrField === -1) if (debuff.attrField !== undefined && debuff.attrField >= 0) { - this.Attrs[debuff.attrField] -= debuff.dev; + this.Attrs[debuff.attrField] -= debuff.deV; } } @@ -394,7 +394,7 @@ export class HeroViewComp extends CCComp { for (const debuff of this.V_DBUFFS) { // 跳过状态类 debuff(attrField === -1) if (debuff.attrField !== undefined && debuff.attrField >= 0) { - this.Attrs[debuff.attrField] -= debuff.dev; + this.Attrs[debuff.attrField] -= debuff.deV; } } } @@ -417,7 +417,7 @@ export class HeroViewComp extends CCComp { // 跳过状态类 debuff(attrField === -1) if (debuff.attrField !== undefined && debuff.attrField >= 0) { const baseVal = baseValues[debuff.attrField] || this.Attrs[debuff.attrField]; - this.Attrs[debuff.attrField] -= Math.floor(baseVal * (debuff.dev / 100)); + this.Attrs[debuff.attrField] -= Math.floor(baseVal * (debuff.deV / 100)); } } @@ -426,7 +426,7 @@ export class HeroViewComp extends CCComp { // 跳过状态类 debuff(attrField === -1) if (debuff.attrField !== undefined && debuff.attrField >= 0) { const baseVal = baseValues[debuff.attrField] || this.Attrs[debuff.attrField]; - this.Attrs[debuff.attrField] -= Math.floor(baseVal * (debuff.dev / 100)); + this.Attrs[debuff.attrField] -= Math.floor(baseVal * (debuff.deV / 100)); } } }