From 559ddfb6538c2d923c25d87dbc357f0b160a2f99 Mon Sep 17 00:00:00 2001 From: walkpan Date: Thu, 16 Oct 2025 23:40:12 +0800 Subject: [PATCH] dd --- assets/script/game/common/config/SkillSet.ts | 240 +++++++--------- assets/script/game/common/config/heroSet.ts | 104 +++---- assets/script/game/hero/Hero.ts | 41 +-- assets/script/game/hero/HeroViewComp.ts | 281 +++---------------- assets/script/game/hero/SkillConComp.ts | 10 +- assets/script/game/skill/AtkConCom.ts | 99 +++---- assets/script/game/skill/SkillEnt.ts | 18 +- assets/script/game/skill/SkillViewCom.ts | 36 +-- 8 files changed, 267 insertions(+), 562 deletions(-) diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index d3030fea..550a8cb9 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -1,5 +1,6 @@ import { log } from "cc" import { QualitySet } from "./BoxSet" +import * as exp from "constants" export enum TGroup { Self = 0, // 自身 @@ -94,119 +95,90 @@ export enum EType { countEnd = 4, } //debuff类型 -export enum DebuffAttr { - STUN = 1, //眩晕 - SLOW = 2, //减速 - FROST = 3, //冰冻 - BURN = 4, //易伤 默认次数是5 技能配置的devC是额外次数 - DECD = 5, //减cd - DEHP = 6, //减hp - DEATK = 7, //减atk - DECOUNT = 8, //减攻击次数 - BACK = 9, //击退 - CRITICAL = 10, //自身暴击率降低 - DODGE = 11, //闪避 + +export enum DBuff { + STUN = 1, //眩晕 - 对应Attrs.CON_RES (控制抗性), BType.RATIO + SLOW = 2, //减速 - 对应Attrs.AS (攻击速度), BType.RATIO + FROST = 3, //冰冻 - 对应Attrs.ICE_RES (冰冻抗性), BType.RATIO + BURN = 4, //易伤 - 对应Attrs.DEF/MDEF (防御/魔防), BType.RATIO, 默认次数是5, 技能配置的devC是额外次数 + DEAS = 5, //减速 - 对应Attrs.AS (攻击速度), BType.RATIO, 直接+技能cd + DEHP = 6, //减hp - 对应Attrs.HP_MAX (最大生命值), BType.RATIO + DEAP = 7, //减atk - 对应Attrs.AP (攻击力), BType.RATIO + DEMGP = 8, //减魔法伤害 - 对应Attrs.MAP (魔法攻击力), BType.RATIO + BACK = 9, //击退概率 - 对应Attrs.KNOCKBACK (击退概率), BType.RATIO + CRITICAL = 10, //-暴击率 - 对应Attrs.CRITICAL (暴击率), BType.RATIO + CRIT_DAMAGE = 11, //-暴击伤害 - 对应Attrs.CRITICAL_DMG (暴击伤害), BType.RATIO + DODGE = 12, //-闪避 - 对应Attrs.DODGE (闪避), BType.RATIO + DBUFFUP=13, //edbuff效果提升 + BUFF_DOWN = 14,// buff效果减弱 } -//buff类型 -export enum BuffAttr { - AP = 0, //攻击力 数值 - ATK = 1, // 攻击力百分比 - WFUNY = 2, // 风怒 - ATK_CD = 3, // 攻击速度 - HP = 4, // 生命值比例 - DEF = 5, // 防御 - SKILL_DMG = 6, // 技能效果 - SKILL_CD = 7, // 技能冷却缩减 - CARD_EFFECT = 8, // 卡牌效果 - CRITICAL = 9, //暴击率 - CRITICAL_DMG = 10, //暴击伤害 - CRITICAL_NO = 11, //暴击免疫 - DODGE = 12, //闪避 - DODGE_NO = 13, //闪避免疫 - DEBUFF_COUNT = 14, //debuff持续时间提升 - DEBUFF_VALUE = 15, //debuff效果 - DEBUFF_UP = 16, //debuff概率提升 - DEBUFF_DOWN = 17, //被debuff概率降低 - PUNCTURE = 18, //穿刺敌人伤害后方敌人 - PUNCTURE_DMG = 19, //穿刺敌人伤害后方敌人伤害加成 - FROST_RATIO = 20, //冰冻比率 - REFLECT = 21, //反伤比率 - KNOCKBACK = 22, //击退概率 - BURN_COUNT = 23, //易伤额外次数 - BURN_VALUE = 24,//易伤效果 - STUN_TIME = 25, //击晕额外时间 - STUN_RATIO = 26, //击晕概率 - FROST_TIME = 27, //冰冻时间 - HP_MAX = 28, //最大生命值数值 - POWER_UP = 29, //能量增加 - LIFESTEAL = 30, //吸血 - DMG_RED = 31, //免伤 - INVINCIBLE = 32, //无敌 - DIS = 33, //距离 - SPEED = 34, //速度 - SHIELD = 35, //护盾 - POWER_MAX = 36, //最大能量 - MP = 37, -} -export const getBuffNum=()=>{ - return { - [BuffAttr.AP]:0, //攻击力 数值 - [BuffAttr.ATK]:0, // 攻击力 - [BuffAttr.WFUNY]:0, // 风怒概率 - [BuffAttr.ATK_CD]:0, // 攻击速度 - [BuffAttr.HP]:0, // 生命值 比例 - [BuffAttr.DEF]:0, // 免伤 - [BuffAttr.SKILL_DMG]:0, // 技能效果 - [BuffAttr.SKILL_CD]:0, // 技能冷却缩减 - [BuffAttr.CARD_EFFECT]:0, // 卡牌效果 - [BuffAttr.CRITICAL]:0, //暴击 - [BuffAttr.CRITICAL_DMG]:0, //暴击伤害 - [BuffAttr.CRITICAL_NO]:0, //暴击免疫 - [BuffAttr.DODGE]:0, //闪避 - [BuffAttr.DODGE_NO]:0, //闪避免疫 - [BuffAttr.DEBUFF_COUNT]:0, //debuff次数 - [BuffAttr.DEBUFF_VALUE]:0, //debuff效果 - [BuffAttr.DEBUFF_UP]:0, //debuff概率提升 - [BuffAttr.DEBUFF_DOWN]:0, //被debuff概率降低 - [BuffAttr.PUNCTURE]:0, //穿刺敌人伤害后方敌人 - [BuffAttr.PUNCTURE_DMG]:0, //穿刺敌人伤害后方敌人伤害加成 - [BuffAttr.FROST_RATIO]:0, //冰冻比率 - [BuffAttr.REFLECT]:0, //反伤比率 - [BuffAttr.KNOCKBACK]:0, //击退概率 - [BuffAttr.BURN_COUNT]:0, //易伤额外次数 - [BuffAttr.BURN_VALUE]:0, - [BuffAttr.STUN_TIME]:0, - [BuffAttr.STUN_RATIO]:0, - [BuffAttr.FROST_TIME]:0, - [BuffAttr.HP_MAX]:0,//最大生命值数值 - [BuffAttr.POWER_UP]:0,//能量增加 - [BuffAttr.LIFESTEAL]:0,//吸血 - [BuffAttr.DMG_RED]:0,//免伤 - [BuffAttr.INVINCIBLE]:0,//无敌 - [BuffAttr.DIS]:0,//距离 - [BuffAttr.SPEED]:0,//速度 - [BuffAttr.SHIELD]:0,//护盾 - [BuffAttr.POWER_MAX]:0,//最大能量 - [BuffAttr.MP]:0, - } -} export const geDebuffNum=()=>{ return { - STUN:0, //眩晕 - SLOW:0, //减速 - FROST:0, //冰冻 - BURN:0, //易伤 - DECD:0, //减cd - DEHP:0, //减hp - DEATK:0, //减atk - DECOUNT:0, //减攻击次数 - CRITICAL:0, //暴击 - DODGE:0, //闪避 - + [DBuff.STUN]:0, //眩晕 + [DBuff.SLOW]:0, //减速 + [DBuff.FROST]:0, //冰冻 + [DBuff.BURN]:0, //易伤 + [DBuff.DEAS]:0, //减cd + [DBuff.DEHP]:0, //减生命最大值 + [DBuff.DEAP]:0, //减攻击力 + [DBuff.DEMGP]:0, //减魔法攻击力 + [DBuff.BACK]:0, //+击退比率 + [DBuff.CRITICAL]:0,//-技能暴击几率 + [DBuff.CRIT_DAMAGE]:0, + [DBuff.DODGE]:0, + [DBuff.DBUFFUP]:0, } } +export enum Attrs { + HP_MAX = 0, //生命值 + MP_MAX = 1, //魔法值 + SHIELD_MAX=2, //护盾 + AP = 3, //攻击力 + MAP=4, //魔法攻击力 + DEF = 5, //防御 + MDEF = 6, //魔法防御 + CRITICAL =7, //暴击率 + CRITICAL_DMG = 8, //暴击伤害 + DODGE = 9, //闪避 + HIT = 10, //命中 + WFUNY = 11, // 风怒 + AS = 12, //攻击速度,直接减技能cd + REFLICT = 13, //反伤比率 + LIFESTEAL = 14, //吸血比率 + KNOCKBACK = 15, //攻击带击退概率 + CON_RES = 16, //控制抗性 + ICE_RES = 17, //冰冻抗性 + FIRE_RES = 18, //火抗性 + WIND_RES = 19, //风抗性 + ICE_POWER = 20, //冰冻伤害效果提升 + FIRE_POWER = 21,//火伤害效果提升 + WIND_POWER = 22,//风伤害效果提升 + SHIELD_UP = 23, //护盾效果提升 + BUFF_UP = 24, //buff效果提升 + DBUFF_UP=25, //debuff效果提升 + DIS=26, //攻击距离 +} + +export const getAttrs=()=>{ + // 遍历枚举的数字值(枚举会生成双向映射) + let reAttrs = {}; + Object.keys(Attrs).forEach(key => { + if (!isNaN(Number(key))) { + reAttrs[Number(key)] = 0; + } + }); + return reAttrs; +} + + +export enum BType { + VALUE=0, //数值型 + RATIO=1 //百分比型 +} + + /* === 技能配置系统使用说明 === @@ -247,38 +219,40 @@ export const geDebuffNum=()=>{ - cost: 消耗值 5. 效果配置: - - buffs: BuffConfig[] - 增益效果数组 - - debuffs: DebuffConfig[] - 减益效果数组 + - buffs: BuffConf[] - 增益效果数组 + - debuffs: DbuffConf[] - 减益效果数组 - info: 技能描述 - hero?: 召唤物英雄ID (可选) -6. BuffConfig结构: +6. BuffConf结构: - buff: BuffAttr - 增益类型 - buV: number - 效果值 - buC: number - 持续次数 - buR: number - 触发概率 -7. DebuffConfig结构: +7. DbuffConf结构: - debuff: DebuffAttr - 减益类型 - dev: number - 效果值 - deC: number - 持续时间 - deR: number - 触发概率 8. 使用示例: - buffs: [createBuffConfig(BuffAttr.SHIELD, 2, 0, 100)] - debuffs: [createDebuffConfig(DebuffAttr.STUN, 0, 1, 50)] + buffs: [createBuffConf(BuffAttr.SHIELD, 2, 0, 100)] + debuffs: [createDbuffConf(DBuff.STUN, 0, 1, 50)] */ export const HeroSkillList = [6001,6001,6001,6001,6001,6001] // Debuff配置接口 -export interface DebuffConfig { - debuff: DebuffAttr; // debuff类型 +export interface DbuffConf { + debuff: DBuff; // debuff类型 + BType:BType //buff是数值型还是百分比型 dev: number; // 效果值 (原deV) deC: number; // 持续时间 deR: number; // 触发概率 (原deR) } -export interface BuffConfig { - buff:BuffAttr; +export interface BuffConf { + buff:Attrs; + BType:BType buV:number; buC:number; buR:number; @@ -287,7 +261,7 @@ export interface BuffConfig { export interface SkillConfig { uuid:number,name:string,sp_name:string,AtkedType:AtkedType,path:string,TGroup:TGroup,SType:SType,act:string,DTType:DTType, ap:number,cd:number,in:number,t_num:number,hit_num:number,hit:number,hitcd:number,speed:number,cost:number,with:number, - buffs:BuffConfig[],debuffs:DebuffConfig[],info:string,hero?:number + buffs:BuffConf[],debuffs:DbuffConf[],info:string,hero?:number } @@ -316,7 +290,7 @@ export const SkillSet: Record = { 6005: { uuid:6005,name:"火球术",sp_name:"atk_fires",AtkedType:AtkedType.fire,path:"3039",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single, ap:100,cd:5,in:1,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.STUN,dev:0,deC:1,deR:50}],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧" + buffs:[],debuffs:[],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧" }, 6006: { uuid:6006,name:"能量波",sp_name:"am_blue",AtkedType:AtkedType.ice,path:"3034",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single, @@ -326,23 +300,23 @@ export const SkillSet: Record = { 6007: { uuid:6007,name:"圣光波",sp_name:"am_yellow",AtkedType:AtkedType.fire,path:"3039",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.STUN,dev:0,deC:1,deR:50}],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧" + buffs:[],debuffs:[],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧" }, // ========== 大招 ========== 6100-6199 6101: { uuid:6101,name:"护盾",sp_name:"shield",AtkedType:AtkedType.atked,path:"3045",TGroup:TGroup.Team,SType:SType.shield,act:"max",DTType:DTType.single, ap:0,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:3,speed:720,cost:10,with:0, - buffs:[{buff:BuffAttr.SHIELD,buV:2,buC:0,buR:100}],debuffs:[],info:"为最前排队友召唤一个可以抵御2次攻击的圣盾(最高叠加到6次)" + buffs:[],debuffs:[],info:"为最前排队友召唤一个可以抵御2次攻击的圣盾(最高叠加到6次)" }, 6102: { uuid:6102,name:"寒冰箭",sp_name:"arrow_blue",AtkedType:AtkedType.ice,path:"3060",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single, ap:100,cd:1,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.FROST,dev:1,deC:0,deR:100}],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,20%几率冰冻敌人" + buffs:[],debuffs:[],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,20%几率冰冻敌人" }, 6103: { uuid:6103,name:"治疗",sp_name:"heath_small",AtkedType:AtkedType.atked,path:"3056",TGroup:TGroup.Team,SType:SType.heal,act:"max",DTType:DTType.single, ap:0,cd:5,in:0,t_num:1,hit_num:1,hit:0,hitcd:0,speed:0,cost:10,with:0, - buffs:[{buff:BuffAttr.HP,buV:20,buC:0,buR:100}],debuffs:[],info:"回复最前排队友10%最大生命值的生命" + buffs:[],debuffs:[],info:"回复最前排队友10%最大生命值的生命" }, 6104: { @@ -360,7 +334,7 @@ export const SkillSet: Record = { 6106: { uuid:6106,name:"龙卷风",sp_name:"bwind",AtkedType:AtkedType.wind,path:"3065",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:1,speed:360,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.BACK,dev:0,deC:0,deR:100}],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,50%几率击退敌人" + buffs:[],debuffs:[],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,50%几率击退敌人" }, @@ -368,7 +342,7 @@ export const SkillSet: Record = { 6107: { uuid:6107,name:"烈焰射击",sp_name:"arrow_yellow",AtkedType:AtkedType.fire,path:"3014",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.STUN,dev:0.5,deC:0,deR:50}],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,20%几率眩晕敌人" + buffs:[],debuffs:[],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,20%几率眩晕敌人" }, 6108: { @@ -380,13 +354,13 @@ export const SkillSet: Record = { 6109: { uuid:6109,name:"冰刺",sp_name:"icez",AtkedType:AtkedType.atked,path:"3049",TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range, ap:300,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.FROST,dev:0,deC:0,deR:100}],info:"在最前方敌人位置,召唤冰刺攻击敌人,造成200%攻击的伤害,20%几率冰冻敌人" + buffs:[],debuffs:[],info:"在最前方敌人位置,召唤冰刺攻击敌人,造成200%攻击的伤害,20%几率冰冻敌人" }, 6110: { uuid:6110,name:"潮汐",sp_name:"watert",AtkedType:AtkedType.atked,path:"3070",TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.BACK,dev:0,deC:0,deR:100}],info:"在最前方敌人位置,召唤水柱攻击敌人,每秒造成100%攻击的伤害,50%几率击退敌人" + buffs:[],debuffs:[],info:"在最前方敌人位置,召唤水柱攻击敌人,每秒造成100%攻击的伤害,50%几率击退敌人" }, 6111: { @@ -398,7 +372,7 @@ export const SkillSet: Record = { 6112: { uuid:6112,name:"冰墙",sp_name:"icet",AtkedType:AtkedType.atked,path:"3050",TGroup:TGroup.Enemy,SType:SType.damage,act:"max",DTType:DTType.range, ap:400,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.BACK,dev:0,deC:0,deR:100}],info:"在最前方敌人位置,召唤冰墙攻击敌人,造成200%攻击的伤害,50%几率击退敌人" + buffs:[],debuffs:[],info:"在最前方敌人位置,召唤冰墙攻击敌人,造成200%攻击的伤害,50%几率击退敌人" }, 6113: { uuid:6113,name:"剑雨",sp_name:"max_jianyu",AtkedType:AtkedType.fire,path:"3123",TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range, @@ -420,33 +394,33 @@ export const SkillSet: Record = { 6202: { uuid:6202,name:"龙卷风爆",sp_name:"bwind",AtkedType:AtkedType.atked,path:"3069",TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:1,speed:360,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.BACK,dev:0,deC:0,deR:50}],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,50%几率击退敌人" + buffs:[],debuffs:[],info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,50%几率击退敌人" }, 6203: { uuid:6203,name:"大潮汐",sp_name:"watert",AtkedType:AtkedType.atked,path:"3070",TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[],debuffs:[{debuff:DebuffAttr.BACK,dev:0,deC:0,deR:50}],info:"召唤水柱攻击敌人,每秒造成100%攻击的伤害,50%几率击退敌人" + buffs:[],debuffs:[],info:"召唤水柱攻击敌人,每秒造成100%攻击的伤害,50%几率击退敌人" }, // ==========增强型技能,被动技能,========== 6300-6399 6301: { uuid:6301,name:"攻击生命强化Ⅰ",sp_name:"max_ap",AtkedType:AtkedType.atked,path:"3065",TGroup:TGroup.Ally,SType:SType.buff,act:"atk",DTType:DTType.single, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[{buff:BuffAttr.AP,buV:20,buC:0,buR:100},{buff:BuffAttr.HP,buV:20,buC:0,buR:100}],debuffs:[],info:"增加20%攻击力和生命值" + buffs:[],debuffs:[],info:"增加20%攻击力和生命值" }, 6302: { uuid:6302,name:"攻击生命强化Ⅱ",sp_name:"max_ap",AtkedType:AtkedType.atked,path:"3093",TGroup:TGroup.Ally,SType:SType.buff,act:"atk",DTType:DTType.single, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[{buff:BuffAttr.AP,buV:40,buC:0,buR:100},{buff:BuffAttr.HP,buV:40,buC:0,buR:100}],debuffs:[],info:"增加40%攻击力和生命值" + buffs:[],debuffs:[],info:"增加40%攻击力和生命值" }, 6303: { uuid:6303,name:"攻击生命强化Ⅲ",sp_name:"max_ap",AtkedType:AtkedType.atked,path:"3065",TGroup:TGroup.Ally,SType:SType.buff,act:"atk",DTType:DTType.single, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[{buff:BuffAttr.AP,buV:60,buC:0,buR:100},{buff:BuffAttr.HP,buV:60,buC:0,buR:100}],debuffs:[],info:"增加60%攻击力和生命值" + buffs:[],debuffs:[],info:"增加60%攻击力和生命值" }, 6304: { uuid:6304,name:"攻击生命强化Ⅳ",sp_name:"max_ap",AtkedType:AtkedType.atked,path:"3065",TGroup:TGroup.Ally,SType:SType.buff,act:"atk",DTType:DTType.single, ap:100,cd:5,in:0,t_num:1,hit_num:1,hit:1,hitcd:0.3,speed:720,cost:10,with:90, - buffs:[{buff:BuffAttr.AP,buV:80,buC:0,buR:100},{buff:BuffAttr.HP,buV:80,buC:0,buR:100}],debuffs:[],info:"增加80%攻击力和生命值" + buffs:[],debuffs:[],info:"增加80%攻击力和生命值" }, }; \ No newline at end of file diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 878efed9..d70607e7 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -1,6 +1,8 @@ import { v3 } from "cc" import { FacSet, QualitySet } from "./BoxSet" import { smc } from "../SingletonModuleComp" +import { BuffConf, DbuffConf } from "./SkillSet" +import { debuff } from "../../skills/debuff" /** * kind :1:烈焰 2:寒冰 3:自然 4:暗影 5:神圣 **/ @@ -95,108 +97,110 @@ export enum HeroUpSet { LVDEF=5, } +export interface heroInfo{ + uuid:number, name:string, path:string,fac:FacSet,kind:QualitySet,type:HType, hp:number,mp:number,map:number, def:number, ap:number,dis:number, cd:number,speed:number, + lv:number,skills:number[], buff:BuffConf[], debuff:DbuffConf[], info:string +} - - -export const HeroInfo = { +export const HeroInfo: Record = { //主将 5001:{uuid:5001,name:"火焰骑士",path:"hk1", fac:FacSet.HERO, kind:1, - type:HType.warrior,hp:100,mp:100,def:5,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001], - buff:[],info:""}, + type:HType.warrior,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001], + buff:[],debuff:[],info:""}, 5002:{uuid:5002,name:"刺客",path:"hc1", fac:FacSet.HERO, kind:1, - type:HType.warrior,hp:100,mp:100,def:5,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001], - buff:[],info:""}, + type:HType.warrior,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001], + buff:[],debuff:[],info:""}, 5005:{uuid:5005,name:"绿箭",path:"ha1", fac:FacSet.HERO, kind:2, - type:HType.remote,hp:100,mp:100,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6001,6001], - buff:[],info:""}, + type:HType.remote,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:""}, 5007:{uuid:5007,name:"牧师",path:"hmh1", fac:FacSet.HERO, kind:2, - type:HType.mage,hp:100,mp:100,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6001,6001], - buff:[],info:""}, + type:HType.mage,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:""}, 5008:{uuid:5008,name:"火女",path:"hmf1", fac:FacSet.HERO, kind:2, - type:HType.mage,hp:100,mp:100,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6001,6001], - buff:[],info:""}, + type:HType.mage,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:""}, // 5009:{uuid:5009,name:"风暴精灵",path:"hk1", fac:FacSet.HERO, kind:2, -// type:HType.mage,hp:100,mp:100,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6006,6006,6301,6302,6303], -// buff:[],info:""}, +// type:HType.mage,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6006,6006,6301,6302,6303], +// buff:[],debuff:[],info:""}, // 5010:{uuid:5010,name:"战争祭祀",path:"hk1", fac:FacSet.HERO, kind:2, -// type:HType.mage,hp:100,mp:100,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6007,6007,6301,6302,6303], -// buff:[],info:""}, +// type:HType.mage,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6007,6007,6301,6302,6303], +// buff:[],debuff:[],info:""}, // 5011:{uuid:5011,name:"ha2",path:"ha2", fac:FacSet.HERO, kind:2, -// type:HType.remote,hp:100,mp:100,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003,6301,6302,6303], -// buff:[],info:""}, +// type:HType.remote,lv:1,hp:100,mp:100,map:0,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003,6301,6302,6303], +// buff:[],debuff:[],info:""}, //怪物 5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:25,mp:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.warrior,lv:1,hp:25,mp:100,map:0,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.remote,hp:20,mp:100,def:5,ap:5,dis:350,cd:1,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.remote,lv:1,hp:20,mp:100,map:0,def:5,ap:5,dis:350,cd:1,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5203:{uuid:5203,name:"兽人护卫",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:25,mp:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.warrior,lv:1,hp:25,mp:100,map:0,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5204:{uuid:5204,name:"石卫", path:"mo1", fac:FacSet.MON, kind:1, - type:HType.mage,hp:18,mp:100,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001,6001], - buff:[],info:"法师怪物-高伤害脆弱"}, + type:HType.mage,lv:1,hp:18,mp:100,map:0,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"法师怪物-高伤害脆弱"}, 5205:{uuid:5205,name:"土卫", path:"mo1", fac:FacSet.MON, kind:1, - type:HType.mage,hp:18,mp:100,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001,6001], - buff:[],info:"法师怪物-高伤害脆弱"}, + type:HType.mage,lv:1,hp:18,mp:100,map:0,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"法师怪物-高伤害脆弱"}, 5206:{uuid:5206,name:"树卫", path:"mo1", fac:FacSet.MON, kind:1, - type:HType.mage,hp:18,mp:100,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001,6001], - buff:[],info:"法师怪物-高伤害脆弱"}, + type:HType.mage,lv:1,hp:18,mp:100,map:0,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"法师怪物-高伤害脆弱"}, - 5219:{uuid:5219,name:"牛头战士",path:"mo1", fac:FacSet.MON, lv:2,kind:1, - type:HType.warrior,hp:25,mp:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + 5219:{uuid:5219,name:"牛头战士",path:"mo1", fac:FacSet.MON,kind:1, + type:HType.warrior,lv:1,hp:25,mp:100,map:0,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5220:{uuid:5220,name:"牛头战士",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:25,mp:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.warrior,lv:1,hp:25,mp:100,map:0,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5221:{uuid:5221,name:"牛头战士",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.remote,hp:20,mp:100,def:5,ap:5,dis:350,cd:1.5,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.remote,lv:1,hp:20,mp:100,map:0,def:5,ap:5,dis:350,cd:1.5,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5222:{uuid:5222,name:"独眼巨人",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:25,mp:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.warrior,lv:1,hp:25,mp:100,map:0,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5223:{uuid:5223,name:"独眼巨人",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:25,mp:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.warrior,lv:1,hp:25,mp:100,map:0,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5224:{uuid:5224,name:"独眼巨人",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.remote,hp:20,mp:100,def:5,ap:5,dis:350,cd:1.5,speed:100,skills:[6001,6001], - buff:[],info:"普通怪物-战士型"}, + type:HType.remote,lv:1,hp:20,mp:100,map:0,def:5,ap:5,dis:350,cd:1.5,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"普通怪物-战士型"}, 5225:{uuid:5225,name:"精英独眼",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:45,mp:100,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6001], - buff:[],info:"精英怪物-战士型"}, + type:HType.warrior,lv:1,hp:45,mp:100,map:0,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6001], + buff:[],debuff:[],info:"精英怪物-战士型"}, 5226:{uuid:5226,name:"精英牛头",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:45,mp:100,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"精英怪物-战士型"}, + type:HType.warrior,lv:1,hp:45,mp:100,map:0,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"精英怪物-战士型"}, 5227:{uuid:5227,name:"精英兽人",path:"mo1", fac:FacSet.MON, kind:1, - type:HType.warrior,hp:45,mp:100,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6001,6001], - buff:[],info:"精英怪物-战士型"}, + type:HType.warrior,lv:1,hp:45,mp:100,map:0,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6001,6001], + buff:[],debuff:[],info:"精英怪物-战士型"}, }; diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index a6a5f09b..6ae897a1 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -8,7 +8,7 @@ import { BoxSet, FacSet } from "../common/config/BoxSet"; import { HeroInfo, HeroPos, HType } from "../common/config/heroSet"; import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp"; import { GameEvent } from "../common/config/GameEvent"; -import { BuffAttr, getBuffNum, SkillSet, SType } from "../common/config/SkillSet"; +import { Attrs, getAttrs } from "../common/config/SkillSet"; /** 角色实体 */ @ecs.register(`Hero`) @@ -65,38 +65,23 @@ export class Hero extends ecs.Entity { let hero= HeroInfo[uuid] // 共用英雄数据 hv.scale = 1; hv.is_master=true; - hv.lv=HeroInfo[uuid].lv?HeroInfo[uuid].lv:1 + hv.lv=hero.lv?hero.lv:1 hv.fac = FacSet.HERO; hv.type = hero.type; hv.box_group = BoxSet.HERO; hv.hero_uuid= uuid; hv.hero_name= hero.name; - hv.hp=hv.hp_max=hv.hp_base=HeroInfo[uuid].hp; - hv.mp=hv.mp_max=hv.mp_base=HeroInfo[uuid].mp; - hv.Attrs=getBuffNum() - hv.Attrs[BuffAttr.SPEED]=hv.speed = hero.speed; - hv.Attrs[BuffAttr.DIS]=hv.dis=hero.dis; - hv.Attrs[BuffAttr.ATK_CD]=hv.cd=hero.cd - hv.Attrs[BuffAttr.AP]=hv.ap=HeroInfo[uuid].ap; - hv.Attrs[BuffAttr.DEF]=HeroInfo[uuid].def; - hero.buff.forEach((buff:any)=>{ - hv.apply_buff(buff.type,buff.value) - }) - for(let i=0;i{ - hv.apply_buff(buff.buff, buff.buV) - }) - continue - }else{ - hv.skills.push({ - cd:0, - uuid:hero.skills[i], - cd_max:i==0?hero.cd:SkillSet[hero.skills[i]].cd - }) - } - } + hv.base_ap=hero.ap + hv.base_map=hero.mp + hv.base_def=hero.def + hv.hp=hv.base_hp=hero.hp + hv.mp=hv.base_mp=hero.mp + hv.Attrs=getAttrs() + hv.Attrs[Attrs.HP_MAX]=hv.base_hp + hv.Attrs[Attrs.MP_MAX]=hv.base_mp + hv.Attrs[Attrs.DEF]=hv.base_def + hv.Attrs[Attrs.AP]=hv.base_ap + hv.Attrs[Attrs.MAP]=hv.base_map return hv } } \ No newline at end of file diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 58bd89bd..bbb073f3 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -5,7 +5,7 @@ import { HeroSpine } from "./HeroSpine"; import { BoxSet, FacSet } from "../common/config/BoxSet"; import { smc } from "../common/SingletonModuleComp"; import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer"; -import { BuffAttr, DebuffAttr, geDebuffNum, getBuffNum, SkillSet, TGroup, TType } from "../common/config/SkillSet"; +import { Attrs, DBuff, geDebuffNum, getAttrs, SkillSet, TGroup, TType, BType, BuffConf, DbuffConf } from "../common/config/SkillSet"; import { BuffComp } from "./BuffComp"; import { oops } from "db://oops-framework/core/Oops"; import { GameEvent } from "../common/config/GameEvent"; @@ -41,72 +41,34 @@ export class HeroViewComp extends CCComp { is_kalami:boolean =false; speed: number = 100; /** 角色移动速度 */ - speed_base: number = 100; /** 角色初始速度 */ - power:number=0; - power_max:number=100; - mp: number = 0; - mp_max: number = 100; - mp_base: number = 100; + mp: number = 100; hp: number = 100; /** 血量 */ - hp_max: number = 100; /** 最大血量 */ - hp_base:number=100; /** 基础最大血量 */ shield:number=0; //当前护甲值 - shield_max:number=0; //最大护甲值 - ap: number = 10; /**攻击力 */ - ap_base:number=0; - // atk_speed: number = 1; - cd: number = 1.3; /**攻击速度 攻击间隔 */ - def: number = 0; //防御 - dmg_red:number=0//免伤 - dis: number = 80; - skills:any[]=[] - puncture:number=0; //穿刺敌人伤害后方敌人个数 - puncture_damage:number=0; //后伤害加成 - burn: number = 0; //易伤 伤害加成 - stun_time:number=0; //眩晕加成 - stun_ratio:number=0; //攻击眩晕概率加成 - stun_no:boolean=false; //眩晕免疫 - dod: number = 0; //闪避率 - dod_no:boolean=false; - crit:number=0; //暴击率 - crit_no:boolean=false; //暴击免疫 - crit_d:number=0; //暴击伤害 - wfuny:number=0; //风怒概率 - frost_ratio:number=0; //冰冻概率 - frost_time:number=0; //冰冻时间 - frost_no:boolean=false; //冰冻免疫 - knockback:number=0; //击退概率 - knockback_no:boolean=false; //击退免疫 - reflect:number=0; //反射伤害比率 - lifesteal:number=0; //吸血比率 - skill_dmg:number=0 - debuff_down:number=0 - - - - Attrs:any=getBuffNum() - debuff_status:any=geDebuffNum() +/** 基础属性 有初始值的基础属性,后续Attrs 属性计算时用到*/ + base_ap: number = 0; //基础攻击力 + base_map: number = 0; + base_def: number = 5; + base_hp: number = 100; + base_mp: number = 100; + Attrs:any=[] + //数值型debuff + V_DBUFF:any[]=[] //持久 + V_DBUFFS:any[]=[] //临时 带时间 + //百分比型debuff + R_DBUFF:any[]=[] //持久 + R_DBUFFS:any[]=[] //临时 带时间 + //数值型buff + V_BUFF:any[]=[] //持久 + V_BUFFS:any[]=[] //临时 带时间 + //百分比型buff + R_BUFF:any[]=[] //持久 + R_BUFFS:any[]=[] //临时 带时间 atk_count: number = 0; atked_count: number = 0; - stop_cd: number = 0; /*停止倒计时*/ speek_time:number = 0; - BUFFS:Array<{value: number, duration: number,type:number}> = [] //buff - - DEBUFF_BURNS: Array<{value: number, duration: number}> = [] //易伤 - DEBUFF_DEATKS: Array<{value: number, duration: number}> = [] //减攻击 - DEBUFF_DECDS: Array<{value: number, duration: number}> = [] //减攻击速度 - - DEBUFF_SLOW: number = 0; //减速 - DEBUFF_FROST: number = 0; //冰冻 - DEBUFF_STUN: number = 0; //眩晕 - - DEBUFF_VALUE:number=0; //debuff 增益值 - DEBUFF_COUNT:number=0; //debuff 持续次数 - DEBUFF_UP:number=0; //debuff 概率提升 - @@ -118,9 +80,6 @@ export class HeroViewComp extends CCComp { }> = []; private isProcessingDamage: boolean = false; private damageInterval: number = 0.01; // 伤害数字显示间隔 - - private timer:Timer=new Timer(1); - onLoad() { this.as = this.getComponent(HeroSpine); //console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON) @@ -145,7 +104,7 @@ export class HeroViewComp extends CCComp { } /* 显示角色血量 */ this.node.getChildByName("top").getChildByName("hp").active = true; - this.BUFFCOMP.show_shield(this.shield,this.shield_max) + this.BUFFCOMP.show_shield(this.shield,this.Attrs[Attrs.SHIELD_MAX]) } update(dt: number){ @@ -155,14 +114,8 @@ export class HeroViewComp extends CCComp { // return // } this.BaseUp(dt) - if(this.DEBUFF_FROST > 0){ - this.DEBUFF_FROST -=dt; - } - if(this.DEBUFF_STUN > 0){ - this.DEBUFF_STUN -=dt; - } + // 更新所有按时间减少的buff和debuff - this.updateBuffsAndDebuffs(dt); this.in_stop(dt); // 处理伤害队列 this.processDamageQueue(); @@ -171,22 +124,15 @@ export class HeroViewComp extends CCComp { BaseUp(dt:number){ this.mp += HeroUpSet.MP*dt this.hp += HeroUpSet.HP*dt - if(this.mp > this.mp_max) this.mp = this.mp_max - if(this.hp > this.hp_max) this.hp = this.hp_max + if(this.mp > this.Attrs[Attrs.MP_MAX]) this.mp = this.Attrs[Attrs.MP_MAX] + if(this.hp > this.Attrs[Attrs.HP_MAX]) this.hp = this.Attrs[Attrs.HP_MAX] } do_fight_end(){ this.as.do_buff() } - get isActive() { return this.ent.has(HeroViewComp) && this.node?.isValid; } - - - - hide_info(){ - - } //状态切换 status_change(type:string){ this.status=type @@ -199,17 +145,15 @@ export class HeroViewComp extends CCComp { // this.as.change_default("move") } } - add_shield(shield:number){ - this.shield = this.shield_max +=shield - if(this.shield>0) this.BUFFCOMP.show_shield(this.shield,this.shield_max) + this.shield = this.Attrs[Attrs.SHIELD_MAX] +=shield + if(this.shield>0) this.BUFFCOMP.show_shield(this.shield,this.Attrs[Attrs.SHIELD_MAX]) } - - add_hp(hp: number = 0,is_num:boolean=true) { + health(hp: number = 0,is_num:boolean=true) { this.BUFFCOMP.heathed(); let real_hp=0 - let hp_max=this.hp_max + let hp_max=this.Attrs[Attrs.HP_MAX] let lost_hp=hp_max-this.hp if(is_num){ if(lost_hp > hp){ @@ -228,30 +172,20 @@ export class HeroViewComp extends CCComp { this.hp+=real_hp; this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0)); } - this.BUFFCOMP.hp_show(this.hp,this.hp_max) + this.BUFFCOMP.hp_show(this.hp,this.Attrs[Attrs.HP_MAX]) // this.update_vm } /** 静止时间 */ in_stop (dt: number) { - if(this.stop_cd > 0){ - this.stop_cd -= dt; - if(this.stop_cd <= 0){ - this.stop_cd = 0; - this.is_atking = false; - } - } + } count_atk_count(){ //主将攻击 if(this.fac==FacSet.MON) return this.atk_count+=1 } - - - - do_dead(){ this.do_dead_trigger() //console.log("[HeroViewComp]:角色死亡",this.hero_uuid) @@ -278,132 +212,7 @@ export class HeroViewComp extends CCComp { do_drop(){ } - add_debuff(type:number,deV:number,deC:number,deR:number){ - let n_deR=deR-this.Attrs[BuffAttr.DEBUFF_DOWN] - let r=RandomManager.instance.getRandomInt(0,100) // 随机数 - //console.log("[HeroViewComp]:类型,值,次数,技能概率,实际概率,随机数",type,deV,deC,deR,n_deR,r) - if(r < n_deR) { - // this.BUFFCOMP.tooltip(TooltipTypes.uskill,"*抵抗*") - return - } - switch(type){ - case DebuffAttr.BURN: - this.DEBUFF_BURNS.push({value:deV,duration:deC+FightSet.BURN_COUNT}) - break - case DebuffAttr.DECD: - this.DEBUFF_DECDS.push({value:deV,duration:deC}) - break - case DebuffAttr.SLOW: - this.DEBUFF_SLOW+=deV - break - case DebuffAttr.FROST: - this.BUFFCOMP.in_iced(deV) - this.DEBUFF_FROST+=deV - break - case DebuffAttr.STUN: - if(this.DEBUFF_STUN>0) return - this.skills[0].cd=0 // 眩晕 cd归零 - this.BUFFCOMP.in_yun(deV+FightSet.STUN_TIME) // 眩晕时间 - this.DEBUFF_STUN+=deV+FightSet.STUN_TIME // 眩晕时间 - // this.is_stop=true - break - case DebuffAttr.DEHP: - this.Attrs[BuffAttr.HP_MAX]-=deV - this.hp_max=Math.floor(this.hp_base*(100+this.Attrs[BuffAttr.HP_MAX])) - if(this.hp-this.hp_max>0) this.hp=this.hp_max - break - case DebuffAttr.DEATK: //99为具体数字 并且局内永久生效,其他为百分比 - if(deC == 99){ - this.ap-=deV - }else{ - this.DEBUFF_DEATKS.push({value:deV,duration:deC}) - } - break - case DebuffAttr.DECOUNT: - this.atk_count-=deV - if(this.atk_count<0) this.atk_count=1 - break - case DebuffAttr.BACK: - if(this.fac==FacSet.MON) { - let tx=this.node.position.x+50 - if(tx > 320) tx=320 - tween(this.node).to(0.3, { position:v3(tx,this.node.position.y,0)}).start() - } - break - } - //console.log("[HeroViewComp]:debuffs",type,deV,deC,deR,this.DEBUFF_BURNS) - } - - // 更新所有按时间减少的buff和debuff - updateBuffsAndDebuffs(dt: number) { - // 更新BUFFS - for(let i = this.BUFFS.length - 1; i >= 0; i--) { - this.BUFFS[i].duration -= dt; - if(this.BUFFS[i].duration <= 0) { - this.apply_buff(this.BUFFS[i].type,-this.BUFFS[i].value) - this.BUFFS.splice(i, 1); - } - } - - // 更新DEBUFF_BURNS - for(let i = this.DEBUFF_BURNS.length - 1; i >= 0; i--) { - this.DEBUFF_BURNS[i].duration -= dt; - if(this.DEBUFF_BURNS[i].duration <= 0) { - this.DEBUFF_BURNS.splice(i, 1); - } - } - - // 更新DEBUFF_DEATKS - for(let i = this.DEBUFF_DEATKS.length - 1; i >= 0; i--) { - this.DEBUFF_DEATKS[i].duration -= dt; - if(this.DEBUFF_DEATKS[i].duration <= 0) { - this.DEBUFF_DEATKS.splice(i, 1); - } - } - - // 更新DEBUFF_DECDS - for(let i = this.DEBUFF_DECDS.length - 1; i >= 0; i--) { - this.DEBUFF_DECDS[i].duration -= dt; - if(this.DEBUFF_DECDS[i].duration <= 0) { - this.DEBUFF_DECDS.splice(i, 1); - } - } - } - - add_buff(buff:number,duration:number,type:number){ - if(this.BUFFS.find(b=>b.type==type)) { - if(this.BUFFS.find(b=>b.type==type).valueb.type==type).value - this.BUFFS.find(b=>b.type==type).value=buff - this.BUFFS.find(b=>b.type==type).duration=duration - this.apply_buff(type,dis_buff_value) - } - }else{ - this.BUFFS.push({value:buff,duration:duration,type:type}) - this.apply_buff(type,buff) - } - } - // 应用buff,有基础值的需要特殊处理,其他的直接加减 - apply_buff(buff_type:number,buff_value:number){ - console.log("[HeroViewComp]:apply_buff",buff_type,buff_value) - switch(buff_type){ - case BuffAttr.ATK: //攻击百分比 - this.Attrs[BuffAttr.AP]+=Math.floor(buff_value/100*this.ap) - break - case BuffAttr.ATK_CD: //攻击速度百分比 - this.Attrs[BuffAttr.ATK_CD]+=buff_value/100*this.cd - break - case BuffAttr.HP_MAX: //血量百分比 - this.Attrs[BuffAttr.HP_MAX]+=buff_value - this.hp_max=Math.floor(this.hp_base*(100+this.Attrs[BuffAttr.HP_MAX])) - if(this.hp-this.hp_max>0) this.hp=this.hp_max - break - default: - this.Attrs[buff_type]+=buff_value - break - } - } do_atked(remainingDamage:number, crit:number=0,crit_d:number=0, burn_count:number=0,burn_value:number=0, @@ -412,13 +221,8 @@ export class HeroViewComp extends CCComp { atked_anm:string="atked" ){ this.do_atked_trigger() - if(burn_count>0){ - this.add_debuff(DebuffAttr.BURN,burn_value,burn_count,100) - } - if(stun_time>0){ - this.add_debuff(DebuffAttr.STUN,stun_time,1,stun_ratio) - } - + + if(this.check_dodge()) return let is_crit = this.check_crit(crit) @@ -469,10 +273,8 @@ export class HeroViewComp extends CCComp { } //伤害计算 debuff 易伤 count_damage(remainingDamage:number){ - let min =remainingDamage*0.2 - let damage=(remainingDamage-this.dmg_red)*(100-this.def+this.burn)/100 - ////console.log("[HeroViewComp]:最终伤害,敌人伤害值,免伤,防御,易伤",damage,remainingDamage,buff_def,def,Burn) - return Math.floor(Math.max(damage,min)) + + return remainingDamage } check_shield(damage:number){ @@ -481,23 +283,23 @@ export class HeroViewComp extends CCComp { this.shield -= damage this.BUFFCOMP.tooltip(TooltipTypes.uskill,"*吸收*"); if(this.shield <= 0){ - this.shield=this.shield_max=0 + this.shield=this.Attrs[Attrs.SHIELD_MAX]=0 } damage = 0 } if(this.shield < damage){ damage=damage-this.shield this.shield=0 - this.shield_max=0 + this.Attrs[Attrs.SHIELD_MAX]=0 } - this.BUFFCOMP.show_shield(this.shield,this.shield_max) + this.BUFFCOMP.show_shield(this.shield,this.Attrs[Attrs.SHIELD_MAX]) return damage } check_dodge(){ - if(this.dod > 0){ + if(this.Attrs[Attrs.DODGE] > 0){ let random = Math.random()*100 - if(random < this.dod) { + if(random < this.Attrs[Attrs.DODGE]) { this.BUFFCOMP.tooltip(TooltipTypes.uskill,"*闪避*"); return true } @@ -506,7 +308,6 @@ export class HeroViewComp extends CCComp { } check_crit(crit:number=0){ - if(this.crit_no) return false if(crit > 0){ let random = Math.random()*100 if(random < crit) { @@ -609,7 +410,7 @@ export class HeroViewComp extends CCComp { /** 立即显示伤害效果 */ private showDamageImmediate(damage: number, isCrit: boolean,anm:string="atked") { // this.as.atked() - this.BUFFCOMP.hp_show(this.hp,this.Attrs[BuffAttr.HP_MAX]) + this.BUFFCOMP.hp_show(this.hp,this.Attrs[Attrs.HP_MAX]) this.BUFFCOMP.in_atked(anm,this.fac==FacSet.HERO?1:-1) this.atked_count++; if (isCrit) { diff --git a/assets/script/game/hero/SkillConComp.ts b/assets/script/game/hero/SkillConComp.ts index b34bffef..a01c909f 100644 --- a/assets/script/game/hero/SkillConComp.ts +++ b/assets/script/game/hero/SkillConComp.ts @@ -1,6 +1,6 @@ import { _decorator, Component, Node, ProgressBar, v3, Vec3 } from 'cc'; import { HeroViewComp } from './HeroViewComp'; -import { BuffAttr,SKILL_CONST, SkillSet, SType, TGroup, } from '../common/config/SkillSet'; +import { Attrs, SkillSet, SType, TGroup, } from '../common/config/SkillSet'; import { ecs } from 'db://oops-framework/libs/ecs/ECS'; import { GameEvent } from '../common/config/GameEvent'; import { FacSet } from '../common/config/BoxSet'; @@ -102,7 +102,7 @@ export class SkillConComp extends CCComp { check_wfuny(){ let random = Math.random()*100 - if(random < this.HeroView.Attrs[BuffAttr.WFUNY]){ + if(random < this.HeroView.Attrs[Attrs.WFUNY]){ return true } return false @@ -160,11 +160,7 @@ export class SkillConComp extends CCComp { Object.values(this._timers).forEach(clearTimeout); } - get_count(count:number,view:HeroViewComp){ - let re=count+view.wfuny - if(re<1) re=1 - return re - } + reset() { this.clear_timer(); } diff --git a/assets/script/game/skill/AtkConCom.ts b/assets/script/game/skill/AtkConCom.ts index 0b8475eb..43e59dd1 100644 --- a/assets/script/game/skill/AtkConCom.ts +++ b/assets/script/game/skill/AtkConCom.ts @@ -2,7 +2,7 @@ import { _decorator, Animation, CCBoolean, Collider2D, Contact2DType, Tween, v3, import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { BezierMove } from "../BezierMove/BezierMove"; -import { AType, BuffAttr, DTType, EType, SkillSet, SType, TGroup } from "../common/config/SkillSet"; +import { DTType, EType, SkillSet, SType } from "../common/config/SkillSet"; import { BoxSet, FacSet } from "../common/config/BoxSet"; import { HeroViewComp } from "../hero/HeroViewComp"; import { GameEvent } from "../common/config/GameEvent"; @@ -25,44 +25,29 @@ export class AtkConCom extends CCComp { targetPos: Vec3 = v3(); // 目标位置 group:number = 0; //阵营 fac:number=0; //阵营 + run_time:number = 0; // 战斗相关运行时数据 - ap:number=0; - burn_count:number=0; - burn_value:number=0; - stun_time:number=0; - stun_ratio:number=0; - frost_ratio:number=0; - frost_time:number=0; - run_time:number=0; - hited_time:number=0; - hit_count:number=0; - caster_crit:number=0; - caster_crit_d:number=0; - puncture:number=0; - puncture_damage:number=0; - debuff_up:number=0; - debuff_value:number=0; - debuff_count:number=0; + Attrs:any=null // 组件引用 anim:Animation=null; tweenInstance:Tween = null; private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向 // 缓存的配置对象(避免重复查找) - public skillConfig: any = null; + public Config: any = null; private isInitialized: boolean = false; - private initializeSkillConfig() { + private initializeConfig() { if (this.isInitialized) return; // 缓存技能配置,避免重复查找 - this.skillConfig = SkillSet[this.s_uuid]; - if (!this.skillConfig) { + this.Config = SkillSet[this.s_uuid]; + if (!this.Config) { // console.error("[SkillCom] 技能配置不存在:", this.s_uuid); return; } this.isInitialized = true; - // console.log("[SkillCom] 技能配置初始化完成:", this.s_uuid, this.skillConfig.name); + // console.log("[SkillCom] 技能配置初始化完成:", this.s_uuid, this.Config.name); } start() { - this.initializeSkillConfig(); + this.initializeConfig(); // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 // this.on(ModuleEvent.Cmd, this.onHandler, this); @@ -122,10 +107,10 @@ export class AtkConCom extends CCComp { onAnimationFinished(){ // console.log("[SkillCom]:onAnimationFinished",this.s_uuid) - if (!this.skillConfig) return; + if (!this.Config) return; - if(this.skillConfig.EType==EType.timeEnd) return - if(this.skillConfig.SType!=SType.damage){ + if(this.Config.EType==EType.timeEnd) return + if(this.Config.SType!=SType.damage){ } this.is_destroy=true @@ -136,9 +121,9 @@ export class AtkConCom extends CCComp { let target = oCol.getComponent(HeroViewComp) if(oCol.group!=this.group){ if(target == null) return; - if (!this.skillConfig) return; + if (!this.Config) return; // console.log("[SkillCom]:onBeginContact oCol||seCol",oCol.node.position,seCol.node.position) - this.single_damage(target,this.skillConfig.DTType==DTType.range?true:false) + this.single_damage(target,this.Config.DTType==DTType.range?true:false) // this.ent.destroy() } } @@ -147,36 +132,36 @@ export class AtkConCom extends CCComp { // //console.log("[SkillCom]:onBeginContact hit_count:",this.hit_count,SkillSet[this.s_uuid].hit) // if(this.hit_count > 0&&!is_range) this.ap=this.ap*(50+this.puncture_damage)/100 // 穿刺后 伤害减半,过滤范围伤害 if(target == null) return; - if (!this.skillConfig) return; - let ap=this.ap - if(this.hit_count > 0 &&!is_range ){ - ap=ap*(50+this.puncture_damage)/100 - } - target.do_atked(ap,this.caster_crit,this.caster_crit_d, - this.burn_count,this.burn_value, - this.stun_time,this.stun_ratio, - this.frost_time,this.frost_ratio, - this.skillConfig.AtkedType - ) // ap 及暴击 属性已经在skill.ts 处理 - // console.log("[SkillCom]:single_damage t:tp:rtp",this.node.position,this.targetPos,target.node.position) - if(this.skillConfig.debuff>0){ - let debuff=this.skillConfig - let dev=debuff.deV*(100+this.debuff_value)/100 - let deR=debuff.deR+this.debuff_up - dev=Math.round(dev*100)/100 - let deC=debuff.deC+this.debuff_count //dec只作为次数叠加 - // //console.log("[SkillCom]:debuff",this.skillConfig.name,debuff.debuff,deUP.deV,deUP.deC) - target.add_debuff(debuff.debuff,dev,deC,deR) - } - this.hit_count++ - // console.log("[SkillCom]:碰撞次数:技能次数:穿刺次数",this.hit_count,this.skillConfig.hit,this.puncture) - if(this.hit_count>=(this.skillConfig.hit+this.puncture)&&(this.skillConfig.DTType!=DTType.range)&&(this.skillConfig.EType!=EType.animationEnd)&&(this.skillConfig.EType!=EType.timeEnd)) this.is_destroy=true // 技能命中次数 + if (!this.Config) return; + // let ap=this.ap + // if(this.hit_count > 0 &&!is_range ){ + // ap=ap*(50+this.puncture_damage)/100 + // } + // target.do_atked(ap,this.caster_crit,this.caster_crit_d, + // this.burn_count,this.burn_value, + // this.stun_time,this.stun_ratio, + // this.frost_time,this.frost_ratio, + // this.Config.AtkedType + // ) // ap 及暴击 属性已经在skill.ts 处理 + // // console.log("[SkillCom]:single_damage t:tp:rtp",this.node.position,this.targetPos,target.node.position) + // if(this.Config.debuff>0){ + // let debuff=this.Config + // let dev=debuff.deV*(100+this.debuff_value)/100 + // let deR=debuff.deR+this.debuff_up + // dev=Math.round(dev*100)/100 + // let deC=debuff.deC+this.debuff_count //dec只作为次数叠加 + // // //console.log("[SkillCom]:debuff",this.Config.name,debuff.debuff,deUP.deV,deUP.deC) + // target.add_debuff(debuff.debuff,dev,deC,deR) + // } + // this.hit_count++ + // // console.log("[SkillCom]:碰撞次数:技能次数:穿刺次数",this.hit_count,this.Config.hit,this.puncture) + // if(this.hit_count>=(this.Config.hit+this.puncture)&&(this.Config.DTType!=DTType.range)&&(this.Config.EType!=EType.animationEnd)&&(this.Config.EType!=EType.timeEnd)) this.is_destroy=true // 技能命中次数 } update(deltaTime: number) { // 确保配置已初始化(处理 update 可能先于 start 执行的情况) if (!this.isInitialized) { - this.initializeSkillConfig(); - if (!this.skillConfig) return; + this.initializeConfig(); + if (!this.Config) return; } if(smc.mission.pause) { @@ -186,9 +171,9 @@ export class AtkConCom extends CCComp { if(this.anim) this.anim.resume() if (!this.node || !this.node.isValid) return; - if(this.skillConfig.EType==EType.timeEnd){ + if(this.Config.EType==EType.timeEnd){ this.run_time+=deltaTime - if(this.run_time>this.skillConfig.in){ + if(this.run_time>this.Config.in){ // //console.log("[SkillCom]: timeEnd destroy",this.s_uuid,this.run_time) this.is_destroy=true } diff --git a/assets/script/game/skill/SkillEnt.ts b/assets/script/game/skill/SkillEnt.ts index dbeb18a1..b7321d85 100644 --- a/assets/script/game/skill/SkillEnt.ts +++ b/assets/script/game/skill/SkillEnt.ts @@ -1,6 +1,6 @@ import { instantiate, Node, Prefab, v3, Vec3 } from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BuffAttr, SkillSet } from "../common/config/SkillSet"; +import { Attrs, SkillSet } from "../common/config/SkillSet"; import { oops } from "db://oops-framework/core/Oops"; import { smc } from "../common/SingletonModuleComp"; import { FacSet } from "../common/config/BoxSet"; @@ -60,21 +60,9 @@ load(startPos: Vec3, parent: Node, uuid: number, targetPos: any[], caster:Hero group: caster.box_group, fac: caster.fac, // 技能数值 - ap: caster.Attrs[BuffAttr.AP], + ap: caster.Attrs[Attrs.AP], caster: caster, - caster_crit: caster.Attrs[BuffAttr.CRITICAL], - caster_crit_d: caster.Attrs[BuffAttr.CRITICAL_DMG], - puncture: caster.Attrs[BuffAttr.PUNCTURE], - puncture_damage: caster.Attrs[BuffAttr.PUNCTURE_DMG], - burn_count: caster.Attrs[BuffAttr.BURN_COUNT], - burn_value: caster.Attrs[BuffAttr.BURN_VALUE], - stun_time: caster.Attrs[BuffAttr.STUN_TIME], - stun_ratio: caster.Attrs[BuffAttr.STUN_RATIO], - frost_time: caster.Attrs[BuffAttr.FROST_TIME], - frost_ratio: caster.Attrs[BuffAttr.FROST_RATIO], - debuff_up: caster.Attrs[BuffAttr.DEBUFF_UP], - debuff_value: caster.Attrs[BuffAttr.DEBUFF_VALUE], - debuff_count: caster.Attrs[BuffAttr.DEBUFF_COUNT], + }); this.add(SComp); } diff --git a/assets/script/game/skill/SkillViewCom.ts b/assets/script/game/skill/SkillViewCom.ts index ce3c5283..9d58fa2d 100644 --- a/assets/script/game/skill/SkillViewCom.ts +++ b/assets/script/game/skill/SkillViewCom.ts @@ -2,7 +2,7 @@ import { _decorator, CCBoolean, CCInteger, instantiate, Node, Prefab, v3, Vec3 } import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { HeroViewComp } from "../hero/HeroViewComp"; -import { BuffAttr, RType, SkillSet } from "../common/config/SkillSet"; +import { getAttrs, RType, SkillSet } from "../common/config/SkillSet"; import { AtkConCom } from "./AtkConCom"; import { BoxSet } from "../common/config/BoxSet"; @@ -43,23 +43,7 @@ export class SkillViewCom extends CCComp { group:0 fac: 0 // 战斗相关运行时数据 - ap:number=0; - burn_count:number=0; - burn_value:number=0; - stun_time:number=0; - stun_ratio:number=0; - frost_ratio:number=0; - frost_time:number=0; - run_time:number=0; - hited_time:number=0; - hit_count:number=0; - caster_crit:number=0; - caster_crit_d:number=0; - puncture:number=0; - puncture_damage:number=0; - debuff_up:number=0; - debuff_value:number=0; - debuff_count:number=0; + Attrs:any=null targetPos:any[]=null start() { // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 @@ -126,20 +110,8 @@ export class SkillViewCom extends CCComp { group: this.group, fac: this.fac, // 技能数值 - ap: this.ap, - caster_crit: this.caster_crit, - caster_crit_d: this.caster_crit_d, - puncture: this.puncture, - puncture_damage: this.puncture_damage, - burn_count: this.burn_count, - burn_value: this.burn_value, - stun_time: this.stun_time, - stun_ratio: this.stun_ratio, - frost_time: this.frost_time, - frost_ratio: this.frost_ratio, - debuff_up: this.debuff_up, - debuff_value: this.debuff_value, - debuff_count: this.debuff_count, + Attrs:this.Attrs + }); switch(this.runType){ case RType.linear: