feat: 实现药水卡限时强化功能,支持自定义数值覆写
1. 新增Buff数值覆写机制,支持药水卡自定义buff效果数值 2. 重构属性计算逻辑,支持读取药水卡传递的覆写值 3. 新增多组限时强化Buff与药水卡配置 4. 优化UI数值显示,实时展示最终属性值 5. 新增多维度调试日志方便排查问题
This commit is contained in:
@@ -12,9 +12,11 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { BuffCategory, BuffList } from "../common/config/BuffSet";
|
||||
import { BuffComp, ActiveBuff } from "./BuffComp";
|
||||
|
||||
/** applyBuff 的覆盖参数(预留按需覆写持续时间) */
|
||||
/** applyBuff 的覆盖参数(预留按需覆写持续时间 / 修饰数值) */
|
||||
export interface BuffApplyOverrides {
|
||||
duration?: number;
|
||||
/** 覆写计时 buff 的修饰数值(modifiers.value / tick.damage_or_heal),由药水卡 buff_value 自定义档位 */
|
||||
value?: number;
|
||||
}
|
||||
|
||||
class BuffManagerImpl {
|
||||
@@ -34,7 +36,11 @@ class BuffManagerImpl {
|
||||
*/
|
||||
applyBuff(target: ecs.Entity, buffId: number, sourceUuid: number = 0, sourceAp: number = 0, overrides?: BuffApplyOverrides): void {
|
||||
const cfg = BuffList[buffId];
|
||||
if (!cfg) return;
|
||||
if (!cfg) {
|
||||
console.log(`[BuffManager] applyBuff: buffId=${buffId} 配置不存在,跳过`);
|
||||
return;
|
||||
}
|
||||
console.log(`[BuffManager] applyBuff: buff=${cfg.name}(${buffId}) target_eid=${target.eid} duration=${overrides?.duration ?? cfg.duration} value_override=${overrides?.value} source_ap=${sourceAp}`);
|
||||
|
||||
const buffComp = this.ensureBuffComp(target);
|
||||
const duration = overrides?.duration ?? cfg.duration;
|
||||
@@ -45,7 +51,7 @@ class BuffManagerImpl {
|
||||
buffComp.buffs.set(buffId, layers);
|
||||
}
|
||||
|
||||
const newLayer = new ActiveBuff(buffId, duration, sourceUuid, sourceAp);
|
||||
const newLayer = new ActiveBuff(buffId, duration, sourceUuid, sourceAp, overrides?.value);
|
||||
|
||||
if (cfg.max_stack === 0 || layers.length < cfg.max_stack) {
|
||||
layers.push(newLayer);
|
||||
|
||||
Reference in New Issue
Block a user