Files
heros/assets/script/game/common/config/TalSet.ts
walkpan 3710f7f695 feat(英雄系统): 添加天赋组件及配套功能
实现英雄天赋系统核心功能,包括:
1. 新增 TalComp 组件管理天赋的获取、触发和效果应用
2. 重构 TalSet 配置结构,完善天赋类型和效果枚举
3. 在 Hero/Monster 实体中集成天赋组件
4. 为 SkillConComp 和 HeroViewComp 添加天赋相关引用
2025-10-28 00:07:50 +08:00

116 lines
6.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 天赋系统配置文件
* 支持定义英雄的特殊能力或特性
*/
import { Attrs, BType } from "./HeroAttrs";
import { SkillSet } from "./SkillSet";
// ========== 枚举定义 ==========
/**
* 天赋类型枚举,也是触发条件
*/
export enum TalType {
LEVEL = 1, // 基于特定等级触发
LEVEL_UP = 2, // 基于等级升级触发
ACTION_COUNT = 3, // 基于普通攻击触发, skills[0]计数触发
SKILL_COUNT = 4, // 基于技能触发, > skills[0]计数触发
DAMAGE_COUNT = 5, // 基于受伤次数触发
INIT = 6, // 初始触发,如:多1个技能
DEAD = 7 // 基于死亡触发
}
/**
* 触发效果
*/
export enum TalEType {
ATTRS = 1, // 属性修改
SKILL = 2, // 技能触发
SKILL_MORE = 3, // 天生多1个技能
}
/**
* 天赋配置接口
* 定义一个完整的天赋效果
*/
export interface ItalConf {
uuid: number; // 天赋ID
name: string; // 天赋名称
desc: string; // 天赋描述(说明触发条件和效果)
type: TalType;
triggerType: TalEType; // 触发效果类型
chance: number; // 触发概率,默认100,`0-100`之间的数字
t_value: number; // 触发的阈值如5级触发一次, 5次攻击触发一次,初始触发)
e_value: number; // 触发的效果值如增加10%攻击力, 触发的技能uuid,增加1个技能uuid
e_name: number; // 触发的特殊值,如具体属性类型, 0表示没有特定值,对应Attrs枚举
e_type: BType; // 效果类型, 主要针对属性修改,是百分比还是固定值
e_scaling: number; // 效果随等级缩放系数,默认1, 0.5表示效果随等级减半
e_count: number; // 触发效果的累计次数如触发2次技能实现召唤2个召唤物
stackable?: boolean; // 是否可堆叠效果默认true
maxStack?: number; // 最大堆叠次数(不设置表示无限制)
}
// ========== 天赋配置表 ==========
/**
* 天赋配置表 - 2行紧凑格式
* 每个天赋配置压缩为2行注释行 + 配置对象行
*
* 格式说明:
* 第1行// 天赋名称 - 英雄专属/通用 | 触发条件 | 效果描述
* 第2行{uuid, name, desc, type, triggerType, chance, t_value, e_value, e_name, e_type, e_scaling, e_count, stackable, maxStack}
*
* 使用说明:
* 1. 等级类天赋:当英雄升级到指定等级时,每次都会触发效果
* 2. 行为计数类:当特定行为累计达到阈值时触发,支持是否重置计数
* 3. 受伤计数类:当受伤累计达到阈值时触发,支持是否重置计数
* 4. 技能触发类:当特定条件满足时自动触发指定技能
*/
export const talConf: Record<number, ItalConf> = {
// ========== 等级类天赋 ==========
// 剑意提升 - 刘邦专属 | 每5级 | 攻击力+10%
7001: {uuid: 7001, name: "剑意提升", desc: "每升5级攻击力增加10%", type: TalType.LEVEL_UP, triggerType: TalEType.ATTRS,
chance: 100, t_value: 5, e_value: 0.10, e_name: Attrs.AP, e_type: BType.RATIO, e_scaling: 1, e_count: 1, stackable: true, maxStack: 10},
// 胡服骑射 - 赵武灵王专属 | 每3级 | 攻击速度+5%
7002: {uuid: 7002, name: "胡服骑射", desc: "每升3级攻击速度增加5%", type: TalType.LEVEL_UP, triggerType: TalEType.ATTRS,
chance: 100, t_value: 3, e_value: 0.05, e_name: Attrs.AS, e_type: BType.RATIO, e_scaling: 1.2, e_count: 1, stackable: true, maxStack: 15},
// 运筹帷幄 - 张良专属 | 每4级 | 魔法攻击力+8%
7004: {uuid: 7004, name: "运筹帷幄", desc: "每升4级魔法攻击力增加8%", type: TalType.LEVEL_UP, triggerType: TalEType.ATTRS,
chance: 100, t_value: 4, e_value: 0.08, e_name: Attrs.MAP, e_type: BType.RATIO, e_scaling: 1.3, e_count: 1, stackable: true, maxStack: 12},
// 后勤保障 - 萧何专属 | 每6级 | 生命回复+3点
7006: {uuid: 7006, name: "后勤保障", desc: "每升6级生命回复增加3点", type: TalType.LEVEL_UP, triggerType: TalEType.ATTRS,
chance: 100, t_value: 6, e_value: 3, e_name: Attrs.HP_REGEN, e_type: BType.VALUE, e_scaling: 1, e_count: 1, stackable: true, maxStack: 8},
// 离骚诗韵 - 屈原专属 | 每8次攻击 | 火焰伤害+2%
7101: {uuid: 7101, name: "离骚诗韵", desc: "每攻击8次触发火焰buff,火焰山航海加成增加2%,持续10秒", type: TalType.ACTION_COUNT, triggerType: TalEType.SKILL,
chance: 100, t_value: 8, e_value: SkillSet[6005].uuid, e_name: 0, e_type: BType.VALUE, e_scaling: 1, e_count: 1, stackable: true, maxStack: 15},
// ========== 初始触发类天赋 ==========
// 霸王之威 - 项羽专属 | 初始 | 生命值+100
7201: {uuid: 7201, name: "霸王之威", desc: "初始获得额外100点生命值", type: TalType.INIT, triggerType: TalEType.ATTRS,
chance: 100, t_value: 1, e_value: 100, e_name: Attrs.HP_MAX, e_type: BType.VALUE, e_scaling: 1, e_count: 1, stackable: false},
// 兵圣之道 - 孙武专属 | 初始 | 额外技能
7202: {uuid: 7202, name: "兵圣之道", desc: "初始获得额外一个技能", type: TalType.INIT, triggerType: TalEType.SKILL_MORE,
chance: 100, t_value: 1, e_value: SkillSet[6005].uuid, e_name: 0, e_type: BType.VALUE, e_scaling: 1, e_count: 1, stackable: false},
// ========== 受伤触发类天赋 ==========
// 坚韧意志 - 通用 | 每3次受伤 | 防御力+2点
7301: {uuid: 7301, name: "坚韧意志", desc: "每受伤3次50%纪律,触发[坚韧意志],防御力增加2点,持续10秒", type: TalType.DAMAGE_COUNT, triggerType: TalEType.SKILL,
chance: 50, t_value: 3, e_value: SkillSet[6005].uuid, e_name: 0, e_type: BType.VALUE, e_scaling: 1, e_count: 1, stackable: true, maxStack: 12},
// ========== 特定等级触发类天赋 ==========
// 坚韧意志 - 通用 | 每3次受伤 | 防御力+2点
7401: {uuid: 7401, name: "坚韧意志", desc: "20级是获得[坚韧意志]技能,防御力增加2点,持续10秒", type: TalType.LEVEL, triggerType: TalEType.SKILL_MORE,
chance: 100, t_value: 20, e_value: SkillSet[6005].uuid, e_name: 0, e_type: BType.VALUE, e_scaling: 1, e_count: 1, stackable: true, maxStack: 12},
};
// ========== 工具函数 ==========