feat(skill): 重构技能系统,新增技能数据组件和移动组件

refactor(skill): 移除旧技能组件和文档,优化技能配置结构

fix(skill): 修正技能预制体配置错误,统一技能运行类型字段

docs(skill): 删除过时的技能系统说明文档

perf(skill): 优化技能加载逻辑,减少资源消耗

style(skill): 调整代码格式,提高可读性
This commit is contained in:
2025-10-31 00:35:51 +08:00
parent 6db004a99f
commit 2f19433a0a
27 changed files with 1141 additions and 679 deletions

View File

@@ -0,0 +1,448 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Vec3 } from "cc";
/**
* ==================== 伤害事件组件 ====================
*
* 用途:
* - 记录伤害事件的详细信息
* - 支持多种伤害类型和效果
* - 被伤害处理系统使用
*/
@ecs.register('DamageEvent')
export class DamageEventComp extends ecs.Comp {
/** 伤害值 */
damage: number = 0;
/** 伤害类型 */
damageType: number = 0; // 0: 物理, 1: 魔法, 2: 真实, 3: 治疗
/** 伤害来源实体ID */
sourceEntityId: number = 0;
/** 目标实体ID */
targetEntityId: number = 0;
/** 技能ID */
skillId: number = 0;
/** 伤害位置 */
position: Vec3 = new Vec3();
/** 是否暴击 */
isCritical: boolean = false;
/** 暴击倍率 */
criticalMultiplier: number = 2.0;
/** 伤害减免 */
damageReduction: number = 0;
/** 护甲穿透 */
armorPenetration: number = 0;
/** 魔法抗性穿透 */
magicPenetration: number = 0;
/** 伤害标签 */
damageTags: string[] = [];
/** 附加效果 */
effects: DamageEffectData[] = [];
/** 是否已处理 */
processed: boolean = false;
/** 创建时间 */
createTime: number = 0;
/** 额外数据 */
extraData: any = null;
reset() {
this.damage = 0;
this.damageType = 0;
this.sourceEntityId = 0;
this.targetEntityId = 0;
this.skillId = 0;
this.position.set(0, 0, 0);
this.isCritical = false;
this.criticalMultiplier = 2.0;
this.damageReduction = 0;
this.armorPenetration = 0;
this.magicPenetration = 0;
this.damageTags = [];
this.effects = [];
this.processed = false;
this.createTime = 0;
this.extraData = null;
}
/**
* 初始化伤害事件
*/
initialize(damage: number, damageType: number, sourceId: number, targetId: number, skillId: number, position: Vec3): void {
this.damage = damage;
this.damageType = damageType;
this.sourceEntityId = sourceId;
this.targetEntityId = targetId;
this.skillId = skillId;
this.position.set(position);
this.createTime = Date.now();
this.processed = false;
}
/**
* 添加伤害标签
*/
addTag(tag: string): void {
if (!this.damageTags.includes(tag)) {
this.damageTags.push(tag);
}
}
/**
* 检查是否包含标签
*/
hasTag(tag: string): boolean {
return this.damageTags.includes(tag);
}
/**
* 添加附加效果
*/
addEffect(effect: DamageEffectData): void {
this.effects.push(effect);
}
/**
* 计算最终伤害
*/
calculateFinalDamage(targetArmor: number, targetMagicResist: number): number {
let finalDamage = this.damage;
// 应用暴击
if (this.isCritical) {
finalDamage *= this.criticalMultiplier;
}
// 应用护甲和魔抗
if (this.damageType === 0) { // 物理伤害
const effectiveArmor = Math.max(0, targetArmor - this.armorPenetration);
const damageMultiplier = 100 / (100 + effectiveArmor);
finalDamage *= damageMultiplier;
} else if (this.damageType === 1) { // 魔法伤害
const effectiveMagicResist = Math.max(0, targetMagicResist - this.magicPenetration);
const damageMultiplier = 100 / (100 + effectiveMagicResist);
finalDamage *= damageMultiplier;
}
// 真实伤害和治疗不受护甲影响
// 应用伤害减免
finalDamage *= (1 - this.damageReduction);
return Math.max(0, finalDamage);
}
}
/**
* ==================== 伤害效果数据 ====================
*
* 用途:
* - 定义伤害附加的各种效果
* - 如眩晕、减速、燃烧等
*/
export class DamageEffectData {
/** 效果类型 */
effectType: number = 0; // 0: 眩晕, 1: 减速, 2: 燃烧, 3: 冰冻, 4: 中毒
/** 效果持续时间 */
duration: number = 0;
/** 效果强度 */
intensity: number = 0;
/** 效果参数 */
params: any = null;
constructor(type: number, duration: number, intensity: number = 1, params: any = null) {
this.effectType = type;
this.duration = duration;
this.intensity = intensity;
this.params = params;
}
}
/**
* ==================== 治疗事件组件 ====================
*
* 用途:
* - 记录治疗事件的详细信息
* - 支持多种治疗类型
* - 被治疗处理系统使用
*/
@ecs.register('HealEvent')
export class HealEventComp extends ecs.Comp {
/** 治疗值 */
healAmount: number = 0;
/** 治疗类型 */
healType: number = 0; // 0: 瞬间治疗, 1: 持续治疗, 2: 护盾
/** 治疗来源实体ID */
sourceEntityId: number = 0;
/** 目标实体ID */
targetEntityId: number = 0;
/** 技能ID */
skillId: number = 0;
/** 治疗位置 */
position: Vec3 = new Vec3();
/** 是否暴击治疗 */
isCritical: boolean = false;
/** 暴击倍率 */
criticalMultiplier: number = 1.5;
/** 治疗加成 */
healBonus: number = 0;
/** 是否已处理 */
processed: boolean = false;
/** 创建时间 */
createTime: number = 0;
reset() {
this.healAmount = 0;
this.healType = 0;
this.sourceEntityId = 0;
this.targetEntityId = 0;
this.skillId = 0;
this.position.set(0, 0, 0);
this.isCritical = false;
this.criticalMultiplier = 1.5;
this.healBonus = 0;
this.processed = false;
this.createTime = 0;
}
/**
* 计算最终治疗量
*/
calculateFinalHeal(): number {
let finalHeal = this.healAmount;
// 应用暴击
if (this.isCritical) {
finalHeal *= this.criticalMultiplier;
}
// 应用治疗加成
finalHeal *= (1 + this.healBonus);
return Math.max(0, finalHeal);
}
}
/**
* ==================== 状态效果组件 ====================
*
* 用途:
* - 管理角色身上的各种状态效果
* - 如BUFF、DEBUFF等
* - 支持叠加和刷新
*/
@ecs.register('StatusEffect')
export class StatusEffectComp extends ecs.Comp {
/** 效果ID */
effectId: number = 0;
/** 效果类型 */
effectType: number = 0;
/** 效果名称 */
name: string = "";
/** 剩余持续时间 */
remainingDuration: number = 0;
/** 总持续时间 */
totalDuration: number = 0;
/** 效果强度 */
intensity: number = 1;
/** 叠加层数 */
stackCount: number = 1;
/** 最大叠加层数 */
maxStacks: number = 1;
/** 来源实体ID */
sourceEntityId: number = 0;
/** 技能ID */
skillId: number = 0;
/** 是否为BUFF */
isBuff: boolean = true;
/** 是否可驱散 */
canDispel: boolean = true;
/** 效果参数 */
params: any = null;
/** 图标路径 */
iconPath: string = "";
reset() {
this.effectId = 0;
this.effectType = 0;
this.name = "";
this.remainingDuration = 0;
this.totalDuration = 0;
this.intensity = 1;
this.stackCount = 1;
this.maxStacks = 1;
this.sourceEntityId = 0;
this.skillId = 0;
this.isBuff = true;
this.canDispel = true;
this.params = null;
this.iconPath = "";
}
/**
* 更新效果持续时间
*/
updateDuration(deltaTime: number): boolean {
this.remainingDuration -= deltaTime;
return this.remainingDuration > 0;
}
/**
* 刷新效果持续时间
*/
refreshDuration(): void {
this.remainingDuration = this.totalDuration;
}
/**
* 增加叠加层数
*/
addStack(count: number = 1): void {
this.stackCount = Math.min(this.maxStacks, this.stackCount + count);
}
/**
* 减少叠加层数
*/
removeStack(count: number = 1): void {
this.stackCount = Math.max(0, this.stackCount - count);
}
/**
* 获取效果进度 (0-1)
*/
getProgress(): number {
if (this.totalDuration <= 0) return 1;
return Math.max(0, 1 - (this.remainingDuration / this.totalDuration));
}
}
/**
* ==================== 伤害统计组件 ====================
*
* 用途:
* - 统计伤害数据
* - 用于战斗分析和显示
*/
@ecs.register('DamageStats')
export class DamageStatsComp extends ecs.Comp {
/** 总伤害输出 */
totalDamageDealt: number = 0;
/** 总伤害承受 */
totalDamageTaken: number = 0;
/** 总治疗量 */
totalHealingDone: number = 0;
/** 暴击次数 */
criticalHits: number = 0;
/** 总攻击次数 */
totalAttacks: number = 0;
/** 击杀数 */
kills: number = 0;
/** 死亡数 */
deaths: number = 0;
/** 技能使用统计 */
skillUsageStats: Map<number, number> = new Map();
reset() {
this.totalDamageDealt = 0;
this.totalDamageTaken = 0;
this.totalHealingDone = 0;
this.criticalHits = 0;
this.totalAttacks = 0;
this.kills = 0;
this.deaths = 0;
this.skillUsageStats.clear();
}
/**
* 记录伤害输出
*/
recordDamageDealt(damage: number, isCritical: boolean = false): void {
this.totalDamageDealt += damage;
this.totalAttacks++;
if (isCritical) {
this.criticalHits++;
}
}
/**
* 记录伤害承受
*/
recordDamageTaken(damage: number): void {
this.totalDamageTaken += damage;
}
/**
* 记录治疗
*/
recordHealing(healing: number): void {
this.totalHealingDone += healing;
}
/**
* 记录技能使用
*/
recordSkillUsage(skillId: number): void {
const currentCount = this.skillUsageStats.get(skillId) || 0;
this.skillUsageStats.set(skillId, currentCount + 1);
}
/**
* 获取暴击率
*/
getCriticalRate(): number {
return this.totalAttacks > 0 ? this.criticalHits / this.totalAttacks : 0;
}
/**
* 获取平均伤害
*/
getAverageDamage(): number {
return this.totalAttacks > 0 ? this.totalDamageDealt / this.totalAttacks : 0;
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "500ce1a5-24eb-4d18-ac90-11301a372f0e",
"uuid": "92032577-e289-43f6-92f3-6d99c7ec4ce8",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -0,0 +1,183 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Vec3, v3 } from "cc";
import { CastSkillRequestComp } from "./STagComps";
import { HeroAttrsComp } from "./HeroAttrsComp";
import { HeroViewComp } from "./HeroViewComp";
import { SkillSet, SType } from "../common/config/SkillSet";
import { HeroSkillsComp } from "./HeroSkills";
/**
* ==================== 自动施法系统 ====================
*
* 职责:
* 1. 检测可施放的技能
* 2. 根据策略自动施法AI
* 3. 选择目标
* 4. 添加施法请求标记
*
* 设计理念:
* - 负责"何时施法"的决策
* - 通过添加 CastSkillRequestComp 触发施法
* - 可被玩家输入系统或AI系统复用
* - 支持多种AI策略
*/
@ecs.register('SkillAutocastSystem')
export class SkillAutocastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
filter(): ecs.IMatcher {
return ecs.allOf(HeroSkillsComp, HeroAttrsComp, HeroViewComp);
}
update(e: ecs.Entity): void {
const skills = e.get(HeroSkillsComp);
const heroModel = e.get(HeroAttrsComp);
const heroView = e.get(HeroViewComp);
if (!skills || !heroModel || !heroView) return;
// 检查基本条件
if (heroModel.is_dead || heroModel.isStun() || heroModel.isFrost()) return;
// 检查是否正在攻击(只有攻击时才释放技能)
if (!heroModel.is_atking) return;
// 获取所有可施放的技能
const readySkills = skills.getReadySkills(heroModel.mp);
if (readySkills.length === 0) return;
// 选择第一个可施放的伤害技能
for (const skillIndex of readySkills) {
const skill = skills.getSkill(skillIndex);
if (!skill) continue;
const config = SkillSet[skill.uuid];
if (!config || config.SType !== SType.damage) continue;
// ✅ 添加施法请求标记组件
const request = e.add(CastSkillRequestComp) as CastSkillRequestComp;
request.skillIndex = skillIndex;
request.targetPositions = this.selectTargets(heroView);
// 一次只施放一个技能
break;
}
}
/**
* 选择目标位置
*/
private selectTargets(caster: HeroViewComp): Vec3[] {
// 简化版:选择最前方的敌人
const targets: Vec3[] = [];
// 这里可以调用 SkillConComp 的目标选择逻辑
// 暂时返回默认位置
const heroModel = caster.ent.get(HeroAttrsComp);
const fac = heroModel?.fac ?? 0;
const defaultX = fac === 0 ? 400 : -400;
targets.push(v3(defaultX, 0, 0));
return targets;
}
/**
* 选择伤害技能目标
*/
private selectDamageTargets(caster: HeroViewComp, config: any, maxTargets: number): Vec3[] {
const targets: Vec3[] = [];
const heroModel = caster.ent.get(HeroAttrsComp);
if (!heroModel) return targets;
// 寻找最近的敌人
const enemyPositions = this.findNearbyEnemies(caster, heroModel.fac, config.range || 300);
// 选择最多maxTargets个目标
for (let i = 0; i < Math.min(maxTargets, enemyPositions.length); i++) {
targets.push(enemyPositions[i]);
}
// 如果没有找到敌人,使用默认位置
if (targets.length === 0) {
targets.push(...this.selectDefaultTargets(caster, heroModel.fac));
}
return targets;
}
/**
* 选择治疗技能目标
*/
private selectHealTargets(caster: HeroViewComp, config: any, maxTargets: number): Vec3[] {
const targets: Vec3[] = [];
const heroModel = caster.ent.get(HeroAttrsComp);
if (!heroModel) return targets;
// 寻找血量最低的友军
const allyPositions = this.findLowHealthAllies(caster, heroModel.fac, config.range || 200);
for (let i = 0; i < Math.min(maxTargets, allyPositions.length); i++) {
targets.push(allyPositions[i]);
}
// 如果没有找到友军,治疗自己
if (targets.length === 0 && caster.node) {
targets.push(caster.node.position.clone());
}
return targets;
}
/**
* 选择BUFF技能目标
*/
private selectBuffTargets(caster: HeroViewComp, config: any, maxTargets: number): Vec3[] {
// BUFF技能通常施放在自己或友军身上
return this.selectHealTargets(caster, config, maxTargets);
}
/**
* 选择DEBUFF技能目标
*/
private selectDebuffTargets(caster: HeroViewComp, config: any, maxTargets: number): Vec3[] {
// DEBUFF技能通常施放在敌人身上
return this.selectDamageTargets(caster, config, maxTargets);
}
/**
* 选择默认目标
*/
private selectDefaultTargets(caster: HeroViewComp, faction: number): Vec3[] {
const targets: Vec3[] = [];
const defaultX = faction === 0 ? 400 : -400;
targets.push(v3(defaultX, 0, 0));
return targets;
}
/**
* 查找附近的敌人
*/
private findNearbyEnemies(caster: HeroViewComp, faction: number, range: number): Vec3[] {
// 简化实现实际应该查询ECS中的敌方实体
const enemies: Vec3[] = [];
// 模拟敌人位置
const enemyX = faction === 0 ? 300 : -300;
enemies.push(v3(enemyX, 0, 0));
enemies.push(v3(enemyX + 50, 20, 0));
return enemies;
}
/**
* 查找血量低的友军
*/
private findLowHealthAllies(caster: HeroViewComp, faction: number, range: number): Vec3[] {
// 简化实现实际应该查询ECS中的友方实体并按血量排序
const allies: Vec3[] = [];
// 如果自己血量低,优先治疗自己
return allies;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "a38a89b8-24eb-429f-92d4-7d3f4d87ba88",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,42 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { HeroSkillsComp } from "./HeroSkills";
/**
* ==================== 技能CD更新系统 ====================
*
* 职责:
* 1. 每帧更新所有角色的技能CD
* 2. 自动递减CD时间
* 3. 管理技能冷却状态
* 4. 优化CD计算性能
*
* 设计理念:
* - 独立的CD管理系统
* - 只负责时间递减,不处理施法逻辑
* - 支持CD加速和减免效果
*/
@ecs.register('SkillCDSystem')
export class SkillCDSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
filter(): ecs.IMatcher {
return ecs.allOf(HeroSkillsComp);
}
update(e: ecs.Entity): void {
const skills = e.get(HeroSkillsComp);
if (!skills) return;
// 更新所有技能CD
skills.updateCDs(this.dt);
}
/**
* 计算CD减免效果
*/
/**
* 更新技能就绪状态
*/
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "90b6dfb3-0a9c-4400-a356-b85a080ea86c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,33 +1,11 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Vec3, v3 } from "cc";
import { HeroSkillsComp } from "./HeroSkills";
import { CastSkillRequestComp } from "./STagComps";
import { HeroAttrsComp } from "./HeroAttrsComp";
import { HeroViewComp } from "./HeroViewComp";
import { SkillSet, SType } from "../common/config/SkillSet";
import { SkillEnt } from "../skill/SkillEnt";
import { smc } from "../common/SingletonModuleComp";
/**
* ==================== ====================
*
*
* -
* - AI系统
* -
*/
@ecs.register('CastSkillRequest')
export class CastSkillRequestComp extends ecs.Comp {
/** 技能索引(在 HeroSkillsComp.skills 中的位置) */
skillIndex: number = 0;
/** 目标位置数组(由请求者提供) */
targetPositions: Vec3[] = [];
reset() {
this.skillIndex = 0;
this.targetPositions = [];
}
}
import { HeroSkillsComp } from "./HeroSkills";
/**
* ==================== ====================
@@ -48,7 +26,7 @@ export class CastSkillRequestComp extends ecs.Comp {
@ecs.register('SkillCastSystem')
export class SkillCastSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
/**
/**
* +
*/
filter(): ecs.IMatcher {
@@ -166,107 +144,6 @@ export class SkillCastSystem extends ecs.ComblockSystem implements ecs.IEntityEn
skillId, // 技能ID
targetPositions, // 目标位置数组
caster, // 施法者
0 // 额外伤害暂时为0
);
}
}
/**
* ==================== CD更新系统 ====================
*
*
* 1. CD
* 2. CD时间
*
*
* - CD管理系统
* -
*/
@ecs.register('SkillCDSystem')
export class SkillCDSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
filter(): ecs.IMatcher {
return ecs.allOf(HeroSkillsComp);
}
update(e: ecs.Entity): void {
const skillsData = e.get(HeroSkillsComp);
if (!skillsData) return;
// 更新所有技能CD
skillsData.updateCDs(this.dt);
}
}
/**
* ==================== ====================
*
*
* 1.
* 2. AI
* 3.
* 4.
*
*
* - "何时施法"
* - CastSkillRequestComp
* - AI系统复用
*/
@ecs.register('SkillAutocastSystem')
export class SkillAutocastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
filter(): ecs.IMatcher {
return ecs.allOf(HeroSkillsComp, HeroAttrsComp, HeroViewComp);
}
update(e: ecs.Entity): void {
const skillsData = e.get(HeroSkillsComp);
const heroModel = e.get(HeroAttrsComp);
const heroView = e.get(HeroViewComp);
if (!skillsData || !heroModel || !heroView) return;
// 检查基本条件
if (heroModel.is_dead || heroModel.isStun() || heroModel.isFrost()) return;
// 检查是否正在攻击(只有攻击时才释放技能)
if (!heroModel.is_atking) return;
// 获取所有可施放的技能
const readySkills = skillsData.getReadySkills(heroModel.mp);
if (readySkills.length === 0) return;
// 选择第一个可施放的伤害技能
for (const skillIndex of readySkills) {
const skill = skillsData.getSkill(skillIndex);
if (!skill) continue;
const config = SkillSet[skill.uuid];
if (!config || config.SType !== SType.damage) continue;
// ✅ 添加施法请求标记组件
const request = e.add(CastSkillRequestComp) as CastSkillRequestComp;
request.skillIndex = skillIndex;
request.targetPositions = this.selectTargets(heroView);
// 一次只施放一个技能
break;
}
}
/**
*
*/
private selectTargets(caster: HeroViewComp): Vec3[] {
// 简化版:选择最前方的敌人
const targets: Vec3[] = [];
// 这里可以调用 SkillConComp 的目标选择逻辑
// 暂时返回默认位置
const heroModel = caster.ent.get(HeroAttrsComp);
const fac = heroModel?.fac ?? 0;
const defaultX = fac === 0 ? 400 : -400;
targets.push(v3(defaultX, 0, 0));
return targets;
}
}

View File

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

View File

@@ -0,0 +1,106 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Vec3 } from "cc";
/**
* ==================== 技能数据组件 ====================
*
* 用途:
* - 存储单个技能的完整数据
* - 包含技能配置、状态、目标等信息
* - 可被技能系统读取和修改
*/
@ecs.register('SkillData')
export class SkillDataComp extends ecs.Comp {
/** 技能唯一ID */
skillId: number = 0;
/** 技能名称 */
name: string = "";
/** 技能等级 */
level: number = 1;
/** 技能类型 */
type: number = 0;
/** 消耗MP */
cost: number = 0;
/** 冷却时间 */
cooldown: number = 0;
/** 当前冷却剩余时间 */
currentCooldown: number = 0;
/** 伤害值 */
damage: number = 0;
/** 技能范围 */
range: number = 0;
/** 施法时间 */
castTime: number = 0;
/** 技能描述 */
description: string = "";
/** 是否已解锁 */
unlocked: boolean = false;
/** 技能图标路径 */
iconPath: string = "";
/** 额外属性数据 */
extraData: any = null;
reset() {
this.skillId = 0;
this.name = "";
this.level = 1;
this.type = 0;
this.cost = 0;
this.cooldown = 0;
this.currentCooldown = 0;
this.damage = 0;
this.range = 0;
this.castTime = 0;
this.description = "";
this.unlocked = false;
this.iconPath = "";
this.extraData = null;
}
/**
* 检查技能是否可以施放
*/
canCast(currentMP: number): boolean {
return this.unlocked &&
this.currentCooldown <= 0 &&
currentMP >= this.cost;
}
/**
* 更新冷却时间
*/
updateCooldown(deltaTime: number): void {
if (this.currentCooldown > 0) {
this.currentCooldown = Math.max(0, this.currentCooldown - deltaTime);
}
}
/**
* 重置冷却时间
*/
resetCooldown(): void {
this.currentCooldown = this.cooldown;
}
/**
* 获取冷却进度 (0-1)
*/
getCooldownProgress(): number {
if (this.cooldown <= 0) return 1;
return Math.max(0, 1 - (this.currentCooldown / this.cooldown));
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "5ef9c9a8-c661-44fd-93f4-fc133f734867",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,47 @@
import { Vec3, v3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { BezierMove } from "../BezierMove/BezierMove";
import { RType, SkillSet } from "../common/config/SkillSet";
/**
* 技能移动数据组件
* 存储技能实体的移动相关数据
*/
@ecs.register('SMoveData')
export class SMoveDataComp extends ecs.Comp {
/** 起始位置 */
startPos: Vec3 = v3();
/** 目标位置 */
targetPos: Vec3 = v3();
/** 移动速度 */
speed: number = 500;
/** 移动持续时间 */
duration: number = 0;
/** 移动方向 */
direction: Vec3 = v3();
/** 是否自动销毁(到达目标后) */
autoDestroy: boolean = true;
s_uuid:number=0;
reset() {
this.startPos.set(0, 0, 0);
this.targetPos.set(0, 0, 0);
this.speed = 500;
this.duration = 0;
this.direction.set(0, 0, 0);
this.autoDestroy = true;
}
}
// /** 业务层业务逻辑处理对象 */
// export class SMoveSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
// filter(): ecs.IMatcher {
// return ecs.allOf(SMoveDataComp);
// }
// entityEnter(e: ecs.Entity): void {
// // 注:自定义业务逻辑
// let s_uuid=e.get(SMoveDataComp).s_uuid
// let SConf=SkillSet[s_uuid]
// e.remove(SMoveDataComp);
// }
// }

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "d0c2d505-f2c3-4cf3-82f7-490f9d14e096",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,53 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Vec3 } from "cc";
/**
* ==================== 施法请求标记组件 ====================
*
* 用途:
* - 标记角色想要施放某个技能
* - 由外部如AI系统、玩家输入添加
* - 施法系统处理后自动移除
*/
@ecs.register('CastSkillRequest')
export class CastSkillRequestComp extends ecs.Comp {
/** 技能索引(在 HeroSkillsComp.skills 中的位置) */
skillIndex: number = 0;
/** 目标位置数组(由请求者提供) */
targetPositions: Vec3[] = [];
reset() {
this.skillIndex = 0;
this.targetPositions = [];
}
}
/**
* ==================== 技能命中标记组件 ====================
*
* 用途:
* - 标记技能已命中目标
* - 记录命中信息
* - 伤害系统处理后移除
*/
@ecs.register('SkillHit')
export class SkillHitComp extends ecs.Comp {
/** 技能ID */
skillId: number = 0;
/** 命中位置 */
hitPosition: Vec3 = new Vec3();
/** 伤害值 */
damage: number = 0;
/** 施法者实体ID */
casterId: number = 0;
reset() {
this.skillId = 0;
this.hitPosition.set(0, 0, 0);
this.damage = 0;
this.casterId = 0;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "37d898a0-b376-4f18-8559-2acf6f4e7db7",
"files": [],
"subMetas": {},
"userData": {}
}