Files
heros/assets/script/game/common/config/heroSet.ts
walkpan 2cdb25ac58 refactor(skillSet): 基本功完成 新buff系统 优化DBuff与Attrs映射及转换逻辑
- 规范化DBuff的枚举命名,修正属性对应关系
- 统一DBuff与Attrs的双向映射,通过TransformBuffs函数处理转换
- 移除旧的getAttrFieldFromDebuff方法,改用更灵活的映射数组
- 更新Attrs枚举,增加被易伤、防护盾等新属性
- 重新调整AttrsType映射,保证属性类型一致性

refactor(hero): 重构Hero和Monster初始化属性及buff系统

- Hero初始化时完善基础属性赋值,新增基础移动速度与攻击距离
- Hero使用initAttrs替代initBuffsDebuffs,重构buff/debuff初始化流程
- Monster初始化简化,统一按Hero写法初始化基础属性和Attrs
- 实现buff/debuff属性智能覆盖与叠加时长的改进逻辑
- 属性计算改用统一逻辑,支持数值型和百分比型准确计算
- 增加属性值范围限制,确保部分属性在合理区间内

refactor(heroViewComp): 优化buff/debuff管理及状态判断

- 统一buff和debuff的持久与临时管理字典及更新方法
- 优化临时buff/debuff的更新时间处理,自动触发属性重新计算
- 提供isStun和isFrost接口简化眩晕、冰冻状态判断
- 规范注释及代码格式,提升可读性和维护性

refactor(skillConComp): 优化眩晕与冰冻状态判断逻辑

- 移除遍历判断,改用HeroViewComp的isStun和isFrost方法
- 简化技能冷却更新逻辑,提升性能

chore(heroSet): 添加AttrSet枚举定义属性最大值限制

docs(rogueConfig): 更新说明文档中的属性枚举定义说明

- 将属性增强枚举由BuffAttr修改为Attrs,以保持一致性
2025-10-17 22:02:23 +08:00

209 lines
7.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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:神圣
**/
// export enum HeroKind {
// /**
// * 词条解释:
// * 烈焰:攻击带击退效果
// * 寒冰:攻击带速度效果
// * 自然:攻击偷取生命
// * 暗影:攻击偷取攻击
// * 神圣:攻击带2倍伤害
// * */
// fire = 1,
// water = 2,
// nature = 3,
// shadow = 4,
// holy = 5,
// }
/**
* 词条解释:
* 0:战士 1:远程 2:法师
* * */
export enum AttrSet {
ATTR_MAX = 85,
}
export enum HType {
warrior = 0,
remote = 1,
mage = 2,
support = 3,
assassin = 4,
}
export const HTypeName ={
0:"战士",
1:"远程",
2:"法师",
3:"辅助",
4:"刺客",
}
/**
* 解锁英雄所需物品
* 绿色:铜钥匙*100 item:1006 num:100
* 蓝色:银钥匙*200 item:1007 num:200
* 紫色:金钥匙*100 item:1008 num:100
* 橙色:金钥匙*100 item:1009 num:100
*/
//fac:FacSet.HERO
export const getHeroList = (quality:number=0)=>{
const filteredHeros = Object.values(HeroInfo).filter(item=>{
const facMatch = item.fac === FacSet.HERO;
return facMatch;
});
// 分离拥有和未拥有的英雄
const ownedHeros = filteredHeros.filter(item => smc.heros[item.uuid]);
const unownedHeros = filteredHeros.filter(item => !smc.heros[item.uuid]);
// 合并列表:拥有的在前,未拥有的在后
return [...ownedHeros, ...unownedHeros].map(item => item.uuid);
}
//fac:FacSet.MON
export const getMonList = (quality:number=0)=>{
return Object.values(HeroInfo).filter(item=>{
const facMatch = item.fac === FacSet.MON;
return facMatch ;
}).map(item=>item.uuid)
}
export const HeroPos={
0:{pos:v3(0,0,0)},
1:{pos:v3(0,0,0)},
2:{pos:v3(0,0,0)},
}
export const MonSet = {
0:{pos:v3(240,0,0)},
1:{pos:v3(320,0,0)},
2:{pos:v3(360,0,0)},
3:{pos:v3(400,0,0)},
4:{pos:v3(440,0,0)},
5:{pos:v3(480,0,0)},
6:{pos:v3(520,0,0)},
7:{pos:v3(560,0,0)},
}
export enum HeroUpSet {
MP=5,
HP=10,
LVMP=100,
LVHP=100,
LVATK=10,
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: Record<number, heroInfo> = {
//主将
5001:{uuid:5001,name:"火焰骑士",path:"hk1", fac:FacSet.HERO, kind:1,
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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,lv:1,hp:45,mp:100,map:0,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6001,6001],
buff:[],debuff:[],info:"精英怪物-战士型"},
};