Files
pixelheros/assets/script/game/hero/BuffComp.ts
panFD ac0891ccdd feat: 实现药水卡限时强化功能,支持自定义数值覆写
1. 新增Buff数值覆写机制,支持药水卡自定义buff效果数值
2. 重构属性计算逻辑,支持读取药水卡传递的覆写值
3. 新增多组限时强化Buff与药水卡配置
4. 优化UI数值显示,实时展示最终属性值
5. 新增多维度调试日志方便排查问题
2026-07-23 23:00:49 +08:00

48 lines
1.6 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 { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
/**
* 单个活跃 buff 实例(一层)。
* 每个 ActiveBuff 独立计时,叠层时会产生多个实例。
*/
export class ActiveBuff {
/** 对应 BuffList 中的配置 id */
config_id: number;
/** 剩余持续时间(秒) */
remaining: number;
/** 施法者实体 uuid用于伤害归属 */
source_uuid: number;
/** 施法者攻击力快照(用于 DoT/HoT 的 ap 缩放) */
source_ap_snapshot: number;
/** 周期效果累计时间(秒) */
tick_acc: number = 0;
/** 修饰数值覆写(来自药水卡 buff_value优先于 BuffList 配置值undefined 表示用配置值 */
value_override?: number;
constructor(cfg_id: number, dur: number, src_uuid: number, src_ap: number, value_override?: number) {
this.config_id = cfg_id;
this.remaining = dur;
this.source_uuid = src_uuid;
this.source_ap_snapshot = src_ap;
this.value_override = value_override;
}
}
/**
* Buff 组件 — 存储实体身上所有活跃的 buff/debuff。
*
* 数据结构:按 buff_id 分组,每组是若干层(每层独立计时)。
* 使用 ecs.Comp仅承载数据计时与结算逻辑由 BuffSystem 负责。
*/
@ecs.register('Buff')
export class BuffComp extends ecs.Comp {
/** 按 buff_id 分组,每组是若干层(每层独立计时) */
buffs: Map<number, ActiveBuff[]> = new Map();
/** buff 列表变更标记(预留 UI 消费) */
dirty_buffs: boolean = false;
reset() {
this.buffs.clear();
this.dirty_buffs = false;
}
}