feat(英雄属性): 增加全局属性加成计算
在英雄属性计算中集成全局属性加成,通过 SingletonModuleComp 中的 global_attrs 配置为特定属性提供基础值和数量加成。
This commit is contained in:
@@ -142,6 +142,17 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 全局属性加成 {attrIndex: [value, count]}
|
||||||
|
global_attrs: Record<number, [number, number]> = {
|
||||||
|
[Attrs.AP]: [1, 100], // 攻击力
|
||||||
|
[Attrs.HP_MAX]: [1, 10000], // 生命上限
|
||||||
|
[Attrs.DEF]: [1, 0], // 防御
|
||||||
|
[Attrs.SPEED]: [1, 0], // 速度
|
||||||
|
[Attrs.CRITICAL]: [1, 0], // 暴击率
|
||||||
|
[Attrs.STUN_CHANCE]: [1, 0], // 眩晕率
|
||||||
|
[Attrs.WFUNY]: [1, 0], // 风怒率
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录天赋获取
|
* 记录天赋获取
|
||||||
* @param id 天赋ID
|
* @param id 天赋ID
|
||||||
|
|||||||
@@ -370,6 +370,12 @@ export class HeroAttrsComp extends ecs.Comp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 全局属性加成
|
||||||
|
if (smc.global_attrs[attrIndex]) {
|
||||||
|
const [val, count] = smc.global_attrs[attrIndex];
|
||||||
|
totalRatio += val * count;
|
||||||
|
}
|
||||||
|
|
||||||
// 4. 根据属性类型计算最终值
|
// 4. 根据属性类型计算最终值
|
||||||
const attrType = AttrsType[attrIndex];
|
const attrType = AttrsType[attrIndex];
|
||||||
const isRatioAttr = attrType === BType.RATIO;
|
const isRatioAttr = attrType === BType.RATIO;
|
||||||
|
|||||||
Reference in New Issue
Block a user