技能有bug 需要处理

This commit is contained in:
2025-08-12 11:02:16 +08:00
parent 1273ec6e99
commit 61cbd6e7bd
5 changed files with 382 additions and 505 deletions

View File

@@ -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, SkillSet } from "../common/config/SkillSet";
import { BuffAttr, getBuffNum, SkillSet } from "../common/config/SkillSet";
/** 角色实体 */
@ecs.register(`Monster`)
export class Monster extends ecs.Entity {
@@ -75,8 +75,9 @@ export class Monster extends ecs.Entity {
hv.box_group = box_group;
hv.hero_uuid= uuid;
hv.hero_name= hero.name;
hv.speed =hv.speed_base = hero.speed;
hv.dis = hero.dis;
// 初始化Attrs属性系统参考Hero.ts的实现
hv.Attrs = getBuffNum();
// 肉鸽模式使用固定数值,否则使用等级计算
if (rogueHp !== undefined && rogueAttack !== undefined) {
@@ -98,11 +99,34 @@ export class Monster extends ecs.Entity {
hv.hp = hv.hp_max = levelHp;
hv.ap = levelAp;
hv.ap_base=levelAp
hv.ap_base = levelAp;
console.log(`[Monster]: 怪物${hero.name}(等级${lv}) - 基础HP:${baseHp}->等级HP:${levelHp}, 基础AP:${baseAp}->等级AP:${levelAp}`);
}
hv.cd = hero.cd
// 设置基础属性到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);
})
// 处理肉鸽模式的词条Buff
if (rogueBuffData && rogueBuffData.length > 0) {
console.log(`[Monster]: 怪物${hero.name}应用肉鸽词条:`, rogueBuffData);
rogueBuffData.forEach((buff:any)=>{
hv.apply_buff(buff.type, 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,
@@ -110,73 +134,7 @@ export class Monster extends ecs.Entity {
cd_max:i==0?hero.cd:SkillSet[hero.skills[i]].cd
})
}
// 处理原有Buff
hero.buff.forEach((buff:any)=>{
this.applyBuffToMonster(hv, buff);
})
// 处理肉鸽模式的词条Buff
if (rogueBuffData && rogueBuffData.length > 0) {
console.log(`[Monster]: 怪物${hero.name}应用肉鸽词条:`, rogueBuffData);
rogueBuffData.forEach((buff:any)=>{
this.applyBuffToMonster(hv, buff);
})
}
// 重新计算最终HP因为buff可能修改了hp_max
hv.hp = hv.hp_max;
this.add(hv);
}
/**
* 应用Buff到怪物的通用方法
*/
private applyBuffToMonster(hv: any, buff: any) {
switch(buff.buff_type){
case BuffAttr.CRITICAL:
hv.crit+=buff.value
break
case BuffAttr.CRITICAL_DMG:
hv.crit_d+=buff.value
break
case BuffAttr.DODGE:
hv.dod+=buff.value
break
case BuffAttr.DODGE_NO:
hv.dod_no+=buff.value
break
case BuffAttr.CRITICAL_NO:
hv.crit_no+=buff.value
break
case BuffAttr.BURN_COUNT:
hv.burn_count+=buff.value
break
case BuffAttr.PUNCTURE:
hv.puncture+=buff.value
break
case BuffAttr.PUNCTURE_DMG:
hv.puncture_damage+=buff.value
break
case BuffAttr.WFUNY:
hv.wfuny+=buff.value
break
case BuffAttr.ATK_CD:
hv.cd=hv.cd*(100+buff.value)/100
break
case BuffAttr.HP:
hv.hp_max=hv.hp_max*(100+buff.value)/100
break
case BuffAttr.DEF:
hv.def+=buff.value
break
case BuffAttr.ATK:
hv.ap=hv.ap*(100+buff.value)/100
break
case BuffAttr.FROST_RATIO:
hv.frost_ratio+=buff.value
break
}
}
}