还有好多错误
This commit is contained in:
@@ -113,23 +113,6 @@ export enum DBuff {
|
||||
BUFF_DOWN = 14,// buff效果减弱
|
||||
}
|
||||
|
||||
export const geDebuffNum=()=>{
|
||||
return {
|
||||
[DBuff.STUN]:0, //眩晕
|
||||
[DBuff.SLOW]:0, //减速
|
||||
[DBuff.FROST]:0, //冰冻
|
||||
[DBuff.BURN]:0, //易伤
|
||||
[DBuff.DEAS]:0, //减cd
|
||||
[DBuff.DEHP]:0, //减生命最大值
|
||||
[DBuff.DEAP]:0, //减攻击力
|
||||
[DBuff.DEMGP]:0, //减魔法攻击力
|
||||
[DBuff.BACK]:0, //+击退比率
|
||||
[DBuff.CRITICAL]:0,//-技能暴击几率
|
||||
[DBuff.CRIT_DAMAGE]:0,
|
||||
[DBuff.DODGE]:0,
|
||||
[DBuff.DBUFFUP]:0,
|
||||
}
|
||||
}
|
||||
|
||||
export enum Attrs {
|
||||
HP_MAX = 0, //生命值
|
||||
@@ -171,6 +154,64 @@ export const getAttrs=()=>{
|
||||
});
|
||||
return reAttrs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 debuff 对应的属性字段
|
||||
* @param debuffType DBuff 类型
|
||||
* @returns 对应的 Attrs 字段,如果是状态类 debuff(只缓存)返回 -1
|
||||
*
|
||||
* 扩展说明:
|
||||
* 1. 普通 debuff:返回 Attrs 值(会直接修改属性)
|
||||
* 2. 状态类 debuff:返回 -1(只缓存,不修改属性)
|
||||
*
|
||||
* 新增 DBuff 时:
|
||||
* - 如果需要修改属性,在 debuffAttrMap 中添加映射: [DBuff.NEW]: Attrs.ATTR
|
||||
* - 如果只需缓存状态,在 stateDebuffSet 中添加: DBuff.NEW
|
||||
*/
|
||||
export const getAttrFieldFromDebuff = (debuffType: DBuff): number => {
|
||||
// 状态类 debuff(只需缓存,不影响属性)
|
||||
const stateDebuffSet = new Set<DBuff>([
|
||||
DBuff.STUN,
|
||||
DBuff.SLOW,
|
||||
DBuff.FROST,
|
||||
DBuff.BURN,
|
||||
]);
|
||||
|
||||
// 检查是否是状态类 debuff
|
||||
if (stateDebuffSet.has(debuffType)) {
|
||||
return -1; // 表示只缓存,不影响属性
|
||||
}
|
||||
|
||||
// ==================== 普通 Debuff 到 Attrs 的完整映射表 ====================
|
||||
// 格式: [DBuff 类型]: Attrs 属性(会直接修改属性值)
|
||||
// 注意:新增普通 debuff 时,在此添加映射关系即可
|
||||
const debuffAttrMap: Record<DBuff, number> = {
|
||||
[DBuff.STUN]: Attrs.CON_RES, // 眩晕 -> 控制抗性
|
||||
[DBuff.SLOW]: Attrs.AS, // 减速 -> 攻击速度
|
||||
[DBuff.FROST]: Attrs.ICE_RES, // 冰冻 -> 冰冻抗性
|
||||
[DBuff.BURN]: Attrs.DEF, // 易伤 -> 防御
|
||||
[DBuff.DEAS]: Attrs.AS, // 减cd -> 攻击速度
|
||||
[DBuff.DEHP]: Attrs.HP_MAX, // 减hp -> 最大生命值
|
||||
[DBuff.DEAP]: Attrs.AP, // 减atk -> 攻击力
|
||||
[DBuff.DEMGP]: Attrs.MAP, // 减魔法 -> 魔法攻击力
|
||||
[DBuff.BACK]: Attrs.KNOCKBACK, // 击退 -> 击退概率
|
||||
[DBuff.CRITICAL]: Attrs.CRITICAL, // -暴击率 -> 暴击率
|
||||
[DBuff.CRIT_DAMAGE]: Attrs.CRITICAL_DMG, // -暴击伤害 -> 暴击伤害
|
||||
[DBuff.DODGE]: Attrs.DODGE, // -闪避 -> 闪避
|
||||
[DBuff.DBUFFUP]: Attrs.DBUFF_UP, // debuff提升 -> debuff提升
|
||||
[DBuff.BUFF_DOWN]: Attrs.BUFF_UP, // buff减弱 -> buff效果
|
||||
};
|
||||
|
||||
const attrField = debuffAttrMap[debuffType];
|
||||
|
||||
// 如果映射不存在,打印警告信息(方便开发调试)
|
||||
if (attrField === undefined) {
|
||||
console.warn(`[SkillSet] 未知的 DBuff 类型: ${debuffType},请在 getAttrFieldFromDebuff 添加映射关系或放入 stateDebuffSet`);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return attrField;
|
||||
};
|
||||
|
||||
|
||||
export enum BType {
|
||||
|
||||
Reference in New Issue
Block a user