- 新增 TalentFragmentType 枚举和 TalentFragmentInfo 接口定义碎片类型 - 在 SingletonModuleComp 中新增 talent_fragments 字段存储碎片库存,talent_points 改为可选字段以兼容旧存档 - 为每个天赋配置 fragmentType 指定升级所需的具体碎片类型 - 修改 TalentsComp 升级逻辑,从消耗天赋点改为扣除对应类型的碎片 - 重置天赋功能现在返还已消耗的碎片而非天赋点 - 更新界面显示,展示碎片库存摘要和具体消耗
107 lines
5.5 KiB
TypeScript
107 lines
5.5 KiB
TypeScript
/**
|
||
* @file TalentSet.ts
|
||
* @description 天赋系统配置数据,包含经验要求、消耗、每个天赋的具体加成数值和描述。
|
||
*/
|
||
|
||
export enum TalentType {
|
||
Attack = 1, // 攻击强化
|
||
Hp = 2, // 生命强化
|
||
Critical = 3, // 暴击强化
|
||
WindFury = 4, // 风怒强化
|
||
Freeze = 5, // 冰冻强化
|
||
Puncture = 6, // 穿刺强化
|
||
DeadTrigger = 7,// 亡语强化
|
||
Summon = 8, // 召唤强化
|
||
BuyDiscount = 9,// 采购优惠
|
||
RefreshDiscount = 10, // 刷新优惠
|
||
SellBonus = 11 // 出售补贴
|
||
}
|
||
|
||
export enum TalentFragmentType {
|
||
Power = 1, // 力量碎片
|
||
Tempest = 2, // 风暴碎片
|
||
Vitality = 3, // 生机碎片
|
||
Frost = 4, // 寒霜碎片
|
||
Tactics = 5, // 谋略碎片
|
||
Spirit = 6, // 灵契碎片
|
||
Trade = 7, // 商贸碎片
|
||
Fate = 8 // 命运碎片
|
||
}
|
||
|
||
export interface TalentFragmentInfo {
|
||
/** 碎片 ID */
|
||
id: TalentFragmentType;
|
||
/** 碎片名称 */
|
||
name: string;
|
||
/** 碎片图标或标识(可选) */
|
||
icon?: string;
|
||
/** 该碎片可用于哪些天赋,单个碎片最多映射 3 个天赋 */
|
||
talentIds: TalentType[];
|
||
}
|
||
|
||
export interface TalentInfo {
|
||
/** 天赋 ID */
|
||
id: number;
|
||
/** 天赋名称 */
|
||
name: string;
|
||
/** 天赋图标或标识(可选) */
|
||
icon?: string;
|
||
/** 描述模板,使用 {value} 替换具体数值 */
|
||
desc: string;
|
||
/** 最大等级 */
|
||
maxLevel: number;
|
||
/** 每一级的加成数值,从第1级到最大级 */
|
||
values: number[];
|
||
/** 每一级的消耗数量,下标 0 表示升到 1 级 */
|
||
costs: number[];
|
||
/** 升级所需的单碎片类型 */
|
||
fragmentType: TalentFragmentType;
|
||
}
|
||
|
||
export const TalentConfig = {
|
||
// 玩家升级所需经验配置
|
||
expRequirements: [
|
||
{ maxLevel: 10, expPerLevel: 100 },
|
||
{ maxLevel: 20, expPerLevel: 150 },
|
||
{ maxLevel: 30, expPerLevel: 200 }
|
||
],
|
||
|
||
// 天赋碎片配置:不同天赋可共用同一种碎片,单个碎片最多映射 3 个天赋
|
||
fragments: [
|
||
{ id: TalentFragmentType.Power, name: "力量碎片", icon: "◆", talentIds: [TalentType.Attack, TalentType.Critical, TalentType.Puncture] },
|
||
{ id: TalentFragmentType.Tempest, name: "风暴碎片", icon: "◇", talentIds: [TalentType.WindFury, TalentType.RefreshDiscount] },
|
||
{ id: TalentFragmentType.Vitality, name: "生机碎片", icon: "●", talentIds: [TalentType.Hp, TalentType.DeadTrigger, TalentType.Summon] },
|
||
{ id: TalentFragmentType.Frost, name: "寒霜碎片", icon: "○", talentIds: [TalentType.Freeze] },
|
||
{ id: TalentFragmentType.Tactics, name: "谋略碎片", icon: "■", talentIds: [TalentType.BuyDiscount] },
|
||
{ id: TalentFragmentType.Spirit, name: "灵契碎片", icon: "□", talentIds: [TalentType.SellBonus] },
|
||
{ id: TalentFragmentType.Trade, name: "商贸碎片", icon: "▲", talentIds: [] },
|
||
{ id: TalentFragmentType.Fate, name: "命运碎片", icon: "△", talentIds: [] }
|
||
] as TalentFragmentInfo[],
|
||
|
||
// 所有天赋定义(使用数组维护)
|
||
talents: [
|
||
{ id: TalentType.Attack, name: "攻击强化", icon: "⚔️", desc: "所有英雄 ATK +{value}%",
|
||
maxLevel: 5, values: [3, 6, 9, 12, 15], costs: [1, 1, 2, 2, 3], fragmentType: TalentFragmentType.Power },
|
||
{ id: TalentType.Hp, name: "生命强化", icon: "❤️", desc: "所有英雄 HP +{value}%",
|
||
maxLevel: 5, values: [5, 10, 15, 20, 25], costs: [1, 1, 2, 2, 3], fragmentType: TalentFragmentType.Vitality },
|
||
{ id: TalentType.Critical, name: "暴击强化", icon: "🔥", desc: "所有英雄暴击率 +{value}%",
|
||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3], fragmentType: TalentFragmentType.Power },
|
||
{ id: TalentType.WindFury, name: "风怒强化", icon: "⚡", desc: "所有英雄风怒率 +{value}%",
|
||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3], fragmentType: TalentFragmentType.Tempest },
|
||
{ id: TalentType.Freeze, name: "冰冻强化", icon: "❄️", desc: "所有英雄冰冻率 +{value}%",
|
||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3], fragmentType: TalentFragmentType.Frost },
|
||
{ id: TalentType.Puncture, name: "穿刺强化", icon: "🗡️", desc: "所有英雄穿刺 +{value}",
|
||
maxLevel: 5, values: [0.2, 0.4, 0.6, 0.8, 1.0], costs: [1, 1, 2, 2, 3], fragmentType: TalentFragmentType.Power },
|
||
{ id: TalentType.DeadTrigger, name: "亡语强化", icon: "🛡️", desc: "死亡触发技能额外触发次数+{value}次",
|
||
maxLevel: 1, values: [1], costs: [25], fragmentType: TalentFragmentType.Vitality },
|
||
{ id: TalentType.Summon, name: "召唤强化", icon: "🛡️", desc: "召唤触发技能额外触发次数+{value}次",
|
||
maxLevel: 1, values: [1], costs: [25], fragmentType: TalentFragmentType.Vitality },
|
||
{ id: TalentType.BuyDiscount, name: "采购优惠", icon: "🛒", desc: "购买英雄 -{value}金",
|
||
maxLevel: 1, values: [1], costs: [10], fragmentType: TalentFragmentType.Tactics },
|
||
{ id: TalentType.RefreshDiscount, name: "刷新优惠", icon: "🔄", desc: "刷新重抽 -{value}金",
|
||
maxLevel: 1, values: [1], costs: [10], fragmentType: TalentFragmentType.Tempest },
|
||
{ id: TalentType.SellBonus, name: "出售补贴", icon: "💰", desc: "出售英雄返还 +{value}金币",
|
||
maxLevel: 1, values: [1], costs: [10], fragmentType: TalentFragmentType.Spirit }
|
||
] as TalentInfo[]
|
||
};
|