refactor: 移除眩晕机制并简化buff系统
- 删除眩晕相关属性、状态检查及动画触发 - 移除BType枚举,简化BuffConf结构,所有buff改为固定值类型 - 清理未使用的导入和配置项,包括debuffs数组和多个英雄属性 - 简化暴击伤害计算,移除施法者暴击伤害加成 - 重构冰冻状态检查逻辑,添加frost_end_time字段
This commit is contained in:
@@ -1,14 +1,4 @@
|
||||
|
||||
/**
|
||||
* Buff类型枚举
|
||||
* VALUE: 数值型 - 直接加减数值
|
||||
* RATIO: 百分比型 - 按百分比计算
|
||||
*/
|
||||
export enum BType {
|
||||
VALUE = 0, //数值型
|
||||
RATIO = 1, //百分比型
|
||||
BOOLEAN = 2, // 布尔型
|
||||
}
|
||||
|
||||
// ========== 属性枚举 ==========
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ========== 从 HeroAttrs.ts 导入属性相关定义 ==========
|
||||
import { Attrs,BType } from "./HeroAttrs";
|
||||
import { Attrs } from "./HeroAttrs";
|
||||
|
||||
export enum HSSet {
|
||||
atk = 0, // 普通攻击
|
||||
@@ -126,12 +126,10 @@ export interface BuffConf {
|
||||
name?:string; // Buff名称
|
||||
icon?:string; // Buff图标
|
||||
buff:Attrs;
|
||||
BType:BType
|
||||
value:number; // 效果值
|
||||
time:number; // 持续时间
|
||||
chance:number; // 触发概率
|
||||
info?:string; // 描述
|
||||
isDebuff?:boolean; // 是否为负面效果
|
||||
runType?:BuffRunType;
|
||||
interval?:number;
|
||||
}
|
||||
@@ -182,7 +180,6 @@ export interface SkillConfig {
|
||||
bck?:number, // 额外击退概率
|
||||
slw?:number, // 额外减速概
|
||||
buffs:number[], // 对施法者的buff配置列表(Buff UUID 列表)
|
||||
debuffs:number[], // 对目标的debuff配置列表(Buff UUID 列表)
|
||||
call_hero?:number, // 召唤技能召唤英雄id(可选)
|
||||
info:string, // 技能描述
|
||||
}
|
||||
@@ -193,99 +190,99 @@ export const SkillSet: Record<number, SkillConfig> = {
|
||||
uuid:6001,name:"空挥",sp_name:"atk_s1",icon:"1026",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方目标造成100%攻击的伤害",
|
||||
},
|
||||
6002: {
|
||||
uuid:6002,name:"电击",sp_name:"atk_s4",icon:"1173",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"blues",endAnm:"",act:"max",DTType:DTType.single,
|
||||
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方目标造成150%攻击的伤害",
|
||||
buffs:[],info:"对前方目标造成150%攻击的伤害",
|
||||
},
|
||||
6003: {
|
||||
uuid:6003,name:"闪击",sp_name:"atk_s3",icon:"1173",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"blues",endAnm:"",act:"max",DTType:DTType.single,
|
||||
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
buffs:[],debuffs:[],info:"对前方目标造成150%攻击的伤害",
|
||||
buffs:[],info:"对前方目标造成150%攻击的伤害",
|
||||
},
|
||||
6004: {
|
||||
uuid:6004,name:"火焰击",sp_name:"atk_f2",icon:"1173",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"reds",endAnm:"",act:"max",DTType:DTType.single,
|
||||
ap:100,hit_count:6,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
buffs:[],debuffs:[],info:"对前方目标造成150%攻击的伤害",
|
||||
buffs:[],info:"对前方目标造成150%攻击的伤害",
|
||||
},
|
||||
6005: {
|
||||
uuid:6005,name:"蓝箭",sp_name:"arrow_blue",icon:"1135",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6006: {
|
||||
uuid:6006,name:"绿箭",sp_name:"arrow_green",icon:"1135",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6007: {
|
||||
uuid:6007,name:"红箭",sp_name:"arrow_red",icon:"1135",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6008: {
|
||||
uuid:6008,name:"光箭",sp_name:"arrow_big_yellow",icon:"1135",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"reds",endAnm:"",act:"max",DTType:DTType.single,
|
||||
ap:100,hit_count:6,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6009: {
|
||||
uuid:6009,name:"冰球",sp_name:"ball_ice",icon:"1126",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:2,hitcd:0.3,speed:720,with:90,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6010: {
|
||||
uuid:6010,name:"冰锥",sp_name:"ball_forst",icon:"1126",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:2,hitcd:0.3,speed:720,with:90,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6011: {
|
||||
uuid:6011,name:"火球",sp_name:"ball_fire",icon:"1126",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:2,hitcd:0.3,speed:720,with:90,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6012: {
|
||||
uuid:6012,name:"光波",sp_name:"ball_guang",icon:"1126",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:2,hitcd:0.3,speed:720,with:90,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6013: {
|
||||
uuid:6013,name:"半月波",sp_name:"ball_light",icon:"1126",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:2,hitcd:0.3,speed:720,with:90,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
6014: {
|
||||
uuid:6014,name:"月波",sp_name:"ball_gquan",icon:"1126",TGroup:TGroup.Enemy,TType:TType.Frontline,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:100,hit_count:2,hitcd:0.3,speed:720,with:90,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.linear,EType:EType.collision,
|
||||
buffs:[],debuffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
buffs:[],info:"对前方单个目标造成100%攻击的伤害",
|
||||
},
|
||||
|
||||
//============================= ====== 基础buff ====== ========================== 6100-6199
|
||||
//============================= ====== 辅助技能 ====== ========================== 6100-6199
|
||||
6100:{
|
||||
uuid:6100,name:"魔法盾",sp_name:"buff_wind",icon:"1255",TGroup:TGroup.Self,TType:TType.LowestHP,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:30,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
kind:SkillKind.Shield,buffs:[],debuffs:[],info:"获得30%最大生命值的护盾,持续60秒",
|
||||
kind:SkillKind.Shield,buffs:[],info:"获得30%最大生命值的护盾,持续60秒",
|
||||
},
|
||||
6101: {
|
||||
uuid:6101,name:"治疗",sp_name:"buff_wind",icon:"1292",TGroup:TGroup.Self,TType:TType.LowestHP,readyAnm:"",endAnm:"",act:"atk",DTType:DTType.single,
|
||||
ap:30,hit_count:1,hitcd:0.2,speed:720,with:0,
|
||||
ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd,
|
||||
kind:SkillKind.Heal,buffs:[],debuffs:[],info:"治疗自己,回复30%最大生命值",
|
||||
kind:SkillKind.Heal,buffs:[],info:"治疗自己,回复30%最大生命值",
|
||||
},
|
||||
|
||||
// ========== 怪物基础技能 ========== 6200-6299
|
||||
@@ -294,14 +291,14 @@ export const SkillSet: Record<number, SkillConfig> = {
|
||||
TGroup:TGroup.Enemy, TType:TType.Frontline, readyAnm:"",endAnm:"",act:"atk", DTType:DTType.single,
|
||||
ap:100, hit_count:1, hitcd:0.2, speed:0, with:0, // 怪物近战特殊距离
|
||||
ready:0, EAnm:0, DAnm:9001, RType:RType.fixed, EType:EType.animationEnd,
|
||||
buffs:[], debuffs:[], info:"怪物基础近战攻击",
|
||||
buffs:[], info:"怪物基础近战攻击",
|
||||
},
|
||||
6203: {
|
||||
uuid:6203, name:"怪物射击", sp_name:"arrow_1", icon:"3039",
|
||||
TGroup:TGroup.Enemy, TType:TType.Frontline, readyAnm:"",endAnm:"",act:"atk", DTType:DTType.single,
|
||||
ap:80, hit_count:1, hitcd:0.2, speed:800, with:0, // 怪物远程特殊距离
|
||||
ready:0, EAnm:0, DAnm:9001, RType:RType.linear, EType:EType.collision,
|
||||
buffs:[], debuffs:[], info:"怪物基础远程攻击",
|
||||
buffs:[], info:"怪物基础远程攻击",
|
||||
},
|
||||
|
||||
};
|
||||
@@ -331,55 +328,15 @@ export const CanSelectSkills: Record<number, number[]> = {
|
||||
export const BuffsList: Record<number, BuffConf> = {
|
||||
// ========== 攻击类增益 ========== 10001 - 10099
|
||||
// 攻击力提升 (固定值)
|
||||
10001: { uuid: 10001, name: "攻击提升", icon: "10001", buff: Attrs.ap, BType: BType.VALUE, value: 10, time: 5, chance: 1, info: "攻击力+10" },
|
||||
10002: { uuid: 10002, name: "攻击提升", icon: "10002", buff: Attrs.ap, BType: BType.VALUE, value: 50, time: 5, chance: 1, info: "攻击力+50" },
|
||||
|
||||
// 攻击力提升 (百分比)
|
||||
10011: { uuid: 10011, name: "攻击提升", icon: "10011", buff: Attrs.ap, BType: BType.RATIO, value: 10, time: 5, chance: 1, info: "攻击力+10%" },
|
||||
10012: { uuid: 10012, name: "攻击提升", icon: "10012", buff: Attrs.ap, BType: BType.RATIO, value: 20, time: 10, chance: 1, info: "攻击力+20%" },
|
||||
10001: { uuid: 10001, name: "攻击提升", icon: "10001", buff: Attrs.ap, value: 10, time: 5, chance: 1, info: "攻击力+10" },
|
||||
10002: { uuid: 10002, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 50, time: 5, chance: 1, info: "攻击力+50" },
|
||||
|
||||
// 暴击率提升 (固定值)
|
||||
10021: { uuid: 10021, name: "暴击提升", icon: "10021", buff: Attrs.critical, BType: BType.VALUE, value: 10, time: 5, chance: 1, info: "暴击率+10%" },
|
||||
10022: { uuid: 10022, name: "暴击提升", icon: "10022", buff: Attrs.critical, BType: BType.VALUE, value: 20, time: 5, chance: 1, info: "暴击率+20%" },
|
||||
|
||||
// 暴击伤害提升
|
||||
10031: { uuid: 10031, name: "爆伤提升", icon: "10031", buff: Attrs.critical_dmg, BType: BType.VALUE, value: 50, time: 5, chance: 1, info: "暴击伤害+50%" },
|
||||
|
||||
// 穿刺次数提升
|
||||
10041: { uuid: 10041, name: "穿刺提升", icon: "10041", buff: Attrs.puncture, BType: BType.VALUE, value: 1, time: 10, chance: 1, info: "穿刺次数+1" },
|
||||
|
||||
// ========== 生存类增益 ========== 10100 - 10199
|
||||
// 生命值上限提升 (百分比)
|
||||
10101: { uuid: 10101, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, BType: BType.RATIO, value: 20, time: 10, chance: 1, info: "生命上限+20%" },
|
||||
10101: { uuid: 10101, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 20, time: 10, chance: 1, info: "生命上限+20%" },
|
||||
|
||||
// 移动速度提升 (固定值)
|
||||
10111: { uuid: 10111, name: "移速提升", icon: "10111", buff: Attrs.speed, BType: BType.VALUE, value: 50, time: 5, chance: 1, info: "移速+50" },
|
||||
10112: { uuid: 10112, name: "移速提升", icon: "10112", buff: Attrs.speed, BType: BType.VALUE, value: 100, time: 5, chance: 1, info: "移速+100" },
|
||||
10111: { uuid: 10111, name: "移速提升", icon: "10111", buff: Attrs.speed, value: 50, time: 5, chance: 1, info: "移速+50" },
|
||||
10112: { uuid: 10112, name: "移速提升", icon: "10112", buff: Attrs.speed, value: 100, time: 5, chance: 1, info: "移速+100" },
|
||||
|
||||
// 护盾 (固定值)
|
||||
10121: { uuid: 10121, name: "护盾", icon: "10121", buff: Attrs.shield, BType: BType.VALUE, value: 100, time: 10, chance: 1, info: "护盾+100" },
|
||||
|
||||
// ========== 治疗与护盾 (转换自原 SType) ========== 10300 - 10399
|
||||
// 治疗 (基于攻击力百分比)
|
||||
10301: { uuid: 10301, name: "治疗", icon: "1292", buff: Attrs.hp, BType: BType.RATIO, value: 30, time: 0, chance: 1, runType: BuffRunType.Permanent, info: "回复30%最大生命值" },
|
||||
// 护盾 (基于攻击力百分比)
|
||||
10302: { uuid: 10302, name: "护盾", icon: "1255", buff: Attrs.shield, BType: BType.RATIO, value: 30, time: 0, chance: 1, runType: BuffRunType.Permanent, info: "获得30%最大生命值护盾" },
|
||||
10311: { uuid: 10311, name: "持续治疗", icon: "1292", buff: Attrs.hp, BType: BType.RATIO, value: 5, time: 5, interval: 1, chance: 1, runType: BuffRunType.Interval, info: "每秒回复5%最大生命值,持续5秒" },
|
||||
10312: { uuid: 10312, name: "流血", icon: "10211", buff: Attrs.hp, BType: BType.RATIO, value: -4, time: 5, interval: 1, chance: 1, isDebuff: true, runType: BuffRunType.Interval, info: "每秒损失4%最大生命值,持续5秒" },
|
||||
|
||||
// ========== 减益类 Buff (属性降低) ========== 10200 - 10299
|
||||
// 减速 (移动速度降低)
|
||||
10201: { uuid: 10201, name: "减速", icon: "10201", buff: Attrs.speed, BType: BType.VALUE, value: -50, time: 3, chance: 1, info: "移速-50", isDebuff: true },
|
||||
|
||||
// 虚弱 (攻击力降低)
|
||||
10211: { uuid: 10211, name: "虚弱", icon: "10211", buff: Attrs.ap, BType: BType.RATIO, value: -20, time: 5, chance: 1, info: "攻击力-20%", isDebuff: true },
|
||||
|
||||
// ========== 状态控制类 (Debuff) ========== 20000 - 20099
|
||||
// 冰冻
|
||||
20001: { uuid: 20001, name: "冰冻", icon: "20001", buff: Attrs.IN_FROST, BType: BType.BOOLEAN, value: 1, time: 1, chance: 1, info: "冰冻1秒", isDebuff: true },
|
||||
20002: { uuid: 20002, name: "冰冻", icon: "20002", buff: Attrs.IN_FROST, BType: BType.BOOLEAN, value: 1, time: 2, chance: 1, info: "冰冻2秒", isDebuff: true },
|
||||
|
||||
// 眩晕
|
||||
20011: { uuid: 20011, name: "眩晕", icon: "20011", buff: Attrs.IN_STUN, BType: BType.BOOLEAN, value: 1, time: 1, chance: 1, info: "眩晕1秒", isDebuff: true },
|
||||
20012: { uuid: 20012, name: "眩晕", icon: "20012", buff: Attrs.IN_STUN, BType: BType.BOOLEAN, value: 1, time: 2, chance: 1, info: "眩晕2秒", isDebuff: true },
|
||||
};
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { v3 } from "cc"
|
||||
import { BoxSet, FacSet } from "./GameSet"
|
||||
import { smc } from "../SingletonModuleComp"
|
||||
import { BuffConf } from "./SkillSet"
|
||||
import { Interface } from "readline"
|
||||
|
||||
export enum AttrSet {
|
||||
ATTR_MAX = 85,
|
||||
|
||||
@@ -122,11 +122,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
|
||||
mLogger.log(this.debugMode, 'HeroAtkSystem', " dmgCount",damage)
|
||||
if (isCrit) {
|
||||
// 暴击伤害计算
|
||||
// 使用施法者的暴击伤害加成属性(damageEvent.Attrs 快照)
|
||||
// 公式:最终伤害 = 基础伤害 * (1 + 系统暴击倍率 + 施法者暴击伤害加成)
|
||||
const casterCritDmg = damageEvent.Attrs[Attrs.critical_dmg] || 0;
|
||||
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE + casterCritDmg) / 100));
|
||||
damage = Math.floor(damage * (1 + FightSet.CRIT_DAMAGE / 100));
|
||||
reDate.isCrit=true;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { Attrs, BType } from "../common/config/HeroAttrs";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { BuffConf } from "../common/config/SkillSet";
|
||||
import { HeroDisVal, HType } from "../common/config/heroSet";
|
||||
import { mLogger } from "../common/Logger";
|
||||
@@ -30,17 +30,13 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
s_cd_max: number = 0; // 技能CD
|
||||
// ==================== 暴击与命中属性 ====================
|
||||
critical: number = 0; // 暴击率
|
||||
critical_dmg: number = 0; // 暴击伤害
|
||||
|
||||
// ==================== 特殊效果属性 ====================
|
||||
freeze_chance: number = 0; // 冰冻概率
|
||||
stun_chance: number = 0; // 眩晕概率
|
||||
back_chance: number = 0; // 击退概率
|
||||
slow_chance: number = 0; // 减速概率
|
||||
|
||||
// ==================== 武器进化相关 ====================
|
||||
puncture: number = 0; // 穿刺次数
|
||||
puncture_dmg: number = 0; // 穿刺伤害
|
||||
wfuny: number = 0; // 风怒
|
||||
|
||||
// ==================== 增益效果属性 ====================
|
||||
@@ -49,8 +45,8 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
invincible_time: number = 0;// 无敌时间
|
||||
|
||||
|
||||
in_stun=false
|
||||
in_frost=false
|
||||
frost_end_time: number = 0;
|
||||
|
||||
boom: boolean = false; // 自爆怪
|
||||
|
||||
@@ -92,8 +88,8 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
* 从 HeroInfo 读取初始配置,建立属性系统
|
||||
*/
|
||||
initAttrs() {
|
||||
this.in_stun = false;
|
||||
this.in_frost = false;
|
||||
this.frost_end_time = 0;
|
||||
}
|
||||
/*******************基础属性管理********************/
|
||||
|
||||
@@ -139,10 +135,9 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
* @param buffConf buff 配置
|
||||
*/
|
||||
addBuff(buffConf: BuffConf) {
|
||||
const normalized = this.normalizeBuffValue(buffConf);
|
||||
this.applyAttrChange(buffConf.buff, normalized.value, normalized.BType);
|
||||
this.applyAttrChange(buffConf.buff, buffConf.value);
|
||||
if (this.debugMode) {
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', `添加属性: ${buffConf.name}, 属性:${buffConf.buff}, 值:${normalized.value}`);
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', `添加属性: ${buffConf.name}, 属性:${buffConf.buff}, 值:${buffConf.value}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,39 +146,28 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
* - RATIO 会在写入前转换为 VALUE
|
||||
* - BOOLEAN 保持原类型
|
||||
*/
|
||||
private normalizeBuffValue(buffConf: BuffConf): { value: number; BType: BType } {
|
||||
return {
|
||||
value: buffConf.value,
|
||||
BType: BType.VALUE
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通用属性修改应用
|
||||
* @param attr 属性名
|
||||
* @param value 变化值
|
||||
* @param type 数值类型 (0:固定值, 1:百分比)
|
||||
* @param reverse 是否反向应用 (用于移除 buff)
|
||||
*/
|
||||
private applyAttrChange(attr: Attrs, value: number, type: BType, reverse: boolean = false) {
|
||||
private applyAttrChange(attr: Attrs, value: number,) {
|
||||
const mappedAttr = attr === Attrs.hp ? Attrs.hp_max : (attr === Attrs.shield ? Attrs.shield_max : attr);
|
||||
if (mappedAttr !== Attrs.ap && mappedAttr !== Attrs.hp_max && mappedAttr !== Attrs.shield_max) return;
|
||||
void type;
|
||||
let finalValue = value;
|
||||
if (reverse) finalValue = -finalValue;
|
||||
|
||||
if (mappedAttr === Attrs.ap) {
|
||||
this.ap = Math.max(0, this.ap + finalValue);
|
||||
this.ap = Math.max(0, this.ap + value);
|
||||
return;
|
||||
}
|
||||
if (mappedAttr === Attrs.hp_max) {
|
||||
this.hp_max = Math.max(1, this.hp_max + finalValue);
|
||||
this.hp_max = Math.max(1, this.hp_max + value);
|
||||
if (this.hp > this.hp_max) this.hp = this.hp_max;
|
||||
this.dirty_hp = true;
|
||||
return;
|
||||
}
|
||||
this.shield_max = Math.max(0, this.shield_max + finalValue);
|
||||
this.shield = Math.max(0, Math.min(this.shield + finalValue, this.shield_max));
|
||||
this.shield_max = Math.max(0, this.shield_max + value);
|
||||
this.shield = Math.max(0, Math.min(this.shield + value, this.shield_max));
|
||||
this.dirty_shield = true;
|
||||
}
|
||||
//======更新cd========//
|
||||
@@ -197,11 +181,18 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
if(this.s_cd >= this.s_cd_max) this.can_skill = true
|
||||
}
|
||||
}
|
||||
isStun(): boolean {
|
||||
return false;
|
||||
}
|
||||
isFrost(): boolean {
|
||||
return false;
|
||||
if (!this.in_frost) return false;
|
||||
if (this.frost_end_time <= 0) {
|
||||
this.in_frost = false;
|
||||
return false;
|
||||
}
|
||||
if (Date.now() / 1000 >= this.frost_end_time) {
|
||||
this.in_frost = false;
|
||||
this.frost_end_time = 0;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
triggerAtkCD() {
|
||||
this.a_cd = 0;
|
||||
@@ -272,21 +263,17 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.a_cd_max = 0;
|
||||
this.s_cd_max = 0;
|
||||
this.critical = 0;
|
||||
this.critical_dmg = 0;
|
||||
this.freeze_chance = 0;
|
||||
this.stun_chance = 0;
|
||||
this.back_chance = 0;
|
||||
this.slow_chance = 0;
|
||||
this.revive_count = 0;
|
||||
this.revive_time = 0;
|
||||
this.invincible_time = 0;
|
||||
this.puncture = 0;
|
||||
this.puncture_dmg = 0;
|
||||
this.wfuny = 0;
|
||||
this.boom = false;
|
||||
|
||||
this.in_frost = false;
|
||||
this.in_stun = false;
|
||||
this.frost_end_time = 0;
|
||||
|
||||
// 重置技能距离缓存
|
||||
this.maxSkillDistance = 0;
|
||||
|
||||
@@ -417,9 +417,6 @@ export class HeroViewComp extends CCComp {
|
||||
this.in_iced(0.3);
|
||||
return;
|
||||
}
|
||||
if (attr === Attrs.IN_STUN && value > 0) {
|
||||
this.in_yun(0.3);
|
||||
}
|
||||
}
|
||||
|
||||
alive(){
|
||||
|
||||
@@ -5,7 +5,6 @@ import { smc } from "../common/SingletonModuleComp";
|
||||
import { BoxSet, FacSet, FightSet, IndexSet } from "../common/config/GameSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { BuffConf, SkillSet } from "../common/config/SkillSet";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { MoveComp } from "./MoveComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
@@ -98,7 +98,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
view.status_change("idle");
|
||||
return;
|
||||
}
|
||||
if (model.is_stop || model.is_dead || model.is_reviving || model.in_stun || model.in_frost) {
|
||||
if (model.is_stop || model.is_dead || model.is_reviving || model.isFrost()) {
|
||||
this.clearCombatTarget(model);
|
||||
if (!model.is_reviving) view.status_change("idle");
|
||||
return;
|
||||
|
||||
@@ -43,7 +43,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const heroAttrs = e.get(HeroAttrsComp);
|
||||
const heroView = e.get(HeroViewComp);
|
||||
if (!heroAttrs || !heroView || !heroView.node) return;
|
||||
if (heroAttrs.is_dead || heroAttrs.is_reviving || heroAttrs.isStun() || heroAttrs.isFrost()) return;
|
||||
if (heroAttrs.is_dead || heroAttrs.is_reviving || heroAttrs.isFrost()) return;
|
||||
heroAttrs.updateCD(this.dt);
|
||||
heroView.cd_show();
|
||||
|
||||
@@ -149,15 +149,6 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.debuffs) {
|
||||
for (const buffId of config.debuffs) {
|
||||
const buffConf = BuffsList[buffId];
|
||||
if (buffConf) {
|
||||
model.addBuff(buffConf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -209,17 +209,11 @@ export class Skill extends ecs.Entity {
|
||||
sDataCom.Attrs = {};
|
||||
const addCrt = config.crt ?? 0;
|
||||
const addFrz = config.frz ?? 0;
|
||||
const addStn = config.stn ?? 0;
|
||||
const addBck = config.bck ?? 0;
|
||||
const addSlw = config.slw ?? 0;
|
||||
sDataCom.Attrs[Attrs.ap] = cAttrsComp.ap;
|
||||
sDataCom.Attrs[Attrs.critical] = cAttrsComp.critical + addCrt;
|
||||
sDataCom.Attrs[Attrs.critical_dmg] = cAttrsComp.critical_dmg;
|
||||
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.freeze_chance + addFrz;
|
||||
sDataCom.Attrs[Attrs.stun_chance] = cAttrsComp.stun_chance + addStn;
|
||||
sDataCom.Attrs[Attrs.back_chance] = cAttrsComp.back_chance + addBck;
|
||||
sDataCom.Attrs[Attrs.slow_chance] = cAttrsComp.slow_chance + addSlw;
|
||||
sDataCom.Attrs[Attrs.puncture_dmg] = cAttrsComp.puncture_dmg;
|
||||
|
||||
sDataCom.s_uuid=s_uuid
|
||||
sDataCom.fac=cAttrsComp.fac
|
||||
|
||||
Reference in New Issue
Block a user