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

@@ -24,6 +24,8 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroInfo } from "../common/config/heroSet";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { smc } from "../common/SingletonModuleComp";
import { TalentType } from "../common/config/TalentSet";
import { Hero } from "../hero/Hero";
import { FieldSkillType } from "../common/config/SkillSet";
import { GameEvent } from "../common/config/GameEvent";
@@ -267,7 +269,15 @@ export class HInfoComp extends CCComp {
// 卖出英雄金币收益
const baseSellGold = 1; // 基础卖出金币
const goldBoost = HeroAttrsComp.getFieldSkillTotalValue(FieldSkillType.SellGold);
const totalSellGold = baseSellGold + goldBoost;
let totalSellGold = baseSellGold + goldBoost;
// 应用天赋 SellBonus (增加数值)
const bonusGold = HeroAttrsComp.getTalentValue(TalentType.SellBonus);
if (bonusGold > 0) {
totalSellGold += bonusGold;
}
totalSellGold = Math.floor(totalSellGold);
oops.message.dispatchEvent(GameEvent.CoinAdd, { delta: totalSellGold });
oops.gui.remove(UIID.IBox);