refactor(talent): 天赋升级系统重构为金币消耗模式
- 移除碎片相关配置与数据结构,统一使用 costs 数组配置每级金币消耗 - 优化天赋配置文案,去除名称中的冗余字样,精简属性描述文本 - 清理 SingletonModuleComp 存档及云端同步中的碎片字段 - 修改 TalentsComp 界面逻辑,升级校验、扣除及重置返还全面切换为金币体系 - 调整界面显示细节:等级格式变更为 current/max,消耗仅显示纯数值
This commit is contained in:
@@ -8,7 +8,7 @@ import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
||||
import { GameEvent } from "./config/GameEvent";
|
||||
import { GameScoreStats } from "./config/HeroAttrs";
|
||||
import { mLogger } from "./Logger";
|
||||
import { TalentFragmentType, TalentType } from "./config/TalentSet";
|
||||
import { TalentType } from "./config/TalentSet";
|
||||
import { gameDataSync } from "./GameDataSync";
|
||||
import { FightSet } from "./config/GameSet";
|
||||
|
||||
@@ -23,7 +23,6 @@ export interface GameDate{
|
||||
talents: Record<TalentType, number>,
|
||||
player_level: number,
|
||||
player_exp: number,
|
||||
talent_fragments: Record<TalentFragmentType, number>,
|
||||
talent_points?: number,
|
||||
}
|
||||
}
|
||||
@@ -67,7 +66,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
talents: Record<TalentType, number>;
|
||||
player_level: number;
|
||||
player_exp: number;
|
||||
talent_fragments: Record<TalentFragmentType, number>;
|
||||
talent_points?: number;
|
||||
} = {
|
||||
talents: {
|
||||
@@ -85,16 +83,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
}, // 存储各个天赋的等级: { talent_id: level }
|
||||
player_level: 1, // 玩家等级
|
||||
player_exp: 0, // 玩家当前经验
|
||||
talent_fragments: {
|
||||
[TalentFragmentType.Power]: 0,
|
||||
[TalentFragmentType.Tempest]: 0,
|
||||
[TalentFragmentType.Vitality]: 0,
|
||||
[TalentFragmentType.Frost]: 0,
|
||||
[TalentFragmentType.Tactics]: 0,
|
||||
[TalentFragmentType.Spirit]: 0,
|
||||
[TalentFragmentType.Trade]: 0,
|
||||
[TalentFragmentType.Fate]: 0
|
||||
}, // 当前拥有的天赋碎片库存
|
||||
talent_points: 0, // 兼容旧存档的历史字段
|
||||
};
|
||||
|
||||
@@ -266,9 +254,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
}
|
||||
if (typeof remoteCol.player_level === 'number') this.collection.player_level = remoteCol.player_level;
|
||||
if (typeof remoteCol.player_exp === 'number') this.collection.player_exp = remoteCol.player_exp;
|
||||
if (remoteCol.talent_fragments) {
|
||||
Object.assign(this.collection.talent_fragments, remoteCol.talent_fragments);
|
||||
}
|
||||
if (typeof remoteCol.talent_points === 'number') this.collection.talent_points = remoteCol.talent_points;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,28 +17,6 @@ export enum TalentType {
|
||||
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;
|
||||
@@ -52,10 +30,8 @@ export interface TalentInfo {
|
||||
maxLevel: number;
|
||||
/** 每一级的加成数值,从第1级到最大级 */
|
||||
values: number[];
|
||||
/** 每一级的消耗数量,下标 0 表示升到 1 级 */
|
||||
/** 每一级的金币消耗数量,下标 0 表示升到 1 级 */
|
||||
costs: number[];
|
||||
/** 升级所需的单碎片类型 */
|
||||
fragmentType: TalentFragmentType;
|
||||
}
|
||||
|
||||
export const TalentConfig = {
|
||||
@@ -66,41 +42,29 @@ export const TalentConfig = {
|
||||
{ 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 }
|
||||
{ id: TalentType.Attack, name: "攻击", icon: "⚔️", desc: "+{value}%",
|
||||
maxLevel: 5, values: [3, 6, 9, 12, 15], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Hp, name: "生命", icon: "❤️", desc: "+{value}%",
|
||||
maxLevel: 5, values: [5, 10, 15, 20, 25], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Critical, name: "暴击率", icon: "🔥", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.WindFury, name: "风怒率", icon: "⚡", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Freeze, name: "冰冻率", icon: "❄️", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ 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] },
|
||||
{ id: TalentType.DeadTrigger, name: "亡语额外触发", icon: "🛡️", desc: "+{value}次",
|
||||
maxLevel: 1, values: [1], costs: [25] },
|
||||
{ id: TalentType.Summon, name: "召唤额外触发", icon: "🛡️", desc: "+{value}次",
|
||||
maxLevel: 1, values: [1], costs: [25] },
|
||||
{ id: TalentType.BuyDiscount, name: "购买优惠", icon: "🛒", desc: "-{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] },
|
||||
{ id: TalentType.RefreshDiscount, name: "刷新优惠", icon: "🔄", desc: "-{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] },
|
||||
{ id: TalentType.SellBonus, name: "出售返还", icon: "💰", desc: "+{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] }
|
||||
] as TalentInfo[]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user