feat(英雄系统): 优化天赋触发机制和技能施放逻辑
重构HeroAttrsComp组件结构,新增天赋触发相关属性 调整SACastSystem技能施放逻辑,支持风怒和双施天赋效果 删除无用的SCastSystem.ts.meta文件
This commit is contained in:
@@ -5,7 +5,10 @@ import { HeroInfo, AttrSet } from "../common/config/heroSet";
|
|||||||
import { HeroSkillsComp } from "./HeroSkills";
|
import { HeroSkillsComp } from "./HeroSkills";
|
||||||
import { talConf, TalAttrs } from "../common/config/TalSet";
|
import { talConf, TalAttrs } from "../common/config/TalSet";
|
||||||
|
|
||||||
|
interface talTrigger{
|
||||||
|
isTrigger:boolean
|
||||||
|
count:number
|
||||||
|
}
|
||||||
@ecs.register('HeroAttrs')
|
@ecs.register('HeroAttrs')
|
||||||
export class HeroAttrsComp extends ecs.Comp {
|
export class HeroAttrsComp extends ecs.Comp {
|
||||||
Ebus:any=null!
|
Ebus:any=null!
|
||||||
@@ -32,6 +35,11 @@ export class HeroAttrsComp extends ecs.Comp {
|
|||||||
shield: number = 0; // 当前护盾
|
shield: number = 0; // 当前护盾
|
||||||
Attrs: any = []; // 最终属性数组(经过Buff计算后)
|
Attrs: any = []; // 最终属性数组(经过Buff计算后)
|
||||||
NeAttrs: any = []; // 负面状态数组
|
NeAttrs: any = []; // 负面状态数组
|
||||||
|
//=====================天赋触发标签=====================
|
||||||
|
isDSill:number
|
||||||
|
isWFuny:number
|
||||||
|
/** 天赋buff数组 - 触发过期,数量可叠加 */
|
||||||
|
BUFFS_TAL: Record<number, Array<{tal:number,value: number, BType: BType,count:number}>> = {};
|
||||||
|
|
||||||
// ==================== 技能距离缓存 ====================
|
// ==================== 技能距离缓存 ====================
|
||||||
maxSkillDistance: number = 0; // 最远技能攻击距离(缓存,受MP影响)
|
maxSkillDistance: number = 0; // 最远技能攻击距离(缓存,受MP影响)
|
||||||
@@ -43,8 +51,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
|||||||
|
|
||||||
/** 临时型buff数组 - 按时间自动过期 */
|
/** 临时型buff数组 - 按时间自动过期 */
|
||||||
BUFFS_TEMP: Record<number, Array<{value: number, BType: BType, remainTime: number}>> = {};
|
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;
|
is_dead: boolean = false;
|
||||||
|
|||||||
@@ -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 {
|
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];
|
const config = SkillSet[s_uuid];
|
||||||
if (!config) {
|
if (!config) {
|
||||||
console.error("[SACastSystem] 技能配置不存在:", s_uuid);
|
console.error("[SACastSystem] 技能配置不存在:", s_uuid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 播放施法动画
|
// 1. 播放施法动画
|
||||||
heroView.playSkillEffect(s_uuid);
|
heroView.playSkillEffect(s_uuid);
|
||||||
let isDSill=false
|
|
||||||
let isWFuny=false
|
|
||||||
// 2. 更新攻击类型的天赋触发值
|
// 2. 更新攻击类型的天赋触发值
|
||||||
if(casterEntity.has(TalComp)){
|
if(casterEntity.has(TalComp)){
|
||||||
const talComp = casterEntity.get(TalComp);
|
const talComp = casterEntity.get(TalComp);
|
||||||
if (hset === HSSet.atk) talComp.updateCur(TriType.ATK);
|
if (hset === HSSet.atk) talComp.updateCur(TriType.ATK);
|
||||||
if (hset != HSSet.atk) talComp.updateCur(TriType.SKILL);
|
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. 延迟创建技能实体(等待动画)
|
// 2. 延迟创建技能实体(等待动画)
|
||||||
const delay = 0.3
|
const delay = 0.3
|
||||||
heroView.scheduleOnce(() => {
|
heroView.scheduleOnce(() => {
|
||||||
this.createSkill(s_uuid, heroView,isWFuny);
|
//风怒wfuny 只针对 普通攻击起效
|
||||||
isWFuny=false
|
if (hset === HSSet.atk&&isWFuny){
|
||||||
|
this.createSkill(s_uuid, heroView,targets,isWFuny);
|
||||||
|
heroAttrs.isWFuny --
|
||||||
|
}else{
|
||||||
|
this.createSkill(s_uuid, heroView,targets,false);
|
||||||
|
}
|
||||||
|
|
||||||
}, delay);
|
}, delay);
|
||||||
|
|
||||||
if(isDSill){
|
if(isDSill){
|
||||||
|
targets = this.sTargets(heroView);
|
||||||
|
if (targets.length === 0) {
|
||||||
|
console.warn("[SACastSystem] 没有找到有效目标");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
heroAttrs.isDSill --
|
||||||
heroView.playSkillEffect(s_uuid);
|
heroView.playSkillEffect(s_uuid);
|
||||||
heroView.scheduleOnce(() => {
|
heroView.scheduleOnce(() => {
|
||||||
this.createSkill(s_uuid, heroView,isWFuny);
|
this.createSkill(s_uuid, heroView,targets,isWFuny);
|
||||||
isWFuny=false
|
isWFuny=false
|
||||||
}, delay);
|
}, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
const heroAttrs = casterEntity.get(HeroAttrsComp);
|
|
||||||
// console.log(`[SACastSystem] ${heroAttrs?.hero_name ?? '未知'} 施放技能: ${config.name}`);
|
|
||||||
return true;
|
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) {
|
if (!caster.node || !caster.node.isValid) {
|
||||||
console.warn("[SACastSystem] 施法者节点无效");
|
console.warn("[SACastSystem] 施法者节点无效");
|
||||||
@@ -190,12 +206,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取目标位置
|
|
||||||
const targets = this.sTargets(caster);
|
|
||||||
if (targets.length === 0) {
|
|
||||||
console.warn("[SACastSystem] 没有找到有效目标");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建技能实体
|
// 创建技能实体
|
||||||
const skill = ecs.getEntity<Skill>(Skill);
|
const skill = ecs.getEntity<Skill>(Skill);
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.24",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "25f14ca0-5053-495e-bc3d-08b1bb4ee5d7",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user