feat(skill-system): 新增计时debuff机制,支持技能命中敌方附加减益效果
本次提交完整实现了技能对敌附加debuff的完整流程: 1. 新增TimedDebuffSnapshot数据结构,用于透传debuff配置 2. 在SkillConfig和SkillOverrides中新增debuff相关配置项 3. 实现HeroAtkSystem中debuff的判定与施加逻辑 4. 完善后台配置、前端编辑器的debuff配置支持 5. 调整了buff目标判定逻辑,修复了原有默认目标的语义混淆问题 6. 优化了BuffSystem的调试日志,新增了debuff分类标识 7. 批量更新了现有英雄技能的debuff配置示例
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { BuffCategory, BuffList } from "../common/config/BuffSet";
|
||||
import { BuffComp, ActiveBuff } from "./BuffComp";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
/** applyBuff 的覆盖参数(预留按需覆写持续时间 / 修饰数值) */
|
||||
@@ -46,10 +47,12 @@ class BuffManagerImpl {
|
||||
mLogger.warn(true, "BuffManager", `applyBuff: buffId=${buffId} 配置不存在,跳过`);
|
||||
return;
|
||||
}
|
||||
mLogger.log(this.debug, "BuffManager", `[挂buff] 「${cfg.name}」(buffId:${buffId}) -> target_eid:${target.eid} duration:${overrides?.duration ?? cfg.duration} value:${overrides?.value ?? "-"} source_ap:${sourceAp}`);
|
||||
|
||||
const buffComp = this.ensureBuffComp(target);
|
||||
const duration = overrides?.duration ?? cfg.duration;
|
||||
const targetName = target.get(HeroAttrsComp)?.hero_name ?? `eid:${target.eid}`;
|
||||
// buff/debuff 类别标签,便于日志区分挂载语义
|
||||
const categoryTag = cfg.category === BuffCategory.Debuff ? "debuff" : cfg.category === BuffCategory.Control ? "control" : "buff";
|
||||
|
||||
let layers = buffComp.buffs.get(buffId);
|
||||
if (!layers) {
|
||||
@@ -59,14 +62,18 @@ class BuffManagerImpl {
|
||||
|
||||
const newLayer = new ActiveBuff(buffId, duration, sourceUuid, sourceAp, overrides?.value, overrides?.source_attrs);
|
||||
|
||||
let refreshed = false;
|
||||
if (cfg.max_stack === 0 || layers.length < cfg.max_stack) {
|
||||
layers.push(newLayer);
|
||||
} else {
|
||||
// 满层 FIFO:移除最老层后追加新层
|
||||
layers.shift();
|
||||
layers.push(newLayer);
|
||||
refreshed = true;
|
||||
}
|
||||
|
||||
buffComp.dirty_buffs = true;
|
||||
mLogger.log(this.debug, "BuffManager", `[挂${categoryTag}] 「${cfg.name}」(buffId:${buffId}) -> ${targetName} 时长:${duration}s 数值:${overrides?.value ?? "-"} 来源ap:${sourceAp} 当前层数:${layers.length}${cfg.max_stack > 0 ? `/${cfg.max_stack}` : ""}${refreshed ? "(满层刷新)" : ""}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user