refactor(skill): 统一并更正deV字段命名
- 将DbuffConf接口中的字段名称dev修正为deV - 修复HeroViewComp中所有对dev字段的引用为deV - 调整BattleMoveSystem中速度计算逻辑,使用正确的buff叠加值 - 统一代码注释中减少值的字段名称为deV - 保持功能逻辑不变,提升代码一致性和可读性
This commit is contained in:
@@ -289,9 +289,9 @@ export const HeroSkillList = [6001,6001,6001,6001,6001,6001]
|
|||||||
export interface DbuffConf {
|
export interface DbuffConf {
|
||||||
debuff: DBuff; // debuff类型
|
debuff: DBuff; // debuff类型
|
||||||
BType:BType //buff是数值型还是百分比型
|
BType:BType //buff是数值型还是百分比型
|
||||||
dev: number; // 效果值 (原deV)
|
deV: number; // 效果值
|
||||||
deC: number; // 持续时间
|
deC: number; // 持续时间
|
||||||
deR: number; // 触发概率 (原deR)
|
deR: number; // 触发概率
|
||||||
}
|
}
|
||||||
export interface BuffConf {
|
export interface BuffConf {
|
||||||
buff:Attrs;
|
buff:Attrs;
|
||||||
|
|||||||
@@ -91,8 +91,10 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
|
|||||||
// 如果不在目标位置,移动到目标位置
|
// 如果不在目标位置,移动到目标位置
|
||||||
if (Math.abs(currentX - finalTargetX) > 1) {
|
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 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;
|
const newX = view.node.position.x + delta;
|
||||||
|
|
||||||
// 设置朝向
|
// 设置朝向
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const { ccclass, property } = _decorator;
|
|||||||
* const dbuffConf: DbuffConf = {
|
* const dbuffConf: DbuffConf = {
|
||||||
* debuff: DBuff.STUN, // 眩晕
|
* debuff: DBuff.STUN, // 眩晕
|
||||||
* BType: BType.VALUE, // 数值型
|
* BType: BType.VALUE, // 数值型
|
||||||
* dev: 20, // 减少值
|
* deV: 20, // 减少值
|
||||||
* deC: 3, // 持续3秒
|
* deC: 3, // 持续3秒
|
||||||
* deR: 100 // 触发概率(100%)
|
* deR: 100 // 触发概率(100%)
|
||||||
* };
|
* };
|
||||||
@@ -279,7 +279,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
if (dbuffConf.deC === 0) {
|
if (dbuffConf.deC === 0) {
|
||||||
// 持久型 - 如果已存在,累加数值
|
// 持久型 - 如果已存在,累加数值
|
||||||
if (this.V_DBUFF[debuffKey]) {
|
if (this.V_DBUFF[debuffKey]) {
|
||||||
this.V_DBUFF[debuffKey].dev += dbuffConf.dev;
|
this.V_DBUFF[debuffKey].deV += dbuffConf.deV;
|
||||||
} else {
|
} else {
|
||||||
this.V_DBUFF[debuffKey] = {
|
this.V_DBUFF[debuffKey] = {
|
||||||
...dbuffConf,
|
...dbuffConf,
|
||||||
@@ -289,7 +289,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
} else {
|
} else {
|
||||||
// 临时型 - 如果已存在,累加数值并重置时间
|
// 临时型 - 如果已存在,累加数值并重置时间
|
||||||
if (this.V_DBUFFS[debuffKey]) {
|
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);
|
this.V_DBUFFS[debuffKey].remainTime = Math.max(this.V_DBUFFS[debuffKey].remainTime, dbuffConf.deC);
|
||||||
} else {
|
} else {
|
||||||
this.V_DBUFFS[debuffKey] = {
|
this.V_DBUFFS[debuffKey] = {
|
||||||
@@ -304,7 +304,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
if (dbuffConf.deC === 0) {
|
if (dbuffConf.deC === 0) {
|
||||||
// 持久型 - 如果已存在,累加百分比
|
// 持久型 - 如果已存在,累加百分比
|
||||||
if (this.R_DBUFF[debuffKey]) {
|
if (this.R_DBUFF[debuffKey]) {
|
||||||
this.R_DBUFF[debuffKey].dev += dbuffConf.dev;
|
this.R_DBUFF[debuffKey].deV += dbuffConf.deV;
|
||||||
} else {
|
} else {
|
||||||
this.R_DBUFF[debuffKey] = {
|
this.R_DBUFF[debuffKey] = {
|
||||||
...dbuffConf,
|
...dbuffConf,
|
||||||
@@ -314,7 +314,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
} else {
|
} else {
|
||||||
// 临时型 - 如果已存在,累加百分比并重置时间
|
// 临时型 - 如果已存在,累加百分比并重置时间
|
||||||
if (this.R_DBUFFS[debuffKey]) {
|
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);
|
this.R_DBUFFS[debuffKey].remainTime = Math.max(this.R_DBUFFS[debuffKey].remainTime, dbuffConf.deC);
|
||||||
} else {
|
} else {
|
||||||
this.R_DBUFFS[debuffKey] = {
|
this.R_DBUFFS[debuffKey] = {
|
||||||
@@ -431,7 +431,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
const debuff = this.V_DBUFF[debuffKey];
|
const debuff = this.V_DBUFF[debuffKey];
|
||||||
// 跳过状态类 debuff(attrField === -1)
|
// 跳过状态类 debuff(attrField === -1)
|
||||||
if (debuff.attrField !== undefined && debuff.attrField >= 0) {
|
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];
|
const debuff = this.V_DBUFFS[debuffKey];
|
||||||
// 跳过状态类 debuff(attrField === -1)
|
// 跳过状态类 debuff(attrField === -1)
|
||||||
if (debuff.attrField !== undefined && debuff.attrField >= 0) {
|
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)
|
// 跳过状态类 debuff(attrField === -1)
|
||||||
if (debuff.attrField !== undefined && debuff.attrField >= 0) {
|
if (debuff.attrField !== undefined && debuff.attrField >= 0) {
|
||||||
const baseVal = baseValues[debuff.attrField] || this.Attrs[debuff.attrField];
|
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)
|
// 跳过状态类 debuff(attrField === -1)
|
||||||
if (debuff.attrField !== undefined && debuff.attrField >= 0) {
|
if (debuff.attrField !== undefined && debuff.attrField >= 0) {
|
||||||
const baseVal = baseValues[debuff.attrField] || this.Attrs[debuff.attrField];
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user