feat(天赋系统): 实现天赋效果并应用至相关游戏系统

- 在 MissionCardComp 中应用 RefreshDiscount 天赋以减少刷新消耗
- 在 CardComp 中应用 BuyDiscount 天赋以减少英雄购买消耗
- 在 HInfoComp 中应用 SellBonus 天赋以增加英雄出售收益
- 统一 TalentType 枚举类型,增强类型安全性
- 更新 SingletonModuleComp 中 talents 数据结构以支持类型化
- 修改 HeroAttrsComp.getTalentValue 方法参数类型为 TalentType
This commit is contained in:
panw
2026-04-28 15:34:58 +08:00
parent 1a45c87e70
commit 95ea36651e
7 changed files with 52 additions and 26 deletions

View File

@@ -5,7 +5,7 @@ import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { FacSet, FightSet } from "../common/config/GameSet";
import { FieldSkillSet, FieldSkillType } from "../common/config/SkillSet";
import { smc } from "../common/SingletonModuleComp";
import { TalentConfig } from "../common/config/TalentSet";
import { TalentConfig, TalentType } from "../common/config/TalentSet";
@ecs.register('HeroAttrs')
export class HeroAttrsComp extends ecs.Comp {
public debugMode: boolean = false;
@@ -302,7 +302,7 @@ export class HeroAttrsComp extends ecs.Comp {
}
/** 获取指定天赋的加成数值 */
public static getTalentValue(talentId: number): number {
public static getTalentValue(talentId: TalentType): number {
if (!smc || !smc.collection || !smc.collection.talents) return 0;
let level = smc.collection.talents[talentId] || 0;
if (level <= 0) return 0;