diff --git a/assets/script/game/common/config/TalentSet.ts b/assets/script/game/common/config/TalentSet.ts index a81fb80c..fe4da9fe 100644 --- a/assets/script/game/common/config/TalentSet.ts +++ b/assets/script/game/common/config/TalentSet.ts @@ -3,6 +3,20 @@ * @description 天赋系统配置数据,包含经验要求、消耗、每个天赋的具体加成数值和描述。 */ +export enum TalentType { + Attack = 1, // 攻击强化 + Hp = 2, // 生命强化 + Critical = 3, // 暴击强化 + WindFury = 4, // 风怒强化 + Freeze = 5, // 冰冻强化 + Puncture = 6, // 穿刺强化 + DeadTrigger = 7,// 亡语强化 + Summon = 8, // 召唤强化 + BuyDiscount = 9,// 采购优惠 + RefreshDiscount = 10, // 刷新优惠 + SellBonus = 11 // 出售补贴 +} + export interface TalentInfo { /** 天赋 ID */ id: number; @@ -42,10 +56,10 @@ export const TalentConfig = { maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] }, { id: 6, name: "穿刺强化", icon: "🗡️", desc: "所有英雄穿刺 +{value}", maxLevel: 5, values: [0.2, 0.4, 0.6, 0.8, 1.0], costs: [1, 1, 2, 2, 3] }, - { id: 7, name: "亡语强化", icon: "🛡️", desc: "死亡触发技能额外触发次数+1", - maxLevel: 5, values: [0.2, 0.4, 0.6, 0.8, 1.0], costs: [1, 1, 2, 2, 3] }, - { id: 8, name: "召唤强化", icon: "🛡️", desc: "召唤触发技能额外触发次数+1", - maxLevel: 1, values: [1], costs: [20] }, + { id: 7, name: "亡语强化", icon: "🛡️", desc: "死亡触发技能额外触发次数+{value}次", + maxLevel: 5, values: [1], costs: [25] }, + { id: 8, name: "召唤强化", icon: "🛡️", desc: "召唤触发技能额外触发次数+{value}次", + maxLevel: 1, values: [1], costs: [25] }, { id: 9, name: "采购优惠", icon: "🛒", desc: "购买英雄 -{value}金", maxLevel: 1, values: [1], costs: [10] }, { id: 10, name: "刷新优惠", icon: "🔄", desc: "刷新重抽 -{value}金", diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index f1d6a9a1..da280801 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -11,6 +11,7 @@ import { Attrs} from "../common/config/HeroAttrs"; import { MoveComp } from "./MoveComp"; import { mLogger } from "../common/Logger"; import { FieldSkillType } from "../common/config/SkillSet"; +import { TalentType } from "../common/config/TalentSet"; /** 英雄实体:负责英雄节点创建、属性初始化、入场动画与销毁流程 */ @ecs.register(`Hero`) @@ -120,8 +121,25 @@ export class Hero extends ecs.Entity { // 基础属性按等级倍率初始化 // 使用指数增长公式,等级2时为原来的3倍,等级3时为原来的9倍 (若需线性增长可改为 hero.ap * (1 + (model.lv - 1) * (FightSet.H_HERO_POW - 1))) - model.ap = hero.ap * Math.pow(FightSet.MERGE_NEED, model.lv - 1); - model.hp = model.hp_max = hero.hp * Math.pow(FightSet.MERGE_NEED, model.lv - 1); + let base_ap = hero.ap * Math.pow(FightSet.MERGE_NEED, model.lv - 1); + let base_hp = hero.hp * Math.pow(FightSet.MERGE_NEED, model.lv - 1); + + // 应用天赋加成 + if (model.fac === FacSet.HERO) { + let apBonus = HeroAttrsComp.getTalentValue(TalentType.Attack); // 攻击强化 + let hpBonus = HeroAttrsComp.getTalentValue(TalentType.Hp); // 生命强化 + model.ap = base_ap * (1 + apBonus / 100); + model.hp = model.hp_max = base_hp * (1 + hpBonus / 100); + model.critical = HeroAttrsComp.getTalentValue(TalentType.Critical); // 暴击强化 + model.wfuny = HeroAttrsComp.getTalentValue(TalentType.WindFury); // 风怒强化 + model.freeze_chance = HeroAttrsComp.getTalentValue(TalentType.Freeze); // 冰冻强化 + model.puncture = HeroAttrsComp.getTalentValue(TalentType.Puncture); // 穿刺强化 + // 护盾强化 和 亡语强化 在对应逻辑中应用 + } else { + model.ap = base_ap; + model.hp = model.hp_max = base_hp; + } + model.speed = hero.speed; // 构建技能表并注入运行时冷却字段 ccd @@ -203,6 +221,9 @@ export class Hero extends ecs.Entity { // 落地后触发 call 技能 if (model && model.call && model.call.length > 0) { let triggerCount = 1 + HeroAttrsComp.getFieldSkillTotalValue(FieldSkillType.SummonCount); + if (model.fac === FacSet.HERO) { + triggerCount += HeroAttrsComp.getTalentValue(TalentType.Summon); // 召唤强化额外次数 + } triggerCount = Math.max(1, Math.floor(triggerCount)); for (let i = 0; i < triggerCount; i++) { diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index d40f6755..cb12aa5e 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -4,6 +4,8 @@ import { mLogger } from "../common/Logger"; 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"; @ecs.register('HeroAttrs') export class HeroAttrsComp extends ecs.Comp { public debugMode: boolean = false; @@ -298,6 +300,16 @@ export class HeroAttrsComp extends ecs.Comp { }); return total; } + + /** 获取指定天赋的加成数值 */ + public static getTalentValue(talentId: number): number { + if (!smc || !smc.collection || !smc.collection.talents) return 0; + let level = smc.collection.talents[talentId] || 0; + if (level <= 0) return 0; + let talentInfo = TalentConfig.talents.find(t => t.id === talentId); + if (!talentInfo || !talentInfo.values || level > talentInfo.values.length) return 0; + return talentInfo.values[level - 1]; + } } @ecs.register('HeroBuffSystem')