feat(技能系统): 实现技能冷却时间受攻击速度和技能速度属性影响
新增技能速度(SS)属性,用于减少非基础攻击技能的冷却时间 基础攻击技能冷却时间由英雄的as属性决定 眩晕和冰冻状态下不更新技能CD 合并冗余的canCast和resetCD方法
This commit is contained in:
@@ -50,10 +50,11 @@ export enum Attrs {
|
||||
AP = 10, // 攻击力
|
||||
MAP = 11, // 魔法攻击力
|
||||
DIS = 12, // 攻击距离
|
||||
AS = 13, // 攻击速度(减少技能CD)
|
||||
SKILL_DURATION = 14, // 技能持续时间
|
||||
AREA_OF_EFFECT = 15, // 作用范围
|
||||
PIERCE = 16, // 穿透次数
|
||||
AS = 13, // 攻击速度(减少技能skills[0]CD)
|
||||
SS = 14, // 技能速度 (减少skills[0] 以外的cd)
|
||||
SKILL_DURATION = 15, // 技能持续时间
|
||||
AREA_OF_EFFECT = 16, // 作用范围
|
||||
PIERCE = 17, // 穿透次数
|
||||
|
||||
// ========== 防御属性 (20-29) ==========
|
||||
DEF = 20, // 物理防御
|
||||
@@ -163,6 +164,7 @@ export const AttrsType: Record<Attrs, BType> = {
|
||||
[Attrs.MAP]: BType.VALUE, // 魔法攻击力 - 数值型
|
||||
[Attrs.DIS]: BType.VALUE, // 攻击距离 - 数值型
|
||||
[Attrs.AS]: BType.RATIO, // 攻击速度 - 百分比型
|
||||
[Attrs.SS]: BType.RATIO, // 技能速度 - 百分比型
|
||||
[Attrs.SKILL_DURATION]: BType.RATIO, // 技能持续时间 - 百分比型
|
||||
[Attrs.AREA_OF_EFFECT]: BType.VALUE, // 作用范围 - 数值型
|
||||
[Attrs.PIERCE]: BType.VALUE, // 穿透次数 - 数值型
|
||||
|
||||
@@ -144,7 +144,7 @@ interface IEndAnm {
|
||||
// 技能配置接口 - 按照6001格式排列
|
||||
export interface SkillConfig {
|
||||
uuid:number,name:string,sp_name:string,icon:string,TGroup:TGroup,SType:SType,act:string,DTType:DTType,DType:DType,
|
||||
ap:number,cd:number,t_num:number,hit_num:number,hit:number,hitcd:number,speed:number,cost:number,with:number,ready:number,EAnm:number,DAnm:number,RType:RType,EType:EType,
|
||||
ap:number,cd:number,t_num:number,hit_num:number,hit:number,hitcd:number,speed:number,cost:number,with:number,dis:Number,ready:number,EAnm:number,DAnm:number,RType:RType,EType:EType,
|
||||
buffs:BuffConf[],neAttrs:NeAttrsConf[],info:string,hero?:number ,
|
||||
}
|
||||
|
||||
@@ -152,17 +152,17 @@ export const SkillSet: Record<number, SkillConfig> = {
|
||||
// ========== 基础攻击 ========== 6001-6099
|
||||
6001: {
|
||||
uuid:6001,name:"挥击",sp_name:"atk_s1",icon:"3036",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,DType:DType.ATK,
|
||||
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,cost:0,with:0,ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,cost:0,with:0,dis:80,ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
buffs:[],neAttrs:[],info:"向最前方敌人扔出石斧,造成100%攻击的伤害",
|
||||
},
|
||||
6002: {
|
||||
uuid:6002,name:"挥砍",sp_name:"atk_s2",icon:"3036",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,DType:DType.ATK,
|
||||
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,cost:0,with:0,ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,cost:0,with:0,dis:80,ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
buffs:[],neAttrs:[],info:"向最前方敌人扔出石斧,造成100%攻击的伤害",
|
||||
},
|
||||
6005: {
|
||||
uuid:6005,name:"水球",sp_name:"m_water_ball_1",icon:"3039",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,DType:DType.MAGE,
|
||||
ap:100,cd:5,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,cost:20,with:90,ready:8001,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
ap:100,cd:5,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,cost:20,with:90,dis:360,ready:8001,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],neAttrs:[],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧",
|
||||
},
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ export enum HeroUpSet {
|
||||
}
|
||||
|
||||
export interface heroInfo{
|
||||
uuid:number, name:string, path:string,fac:FacSet,kind:number,type:HType,
|
||||
uuid:number, name:string, path:string,fac:FacSet,kind:number,type:HType, as:number,
|
||||
hp:number,mp:number, ap:number,map:number, def:number,mdef:number,dis:number, speed:number,lv:number,skills:number[],
|
||||
buff:BuffConf[], tal:number[], info:string
|
||||
}
|
||||
@@ -98,37 +98,37 @@ export const HeroInfo: Record<number, heroInfo> = {
|
||||
// ========== 英雄角色 ==========
|
||||
|
||||
// 刘邦 - 领导型战士(善于用人,知人善任)
|
||||
5001:{uuid:5001,name:"刘邦",path:"hk1", fac:FacSet.HERO, kind:1,
|
||||
5001:{uuid:5001,name:"刘邦",path:"hk1", fac:FacSet.HERO, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:1,hp:1000,mp:85,map:10,def:9,mdef:0,ap:15,dis:100,speed:120,skills:[6001],
|
||||
buff:[],tal:[7101,7201,7301],info:"楚汉争霸领袖,领导统御型战士"},
|
||||
|
||||
// 荆轲 - 刺客(敏捷型,高速度和暴击率)
|
||||
5002:{uuid:5002,name:"荆轲",path:"hc1", fac:FacSet.HERO, kind:1,
|
||||
5002:{uuid:5002,name:"荆轲",path:"hc1", fac:FacSet.HERO, kind:1,as:1.5,
|
||||
type:HType.assassin,lv:1,hp:80,mp:60,map:5,def:3,mdef:0,ap:22,dis:120,speed:180,skills:[6001],
|
||||
buff:[],tal:[7201],info:"战国刺客,刺杀专精敏捷型刺客"},
|
||||
|
||||
// 赵武灵王 - 远程射手(胡服骑射,机动型高移动速度和远程攻击)
|
||||
5005:{uuid:5005,name:"赵武灵王",path:"ha1", fac:FacSet.HERO, kind:2,
|
||||
5005:{uuid:5005,name:"赵武灵王",path:"ha1", fac:FacSet.HERO, kind:2,as:1.5,
|
||||
type:HType.remote,lv:1,hp:100,mp:80,map:8,def:6,mdef:0,ap:18,dis:450,speed:140,skills:[6001],
|
||||
buff:[],tal:[7002],info:"胡服骑射改革者,机动型高远程输出"},
|
||||
|
||||
// 张良 - 智谋法师(运筹帷幄,智谋型法师)
|
||||
5007:{uuid:5007,name:"张良",path:"hh1", fac:FacSet.HERO, kind:2,
|
||||
5007:{uuid:5007,name:"张良",path:"hh1", fac:FacSet.HERO, kind:2,as:1.5,
|
||||
type:HType.mage,lv:1,hp:88,mp:135,map:12,def:5,mdef:0,ap:15,dis:350,speed:100,skills:[6001],
|
||||
buff:[],tal:[7004],info:"运筹帷幄谋士,智谋型法师"},
|
||||
|
||||
// 屈原 - 元素法师(离骚诗韵,元素型高魔法输出)
|
||||
5008:{uuid:5008,name:"屈原",path:"hm1", fac:FacSet.HERO, kind:2,
|
||||
5008:{uuid:5008,name:"屈原",path:"hm1", fac:FacSet.HERO, kind:2,as:1.5,
|
||||
type:HType.mage,lv:1,hp:85,mp:140,map:25,def:4,mdef:0,ap:16,dis:400,speed:90,skills:[6001],
|
||||
buff:[],tal:[7101],info:"离骚诗韵,元素型高魔法输出"},
|
||||
|
||||
// 孙膑 - 谋略法师(兵法谋略,谋略型法师)
|
||||
5009:{uuid:5009,name:"孙膑",path:"hm2", fac:FacSet.HERO, kind:2,
|
||||
5009:{uuid:5009,name:"孙膑",path:"hm2", fac:FacSet.HERO, kind:2,as:1.5,
|
||||
type:HType.mage,lv:1,hp:92,mp:135,map:28,def:6,mdef:0,ap:14,dis:420,speed:95,skills:[6001],
|
||||
buff:[],tal:[7202],info:"兵法谋略,谋略型法师"},
|
||||
|
||||
// 萧何 - 后勤辅助(后勤保障,后勤型辅助)
|
||||
5010:{uuid:5010,name:"萧何",path:"hz1", fac:FacSet.HERO, kind:2,
|
||||
5010:{uuid:5010,name:"萧何",path:"hz1", fac:FacSet.HERO, kind:2,as:1.5,
|
||||
type:HType.support,lv:1,hp:115,mp:145,map:18,def:10,mdef:0,ap:8,dis:380,speed:105,skills:[6001],
|
||||
buff:[],tal:[7006],info:"后勤保障,后勤型辅助"},
|
||||
|
||||
@@ -137,79 +137,79 @@ export const HeroInfo: Record<number, heroInfo> = {
|
||||
|
||||
|
||||
//怪物
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:1,hp:30,mp:100,map:10,def:5,mdef:0,ap:5,dis:90,speed:100,skills:[6001],
|
||||
buff:[],tal:[],info:"普通怪物-战士型"},
|
||||
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.remote,lv:1,hp:20,mp:100,map:10,def:5,mdef:0,ap:5,dis:350,speed:150,skills:[6001],
|
||||
buff:[],tal:[],info:"普通怪物-战士型"},
|
||||
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:1,hp:60,mp:100,map:10,def:5,mdef:0,ap:5,dis:90,speed:100,skills:[6001],
|
||||
buff:[],tal:[],info:"普通怪物-战士型"},
|
||||
|
||||
// 1. 基础近战型
|
||||
5204:{uuid:5204,name:"蝙蝠",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5204:{uuid:5204,name:"蝙蝠",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:1,hp:28,mp:100,map:10,def:2,mdef:0,ap:6,dis:90,speed:125,skills:[6001],
|
||||
buff:[],tal:[],info:"基础近战型:直接向玩家移动,接触造成伤害;中速、低血、数量多"},
|
||||
|
||||
5205:{uuid:5205,name:"骷髅",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5205:{uuid:5205,name:"骷髅",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:1,hp:35,mp:100,map:10,def:3,mdef:0,ap:7,dis:90,speed:120,skills:[6001],
|
||||
buff:[],tal:[],info:"基础近战型:直接向玩家移动,接触造成伤害;中速、低血、数量多"},
|
||||
|
||||
// 2. 快速突击型
|
||||
5206:{uuid:5206,name:"石像鬼",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5206:{uuid:5206,name:"石像鬼",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.assassin,lv:1,hp:26,mp:100,map:10,def:3,mdef:0,ap:8,dis:120,speed:180,skills:[6001],
|
||||
buff:[],tal:[],info:"快速突击型:高速直线冲锋,接触伤害;高速、低血、成群出现"},
|
||||
|
||||
5207:{uuid:5207,name:"快速骷髅",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5207:{uuid:5207,name:"快速骷髅",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.assassin,lv:1,hp:22,mp:100,map:10,def:2,mdef:0,ap:7,dis:120,speed:200,skills:[6001],
|
||||
buff:[],tal:[],info:"快速突击型:高速直线冲锋,接触伤害;高速、低血、成群出现"},
|
||||
|
||||
// 3. 重型坦克型
|
||||
5208:{uuid:5208,name:"大型骷髅",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5208:{uuid:5208,name:"大型骷髅",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:1,hp:140,mp:100,map:10,def:10,mdef:0,ap:10,dis:90,speed:85,skills:[6001],
|
||||
buff:[],tal:[],info:"重型坦克型:缓慢逼近,高血量,中等伤害"},
|
||||
|
||||
5209:{uuid:5209,name:"树人",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5209:{uuid:5209,name:"树人",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:1,hp:160,mp:100,map:10,def:12,mdef:0,ap:12,dis:90,speed:80,skills:[6001],
|
||||
buff:[],tal:[],info:"重型坦克型:缓慢逼近,高血量,中等伤害"},
|
||||
|
||||
// 4. 远程骚扰型
|
||||
5210:{uuid:5210,name:"骷髅弓手",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5210:{uuid:5210,name:"骷髅弓手",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.remote,lv:1,hp:60,mp:100,map:8,def:4,mdef:0,ap:12,dis:450,speed:110,skills:[6005],
|
||||
buff:[],tal:[],info:"远程骚扰型:保持距离发射箭矢,逼迫玩家走位"},
|
||||
|
||||
5211:{uuid:5211,name:"法师骷髅",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5211:{uuid:5211,name:"法师骷髅",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.mage,lv:1,hp:55,mp:100,map:25,def:4,mdef:5,ap:10,dis:400,speed:105,skills:[6005],
|
||||
buff:[],tal:[],info:"远程骚扰型:保持距离释放法术弹幕,逼迫玩家走位"},
|
||||
|
||||
// 5. 特殊机制型
|
||||
5212:{uuid:5212,name:"炸弹骷髅",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5212:{uuid:5212,name:"炸弹骷髅",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.assassin,lv:1,hp:30,mp:100,map:10,def:3,mdef:0,ap:25,dis:100,speed:130,skills:[6001],
|
||||
buff:[],tal:[],info:"特殊机制:接近玩家后自爆造成高额伤害,需优先击杀"},
|
||||
|
||||
// 6. 精英/BOSS型
|
||||
5213:{uuid:5213,name:"亡灵领主(精英)",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5213:{uuid:5213,name:"亡灵领主(精英)",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.warrior,lv:3,hp:200,mp:100,map:20,def:10,mdef:5,ap:20,dis:100,speed:110,skills:[6001],
|
||||
buff:[],tal:[],info:"精英/BOSS:高血量与独特机制,波次高潮与重要经验来源"},
|
||||
|
||||
// 5. 特殊机制扩展
|
||||
// 召唤师:持续召唤小怪(后续可在技能系统中实现 SType.zhaohuan)
|
||||
5214:{uuid:5214,name:"死灵法师(召唤师)",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5214:{uuid:5214,name:"死灵法师(召唤师)",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.mage,lv:1,hp:90,mp:160,map:22,def:4,mdef:6,ap:8,dis:380,speed:100,skills:[6005],
|
||||
buff:[],tal:[],info:"特殊机制:持续召唤小怪,需优先击杀"},
|
||||
|
||||
// 治疗者:为周围怪物回血(此处以提升治疗效果和生命回复为基础被动)
|
||||
// Attrs.HEAL_EFFECT=5 (RATIO=1),Attrs.HP_REGEN=3 (VALUE=0)
|
||||
5215:{uuid:5215,name:"祭司(治疗者)",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5215:{uuid:5215,name:"祭司(治疗者)",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.support,lv:1,hp:100,mp:160,map:18,def:5,mdef:8,ap:6,dis:350,speed:105,skills:[6005],
|
||||
buff:[],tal:[],info:"特殊机制:为周围怪物提供治疗增益与持续回复"},
|
||||
|
||||
// 光环怪:为周围怪物提供增益(此处以Buff效果提升与移动速度提升为基础被动)
|
||||
// Attrs.BUFF_UP=60 (RATIO=1),Attrs.SPEED=63 (RATIO=1)
|
||||
5216:{uuid:5216,name:"光环幽灵(光环怪)",path:"mo1", fac:FacSet.MON, kind:1,
|
||||
5216:{uuid:5216,name:"光环幽灵(光环怪)",path:"mo1", fac:FacSet.MON, kind:1,as:1.5,
|
||||
type:HType.support,lv:1,hp:85,mp:140,map:15,def:4,mdef:7,ap:7,dis:350,speed:110,skills:[6005],
|
||||
buff:[],tal:[],info:"特殊机制:为周围怪物提供增益光环,加速与增益效果强化"},
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export class Hero extends ecs.Entity {
|
||||
model.is_master = true;
|
||||
|
||||
// ✅ 初始化技能数据(迁移到 HeroSkillsComp)
|
||||
skillsComp.initSkills(hero.skills);
|
||||
skillsComp.initSkills(hero.skills,uuid);
|
||||
|
||||
// 设置基础属性
|
||||
model.base_ap = hero.ap;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
|
||||
/**
|
||||
* ==================== 技能槽位数据 ====================
|
||||
@@ -39,21 +42,24 @@ export class HeroSkillsComp extends ecs.Comp {
|
||||
* 初始化技能列表
|
||||
* @param sUuids 技能配置ID数组
|
||||
*/
|
||||
initSkills(sUuids: number[]) {
|
||||
initSkills(sUuids: number[], uuid: number) {
|
||||
this.skills = [];
|
||||
for (const s_uuid of sUuids) {
|
||||
for (let i = 0; i < sUuids.length; i++) {
|
||||
const s_uuid = sUuids[i];
|
||||
const config = SkillSet[s_uuid];
|
||||
if (!config) {
|
||||
console.warn(`[HeroSkills] 技能配置不存在: ${s_uuid}`);
|
||||
continue;
|
||||
}
|
||||
this.skills[s_uuid]={
|
||||
// 第0个技能的 cd_max 取 herosinfo[uuid].as
|
||||
const cdMax = i === 0 ? HeroInfo[uuid].as : config.cd;
|
||||
this.skills[s_uuid] = {
|
||||
s_uuid: config.uuid,
|
||||
cd: 0,
|
||||
cd_max: config.cd,
|
||||
cd_max: cdMax,
|
||||
cost: config.cost,
|
||||
level: 1,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +90,11 @@ export class HeroSkillsComp extends ecs.Comp {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 检查技能是否可施放(通过索引)
|
||||
* @param index 技能索引
|
||||
* 检查技能是否可施放(通过s_uuid)
|
||||
* @param s_uuid 技能配置ID
|
||||
* @param currentMp 当前MP值
|
||||
*/
|
||||
canCast(s_uuid: number, currentMp: number): boolean {
|
||||
@@ -97,41 +105,28 @@ export class HeroSkillsComp extends ecs.Comp {
|
||||
return skill.cd <= 0 && currentMp >= skill.cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查技能是否可施放(通过s_uuid)
|
||||
* @param s_uuid 技能配置ID
|
||||
* @param currentMp 当前MP值
|
||||
*/
|
||||
canCastByUuid(s_uuid: number, currentMp: number): boolean {
|
||||
const skill = this.getSkill(s_uuid);
|
||||
if (!skill) return false;
|
||||
|
||||
// 检查CD和MP
|
||||
return skill.cd <= 0 && currentMp >= skill.cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置技能CD(开始冷却,通过索引)
|
||||
* @param index 技能索引
|
||||
*/
|
||||
resetCD(s_uuid: number) {
|
||||
let attrsCom = this.ent.get(HeroAttrsComp);
|
||||
if (!attrsCom) return;
|
||||
const skill = this.getSkill(s_uuid);
|
||||
if (!skill) return;
|
||||
|
||||
// 普通攻击(skills[0])受 AS 影响,其余技能受 SS 影响
|
||||
const isNormalAttack = s_uuid === this.skills[0]?.s_uuid;
|
||||
const speedAttr = isNormalAttack ? Attrs.AS : Attrs.SS;
|
||||
const speedBonus = attrsCom.Attrs[speedAttr] / 100; // 100 表示 100% 提速
|
||||
const speedMultiplier = 1 / (1 + speedBonus); // 提速 100% => cd 减半
|
||||
|
||||
skill.cd = skill.cd_max * speedMultiplier;
|
||||
if (skill) {
|
||||
skill.cd = skill.cd_max;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置技能CD(开始冷却,通过s_uuid)
|
||||
* @param s_uuid 技能配置ID
|
||||
*/
|
||||
resetCDByUuid(s_uuid: number) {
|
||||
const skill = this.getSkill(s_uuid);
|
||||
if (skill) {
|
||||
skill.cd = skill.cd_max;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新所有技能CD(每帧调用)
|
||||
* @param dt 时间增量
|
||||
@@ -154,7 +149,7 @@ export class HeroSkillsComp extends ecs.Comp {
|
||||
getReadySkills(currentMp: number): number[] {
|
||||
const ready: number[] = [];
|
||||
for (const s_uuid in this.skills) {
|
||||
if (this.canCastByUuid(Number(s_uuid), currentMp)) {
|
||||
if (this.canCast(Number(s_uuid), currentMp)) {
|
||||
ready.push(Number(s_uuid));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export class Monster extends ecs.Entity {
|
||||
model.Attrs[Attrs.DIS] = hero.dis;
|
||||
|
||||
// ✅ 初始化技能数据(迁移到 HeroSkillsComp)
|
||||
skillsComp.initSkills(hero.skills);
|
||||
skillsComp.initSkills(hero.skills,uuid);
|
||||
|
||||
this.add(view);
|
||||
oops.message.dispatchEvent("monster_load",this)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { HeroSkillsComp } from "./HeroSkills";
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,11 @@ export class SkillCDSystem extends ecs.ComblockSystem implements ecs.ISystemUpda
|
||||
if(!smc.mission.play || smc.mission.pause) return;
|
||||
const skills = e.get(HeroSkillsComp);
|
||||
if (!skills) return;
|
||||
|
||||
const attrsCom = e.get(HeroAttrsComp);
|
||||
if (!attrsCom) return;
|
||||
if (attrsCom.isStun() || attrsCom.isFrost()) { // 眩晕和冰冻状态不更新CD
|
||||
return;
|
||||
}
|
||||
// 更新所有技能CD
|
||||
skills.updateCDs(this.dt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user