From e36abeb380e4965c5f6c78f7cbff2cf829f6f92e Mon Sep 17 00:00:00 2001 From: panw Date: Fri, 17 Oct 2025 10:31:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(skill):=20=E7=BB=9F=E4=B8=80=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=AD=A3deV=E5=AD=97=E6=AE=B5=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将DbuffConf接口中的字段名称dev修正为deV - 修复HeroViewComp中所有对dev字段的引用为deV - 调整BattleMoveSystem中速度计算逻辑,使用正确的buff叠加值 - 统一代码注释中减少值的字段名称为deV - 保持功能逻辑不变,提升代码一致性和可读性 --- assets/script/game/common/config/SkillSet.ts | 4 ++-- .../common/ecs/position/BattleMoveSystem.ts | 4 +++- assets/script/game/hero/HeroViewComp.ts | 18 +++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index 9d7decf2..9ac6d359 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -289,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 cfc18c5d..447fbd4d 100644 --- a/assets/script/game/common/ecs/position/BattleMoveSystem.ts +++ b/assets/script/game/common/ecs/position/BattleMoveSystem.ts @@ -91,8 +91,10 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU // 如果不在目标位置,移动到目标位置 if (Math.abs(currentX - finalTargetX) > 1) { // 确定移动方向 + let B_SPEED=view.R_BUFFS[Attrs.SPEED]?view.R_BUFFS[Attrs.SPEED]:0; + let D_SPEED=view.R_DBUFFS[Attrs.SPEED]?view.R_DBUFFS[Attrs.SPEED]:0; const direction = currentX > finalTargetX ? -1 : 1; - const delta = ((view.speed*(100+view.R_BUFFS.SPEED))/3) * this.dt * direction; + const delta = ((view.speed*(100+B_SPEED+D_SPEED))/3) * this.dt * 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 090b6597..ca3ae37c 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%) * }; @@ -279,7 +279,7 @@ export class HeroViewComp extends CCComp { if (dbuffConf.deC === 0) { // 持久型 - 如果已存在,累加数值 if (this.V_DBUFF[debuffKey]) { - this.V_DBUFF[debuffKey].dev += dbuffConf.dev; + this.V_DBUFF[debuffKey].deV += dbuffConf.deV; } else { this.V_DBUFF[debuffKey] = { ...dbuffConf, @@ -289,7 +289,7 @@ export class HeroViewComp extends CCComp { } else { // 临时型 - 如果已存在,累加数值并重置时间 if (this.V_DBUFFS[debuffKey]) { - this.V_DBUFFS[debuffKey].dev += dbuffConf.dev; + this.V_DBUFFS[debuffKey].deV += dbuffConf.deV; this.V_DBUFFS[debuffKey].remainTime = Math.max(this.V_DBUFFS[debuffKey].remainTime, dbuffConf.deC); } else { this.V_DBUFFS[debuffKey] = { @@ -304,7 +304,7 @@ export class HeroViewComp extends CCComp { if (dbuffConf.deC === 0) { // 持久型 - 如果已存在,累加百分比 if (this.R_DBUFF[debuffKey]) { - this.R_DBUFF[debuffKey].dev += dbuffConf.dev; + this.R_DBUFF[debuffKey].deV += dbuffConf.deV; } else { this.R_DBUFF[debuffKey] = { ...dbuffConf, @@ -314,7 +314,7 @@ export class HeroViewComp extends CCComp { } else { // 临时型 - 如果已存在,累加百分比并重置时间 if (this.R_DBUFFS[debuffKey]) { - this.R_DBUFFS[debuffKey].dev += dbuffConf.dev; + this.R_DBUFFS[debuffKey].deV += dbuffConf.deV; this.R_DBUFFS[debuffKey].remainTime = Math.max(this.R_DBUFFS[debuffKey].remainTime, dbuffConf.deC); } else { this.R_DBUFFS[debuffKey] = { @@ -431,7 +431,7 @@ export class HeroViewComp extends CCComp { const debuff = this.V_DBUFF[debuffKey]; // 跳过状态类 debuff(attrField === -1) if (debuff.attrField !== undefined && debuff.attrField >= 0) { - this.Attrs[debuff.attrField] -= debuff.dev; + this.Attrs[debuff.attrField] -= debuff.deV; } } @@ -440,7 +440,7 @@ export class HeroViewComp extends CCComp { const debuff = this.V_DBUFFS[debuffKey]; // 跳过状态类 debuff(attrField === -1) if (debuff.attrField !== undefined && debuff.attrField >= 0) { - this.Attrs[debuff.attrField] -= debuff.dev; + this.Attrs[debuff.attrField] -= debuff.deV; } } } @@ -464,7 +464,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)); } } @@ -474,7 +474,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)); } } }