feat(天赋系统): 重构天赋触发机制并添加天赋点数系统

- 移除升级触发类型(TriType.LUP)及相关逻辑,改为通过英雄配置定义天赋点数获取规则
- 新增天赋点数接口(ITalPts)和配置字段,支持攻击、受击等不同触发条件
- 在天赋配置中添加点数获取(Pts)和消耗(CPts)字段
- 移除必杀技触发类型(TriType.MAX)的处理逻辑
- 优化TalComp组件结构,移除不必要的heroView引用
- 添加天赋系统设计文档(taldev.md)
This commit is contained in:
walkpan
2026-02-21 23:45:23 +08:00
parent 366a469fac
commit 650bcccc58
5 changed files with 44 additions and 50 deletions

View File

@@ -169,7 +169,6 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
const talComp = casterEntity.get(TalComp);
if (hset === HSSet.atk) talComp.updateCur(TriType.ATK);
if (hset === HSSet.skill) talComp.updateCur(TriType.SKILL);
if (hset === HSSet.max) talComp.updateCur(TriType.MAX);
}
/**********************天赋处理*************************************************************************/
// 根据技能类型执行不同逻辑

View File

@@ -9,6 +9,7 @@ import { BuffConf } from "../common/config/SkillSet";
import { TalAttrs, talConf, TalEffet, TalTarget, TriType} from "../common/config/TalSet";
import { HeroAttrsComp } from "./HeroAttrsComp";
import { HeroViewComp } from "./HeroViewComp";
import { ITalPts } from "../common/config/heroSet";
const { property } = _decorator;
@@ -49,26 +50,13 @@ export class TalComp extends ecs.Comp {
@property({ tooltip: "是否启用调试日志" })
private debugMode: boolean = false;
/** 英雄视图组件引用,运行时获取以避免循环引用 */
private heroView: any = null;
/** 英雄唯一标识符,用于从配置中获取英雄相关信息 */
private heroUuid: number = 0;
/** 天赋集合以天赋ID为键存储所有已获得的天赋 */
Tals: Record<number, TalSlot> = {};
/**
* 组件初始化方法
* @param heroUuid 英雄唯一标识符
*/
TalPts:Record<number,ITalPts> = {};
init(heroUuid: number) {
this.heroUuid = heroUuid;
// 从实体中获取英雄视图组件引用
this.heroView = this.ent.get(HeroViewComp);
// 初始化天赋集合
this.Tals = {};
this.TalPts = {};
// 监听升级事件
oops.message.on(GameEvent.CanUpdateLv, this.onLevelUp, this);
// 监听天赋选择事件
@@ -99,9 +87,7 @@ export class TalComp extends ecs.Comp {
// GameEvent.CanUpdateLv 事件参数 { lv: number }
mLogger.log(this.debugMode, 'TalComp', `[TalComp] 监听到升级事件,当前等级: ${args.lv}`);
// 更新升级类型的天赋进度 (默认每次升级触发一次val=1)
this.updateCur(TriType.LUP, 1);
}
/**
@@ -303,8 +289,6 @@ export class TalComp extends ecs.Comp {
oops.message.off(GameEvent.CanUpdateLv, this.onLevelUp, this);
oops.message.off(GameEvent.UseTalentCard, this.onUseTalentCard, this);
this.Tals = {};
this.heroUuid = 0;
this.heroView = null;
}