refactor(skill/hero): 重构技能buff系统,优化属性处理与技能加成逻辑

- 新增HeroAttrsComp的add_special_attr方法,实现动态累加任意数字类型的英雄属性
- 废弃旧的BuffConf数组配置格式,改用单一buff_type字段简化技能buff配置
- 修复金币类技能加成未随技能等级提升的问题,调整计算逻辑为baseGold + sUp.ap * skillLv
- 重构applyActualFriendlyEffect方法,添加技能等级参数,按buff类型匹配对应升级加成
- 更新所有内置技能配置为新的格式规范
This commit is contained in:
walkpan
2026-05-23 13:26:11 +08:00
parent fce7646de6
commit 9eccca7e2a
3 changed files with 73 additions and 45 deletions

View File

@@ -6,6 +6,7 @@ import { FacSet, FightSet } from "../common/config/GameSet";
import { FieldSkillSet, FieldSkillType, SkillOverrides } from "../common/config/SkillSet";
import { smc } from "../common/SingletonModuleComp";
import { TalentConfig, TalentType } from "../common/config/TalentSet";
import { Attrs } from "../common/config/HeroAttrs";
import { FieldSkillHelper } from "./FieldSkillHelper";
@ecs.register('HeroAttrs')
export class HeroAttrsComp extends ecs.Comp {
@@ -135,6 +136,25 @@ export class HeroAttrsComp extends ecs.Comp {
return value
}
/**
* 统一的特殊/固定属性数值增加方法
* @param attr_type 属性类型枚举
* @param value 增加的数值
*/
add_special_attr(attr_type: Attrs, value: number) {
// 利用枚举值(字符串)与类属性名一致的特性,动态访问并累加属性
const key = attr_type as keyof this;
// 确保目标属性存在且类型为数字,避免运行时错误
if (typeof this[key] === 'number') {
(this as any)[key] += value;
} else {
if (this.debugMode) {
mLogger.log(this.debugMode, 'HeroAttrs', `未找到对应数字属性或无法累加: attr_type=${attr_type}, value=${value}`);
}
}
}
toFrost(time: number=1) {
const frostTime = FightSet.FROST_TIME * time;