diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index fe7dd1b0..0cd83b55 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -6,7 +6,7 @@ import { HeroSkillsComp } from "./HeroSkills"; import { talConf, TalAttrs } from "../common/config/TalSet"; interface talTrigger{ - isTrigger:boolean + value:boolean count:number } @ecs.register('HeroAttrs') @@ -36,8 +36,8 @@ export class HeroAttrsComp extends ecs.Comp { Attrs: any = []; // 最终属性数组(经过Buff计算后) NeAttrs: any = []; // 负面状态数组 //=====================天赋触发标签===================== - isDSill:number - isWFuny:number + tal_DSill:talTrigger={value:false,count:0} + tal_WFuny:talTrigger={value:false,count:0} /** 天赋buff数组 - 触发过期,数量可叠加 */ BUFFS_TAL: Record> = {}; diff --git a/assets/script/game/hero/SACastSystem.ts b/assets/script/game/hero/SACastSystem.ts index 86c5d4ba..6c2ff11b 100644 --- a/assets/script/game/hero/SACastSystem.ts +++ b/assets/script/game/hero/SACastSystem.ts @@ -77,13 +77,13 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat if (!this.checkCastConditions(skills, heroAttrs, skill.s_uuid)) return false // 4. 执行施法 - const ok = this.executeCast(e, skill.s_uuid, heroView,hset); + const castSucess = this.executeCast(e, skill.s_uuid, heroView,hset); // 5. 扣除资源和重置CD - if (ok) { + if (castSucess) { heroAttrs.mp -= skill.cost; skills.resetCD(skill.s_uuid); } - return ok; + return castSucess; } public manualCast(e: ecs.Entity, s_uuid: number): boolean { if (!e) return false @@ -134,8 +134,8 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat */ private executeCast(casterEntity: ecs.Entity, s_uuid: number, heroView: HeroViewComp,hset:HSSet): boolean { const heroAttrs=casterEntity.get(HeroAttrsComp) - let isDSill=heroAttrs.isDSill > 0 - let isWFuny=heroAttrs.isWFuny > 0 + let isDSill=heroAttrs.tal_DSill.count > 0 + let isWFuny=heroAttrs.tal_WFuny.count > 0 const config = SkillSet[s_uuid]; if (!config) { console.error("[SACastSystem] 技能配置不存在:", s_uuid); @@ -144,14 +144,14 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat // 1. 播放施法动画 heroView.playSkillEffect(s_uuid); +/**********************天赋处理*************************************************************************/ // 2. 更新攻击类型的天赋触发值 if(casterEntity.has(TalComp)){ const talComp = casterEntity.get(TalComp); if (hset === HSSet.atk) talComp.updateCur(TriType.ATK); if (hset != HSSet.atk) talComp.updateCur(TriType.SKILL); - - } +/**********************天赋处理*************************************************************************/ // 获取目标位置 let targets = this.sTargets(heroView, s_uuid); if (targets.length === 0) { @@ -161,28 +161,29 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat // 2. 延迟创建技能实体(等待动画) const delay = 0.3 heroView.scheduleOnce(() => { - //风怒wfuny 只针对 普通攻击起效 - if (hset === HSSet.atk&&isWFuny){ - this.createSkill(s_uuid, heroView,targets,isWFuny); - heroAttrs.isWFuny -- - }else{ - this.createSkill(s_uuid, heroView,targets,false); - } - + this.createSkill(s_uuid, heroView,targets); }, delay); - if(isDSill){ + //风怒wfuny 只针对 普通攻击起效 + if (hset === HSSet.atk&&isWFuny){ + heroView.playSkillEffect(s_uuid); + //需要再添加 风怒动画 + this.createSkill(s_uuid, heroView,targets); + heroAttrs.tal_WFuny.count -- + } + // 双技能 只针对 技能起效 + if(hset === HSSet.skill&&isDSill){ targets = this.sTargets(heroView, s_uuid); if (targets.length === 0) { console.warn("[SACastSystem] 没有找到有效目标"); return false; } - heroAttrs.isDSill -- heroView.playSkillEffect(s_uuid); + //需要再添加 双技能动画 heroView.scheduleOnce(() => { - this.createSkill(s_uuid, heroView,targets,isWFuny); - isWFuny=false + this.createSkill(s_uuid, heroView,targets); }, delay); + heroAttrs.tal_DSill.count -- } @@ -193,7 +194,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat /** * 创建技能实体 */ - private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],isWFuny:boolean=false) { + private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],damage:number=0) { // 检查节点有效性 if (!caster.node || !caster.node.isValid) { console.warn("[SACastSystem] 施法者节点无效"); @@ -218,7 +219,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat const targetPos = targets[0]; // 使用第一个目标位置 // console.log(`[SACastSystem]: ${s_uuid}, 起始位置: ${startPos}, 目标位置: ${targetPos}`); // 加载技能实体(包括预制体、组件初始化等) - skill.load(startPos, parent, s_uuid, targetPos, caster); + skill.load(startPos, parent, s_uuid, targetPos, caster,damage); } diff --git a/assets/script/game/hero/TalComp.ts b/assets/script/game/hero/TalComp.ts index 7a369805..8b9b4650 100644 --- a/assets/script/game/hero/TalComp.ts +++ b/assets/script/game/hero/TalComp.ts @@ -96,39 +96,6 @@ export class TalComp extends ecs.Comp { checkTal() { return Object.keys(this.Tals).length > 0; } - /** - * 检查并触发指定类型的天赋 - * @param triType 要检查的天赋触发类型 - * @returns 触发的天赋对象集合,若没有触发则返回false - * - * 检查逻辑: - * 1. 遍历所有同类型天赋 - * 2. 检查累积值是否达到触发条件 - * 3. 触发后重置累积值 - * 4. 收集并返回所有触发的天赋 - */ - checkTriggers(effet: TalEffet) { - // 存储所有触发的天赋 - let Triggers: Record = {}; - // 遍历所有天赋 - for (let uuid in this.Tals) { - const talent = this.Tals[uuid]; - // 匹配天赋类型 - if (talent.effet == effet) { - // 修复触发条件逻辑:累积值达到或超过触发阈值时触发 - // 原逻辑中 `talent.Trigger-talent.Trigger` 总是为0,导致任何累积值都能触发 - if (talent.cur >= (talent.Trigger - talent.Trigger_add)) { // 修复触发条件,累积值达到或超过触发阈值时触发 - console.log(`[TalComp]天赋触发,天赋ID:${uuid}`); - // 重置累积值 - talent.cur = 0; - // 添加到触发列表 - Triggers[uuid] = talent; - } - } - } - // 判断是否有天赋被触发 - return Triggers; - } getTriggers() { // 存储所有触发的天赋 let Triggers: Record = {}; @@ -146,19 +113,7 @@ export class TalComp extends ecs.Comp { // 判断是否有天赋被触发 return Triggers; } - checkIsTrigger() { - let res = { - isDSill:false, - isWFuny:false, - } - for(let uuid in this.Tals){ - let trigger=this.Tals[uuid] - if(trigger.effet==TalEffet.WFUNY) res.isWFuny=true - if(trigger.effet==TalEffet.D_SKILL) res.isDSill=true - - } - return res - } + /** * 更新天赋的效果数值 * @param talUuid 天赋ID diff --git a/assets/script/game/skill/Skill.ts b/assets/script/game/skill/Skill.ts index 68a959da..88571fc7 100644 --- a/assets/script/game/skill/Skill.ts +++ b/assets/script/game/skill/Skill.ts @@ -29,7 +29,7 @@ export class Skill extends ecs.Entity { this.addComponents(SMoveDataComp); } load(startPos: Vec3, parent: Node, s_uuid: number, targetPos: Vec3, - caster:HeroViewComp) { + caster:HeroViewComp,damage:number=0) { const config = SkillSet[s_uuid]; if (!config) {