feat(英雄系统): 优化天赋触发机制和技能施放逻辑

重构HeroAttrsComp组件结构,新增天赋触发相关属性
调整SACastSystem技能施放逻辑,支持风怒和双施天赋效果
删除无用的SCastSystem.ts.meta文件
This commit is contained in:
2025-11-19 11:18:11 +08:00
parent 9f809b1ffa
commit 78ac2e949f
3 changed files with 39 additions and 30 deletions

View File

@@ -5,7 +5,10 @@ import { HeroInfo, AttrSet } from "../common/config/heroSet";
import { HeroSkillsComp } from "./HeroSkills";
import { talConf, TalAttrs } from "../common/config/TalSet";
interface talTrigger{
isTrigger:boolean
count:number
}
@ecs.register('HeroAttrs')
export class HeroAttrsComp extends ecs.Comp {
Ebus:any=null!
@@ -32,6 +35,11 @@ export class HeroAttrsComp extends ecs.Comp {
shield: number = 0; // 当前护盾
Attrs: any = []; // 最终属性数组经过Buff计算后
NeAttrs: any = []; // 负面状态数组
//=====================天赋触发标签=====================
isDSill:number
isWFuny:number
/** 天赋buff数组 - 触发过期,数量可叠加 */
BUFFS_TAL: Record<number, Array<{tal:number,value: number, BType: BType,count:number}>> = {};
// ==================== 技能距离缓存 ====================
maxSkillDistance: number = 0; // 最远技能攻击距离缓存受MP影响
@@ -43,8 +51,7 @@ export class HeroAttrsComp extends ecs.Comp {
/** 临时型buff数组 - 按时间自动过期 */
BUFFS_TEMP: Record<number, Array<{value: number, BType: BType, remainTime: number}>> = {};
/** 天赋buff数组 - 触发过期,数量可叠加 */
BUFFS_TAL: Record<number, Array<{tal:number,value: number, BType: BType,count:number}>> = {};
// ==================== 标记状态 ====================
is_dead: boolean = false;

View File

@@ -132,43 +132,59 @@ 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
const config = SkillSet[s_uuid];
if (!config) {
console.error("[SACastSystem] 技能配置不存在:", s_uuid);
return false;
}
// 1. 播放施法动画
heroView.playSkillEffect(s_uuid);
let isDSill=false
let isWFuny=false
// 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);
isDSill=talComp.checkIsTrigger().isDSill
isWFuny=talComp.checkIsTrigger().isWFuny
}
// 获取目标位置
let targets = this.sTargets(heroView);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
return false;
}
// 2. 延迟创建技能实体(等待动画)
const delay = 0.3
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,isWFuny);
isWFuny=false
//风怒wfuny 只针对 普通攻击起效
if (hset === HSSet.atk&&isWFuny){
this.createSkill(s_uuid, heroView,targets,isWFuny);
heroAttrs.isWFuny --
}else{
this.createSkill(s_uuid, heroView,targets,false);
}
}, delay);
if(isDSill){
targets = this.sTargets(heroView);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
return false;
}
heroAttrs.isDSill --
heroView.playSkillEffect(s_uuid);
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,isWFuny);
this.createSkill(s_uuid, heroView,targets,isWFuny);
isWFuny=false
}, delay);
}
const heroAttrs = casterEntity.get(HeroAttrsComp);
// console.log(`[SACastSystem] ${heroAttrs?.hero_name ?? '未知'} 施放技能: ${config.name}`);
return true;
}
@@ -176,7 +192,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
/**
* 创建技能实体
*/
private createSkill(s_uuid: number, caster: HeroViewComp,isWFuny:boolean) {
private createSkill(s_uuid: number, caster: HeroViewComp,targets,isWFuny:boolean) {
// 检查节点有效性
if (!caster.node || !caster.node.isValid) {
console.warn("[SACastSystem] 施法者节点无效");
@@ -190,12 +206,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
return;
}
// 获取目标位置
const targets = this.sTargets(caster);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
return;
}
// 创建技能实体
const skill = ecs.getEntity<Skill>(Skill);

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "25f14ca0-5053-495e-bc3d-08b1bb4ee5d7",
"files": [],
"subMetas": {},
"userData": {}
}