refactor: 重构天赋系统与技能触发逻辑

1.  重构天赋系统架构:将天赋加成与触发修正统一收敛到 HeroAttrsComp.applyTalent
2.  新增天赋触发修正字段:talent_t_num_reduce 与 talent_extra_trigger_chance
3.  重构天赋加点逻辑:统一 1 点/级,新增软前置校验
4.  优化天赋UI组件:改为编辑器静态配置驱动,重构层位展示逻辑
5.  修复技能触发判定:在 SkillTriggerHelper 中应用天赋触发修正
6.  调整天赋配置结构:改为 5 层递进解锁,新增 L4/L5 专属触发修正配置
This commit is contained in:
panFD
2026-09-19 11:20:55 +08:00
parent f53c4293df
commit 707e25e73f
11 changed files with 12833 additions and 7245 deletions

View File

@@ -5,6 +5,7 @@ import { FacSet, FightSet } from "../common/config/GameSet";
import { FieldSkillSet, FieldSkillType, SkillOverrides } from "../common/config/SkillSet";
import { smc } from "../common/SingletonModuleComp";
import { Attrs } from "../common/config/HeroAttrs";
import { applyTalentBonuses, getTalentExtraTriggerChance, getTalentTriggerNumReduce } from "../common/config/TalentSet";
import { FieldSkillHelper } from "./FieldSkillHelper";
import { BuffComp } from "./BuffComp";
import { BuffList, ModOp } from "../common/config/BuffSet";
@@ -101,6 +102,10 @@ export class HeroAttrsComp extends ecs.Comp {
thorns_dmg: number = 0; // 反伤伤害(固定值,受到攻击时对攻击者造成等量伤害)
thorns_rate: number = 0; // 反伤比例(百分点;反伤值 = 实际受到伤害 * thorns_rate / 100 + thorns_dmg)
// ==================== 天赋触发修正(L4/L5 写入,SkillTriggerHelper 消费) ====================
talent_t_num_reduce: number = 0; // L4:触发类技能计数阈值减少量(下限 1 由消费端 clamp)
talent_extra_trigger_chance: number = 0; // L5:触发类技能额外触发 1 次的概率(百分点)
revived_count: number = 0; // 已复活次数(从 dead 触发配置的 revive_count 限制)
death_count: number = 0; // 本回合死亡次数(用于 dead 触发统计)
invincible_time: number = 0;// 无敌时间
@@ -154,6 +159,20 @@ export class HeroAttrsComp extends ecs.Comp {
*/
initAttrs() {
}
/**
* 天赋统一应用入口:写入属性加成(L1-L3)与触发修正(L4/L5)。
* Why: 收敛到属性组件单点调用,Hero.load 与局内升级重算(applyHeroLevel)不再各自 import TalentSet;
* 触发修正必须在 runtime_* 触发缓存 resolve 之前写入,才能影响 SkillTriggerHelper 的阈值判定。
* 调用前请确保触发修正字段已归零(升级重算路径由调用方归零,保证幂等)。
*/
applyTalent(): void {
if (this.fac !== FacSet.HERO) return;
const levels = smc.getTalentLevels();
this.talent_t_num_reduce = getTalentTriggerNumReduce(levels, this.role);
this.talent_extra_trigger_chance = getTalentExtraTriggerChance(levels, this.role);
applyTalentBonuses(this, levels, this.role);
}
/*******************基础属性管理********************/
add_hp(value: number) {
@@ -765,6 +784,8 @@ export class HeroAttrsComp extends ecs.Comp {
this.buff_power = 0;
this.thorns_dmg = 0;
this.thorns_rate = 0;
this.talent_t_num_reduce = 0;
this.talent_extra_trigger_chance = 0;
this.boom = false;
// 重置技能距离缓存