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,以保持一致性
This commit is contained in:
@@ -8,7 +8,7 @@ import { HeroInfo } from "../common/config/heroSet";
|
||||
import { MonModelComp } from "./MonModelComp";
|
||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||
import { SkillConComp } from "./SkillConComp";
|
||||
import { BuffAttr, getBuffNum, SkillSet } from "../common/config/SkillSet";
|
||||
import { Attrs, getAttrs, SkillSet } from "../common/config/SkillSet";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Monster`)
|
||||
export class Monster extends ecs.Entity {
|
||||
@@ -64,9 +64,11 @@ export class Monster extends ecs.Entity {
|
||||
}
|
||||
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO,is_boss:boolean=false,is_call:boolean=false,enhancement?: any, stageMultipliers?: any) {
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
hv.hide_info()
|
||||
|
||||
|
||||
// console.log("hero_init",buff)
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
|
||||
hv.scale = scale;
|
||||
hv.fac = FacSet.MON;
|
||||
hv.type = hero.type;
|
||||
@@ -77,11 +79,9 @@ export class Monster extends ecs.Entity {
|
||||
hv.box_group = box_group;
|
||||
hv.hero_uuid= uuid;
|
||||
hv.hero_name= hero.name;
|
||||
|
||||
// 初始化Attrs属性系统,参考Hero.ts的实现
|
||||
hv.Attrs = getBuffNum();
|
||||
|
||||
// 计算基础属性(使用关卡倍数)
|
||||
|
||||
// 初始化Attrs属性系统,参考Hero.ts的实
|
||||
// 计算基础属性(使用关卡倍数)
|
||||
const baseHp = hero.hp;
|
||||
const baseAp = hero.ap;
|
||||
|
||||
@@ -93,46 +93,29 @@ export class Monster extends ecs.Entity {
|
||||
finalHp = Math.floor(baseHp * stageMultipliers.hp);
|
||||
finalAp = Math.floor(baseAp * stageMultipliers.attack);
|
||||
// console.log(`[Monster]: 怪物${hero.name} 关卡倍数 - HP: ${baseHp} x ${stageMultipliers.hp.toFixed(2)} = ${finalHp}, AP: ${baseAp} x ${stageMultipliers.attack.toFixed(2)} = ${finalAp}`);
|
||||
} else {
|
||||
// console.log(`[Monster]: 怪物${hero.name} 使用基础属性 - HP: ${finalHp}, AP: ${finalAp}`);
|
||||
}
|
||||
|
||||
hv.base_ap=finalAp
|
||||
hv.base_map=hero.mp
|
||||
hv.base_def=hero.def
|
||||
hv.base_hp=finalHp
|
||||
hv.base_mp=hero.mp
|
||||
hv.hp=hv.base_hp
|
||||
hv.mp=hv.base_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
|
||||
hv.Attrs[Attrs.SPEED]=hero.speed
|
||||
hv.Attrs[Attrs.DIS]=hero.dis
|
||||
// 初始化 buff/debuff 系统
|
||||
hv.initAttrs();
|
||||
|
||||
hv.hp = hv.hp_max = finalHp;
|
||||
hv.ap = finalAp;
|
||||
hv.ap_base = finalAp;
|
||||
|
||||
// 设置基础属性到Attrs系统
|
||||
hv.Attrs[BuffAttr.SPEED] = hv.speed = hv.speed_base = hero.speed;
|
||||
hv.Attrs[BuffAttr.DIS] = hv.dis = hero.dis;
|
||||
hv.Attrs[BuffAttr.ATK_CD] = hv.cd = hero.cd;
|
||||
hv.Attrs[BuffAttr.HP_MAX] = hv.hp_max;
|
||||
hv.Attrs[BuffAttr.AP] = hv.ap;
|
||||
hv.Attrs[BuffAttr.DEF] = hv.def;
|
||||
|
||||
// 处理原有Buff,使用统一的apply_buff方法
|
||||
hero.buff.forEach((buff:any)=>{
|
||||
hv.apply_buff(buff.type, buff.value);
|
||||
})
|
||||
|
||||
// 处理肉鸽模式的增强属性
|
||||
if (enhancement && enhancement.buffList && enhancement.buffList.length > 0) {
|
||||
// console.log(`[Monster]: 怪物${hero.name}应用增强属性:`, enhancement.buffList.map((buff: any) => `${buff.name}:+${buff.value}`));
|
||||
enhancement.buffList.forEach((buff:any)=>{
|
||||
hv.apply_buff(buff.buffType, buff.value);
|
||||
})
|
||||
}
|
||||
|
||||
// 重新计算最终HP(因为buff可能修改了hp_max)
|
||||
hv.hp = hv.hp_max;
|
||||
|
||||
for(let i=0;i<hero.skills.length;i++){
|
||||
hv.skills.push({
|
||||
cd:0,
|
||||
uuid:hero.skills[i],
|
||||
cd_max:i==0?hero.cd:SkillSet[hero.skills[i]].cd
|
||||
})
|
||||
}
|
||||
|
||||
this.add(hv);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user