refactor(talent): 重构天赋升级消耗计算逻辑

1.  将天赋升级消耗从按等级索引改为按阶位统一配置
2.  调整getTalentUpgradeCost入参和计算逻辑
3.  更新天赋已投入点数的统计方式,优化计算效率
4.  修正天赋升级消耗判断的参数传递错误
This commit is contained in:
panFD
2026-09-04 23:24:01 +08:00
parent fcb9f293dc
commit cf27211171
3 changed files with 16 additions and 14 deletions

View File

@@ -509,7 +509,7 @@ export class SingletonModuleComp extends ecs.Comp {
if (curLv >= cfg.max_lv) return false;
// 阶位解锁:二/三阶天赋要求前一阶累计投入点数达标(一阶恒解锁)
if (!isTalentTierUnlocked(this.data.talents, cfg.tier)) return false;
const cost = getTalentUpgradeCost(curLv);
const cost = getTalentUpgradeCost(cfg.tier);
if (cost < 0 || this.getTalentPoints() < cost) return false;
this.data.talent_points -= cost;
this.data.talents[uuid] = curLv + 1;