Files
pixelheros/assets/script/game/common/config/BuffSet.ts
pan c4e7f2584b feat(hero): 新增完整计时性Buff/Debuff系统
本次提交实现了游戏内完整的计时性增益/减益系统,包含:
1. 新增Buff配置表与运行时数据组件
2. 实现属性修饰器与最终属性计算逻辑
3. 完成Buff管理、计时结算与周期效果处理
4. 兼容旧有控制状态系统,支持平滑过渡
5. 附带完整的系统设计文档

同时关闭了两个闲置的任务界面节点。
2026-07-23 15:48:59 +08:00

78 lines
2.3 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.
// ========== Buff/Debuff 配置定义 ==========
import { Attrs } from "./HeroAttrs";
/** Buff 类别 */
export enum BuffCategory {
Buff = 0,
Debuff = 1,
Control = 2,
}
/** 修饰器运算类型 */
export enum ModOp {
Flat = 0,
PercentAdd = 1,
PercentMul = 2,
}
/** 单条属性修饰器 */
export interface BuffModifier {
attr: Attrs;
op: ModOp;
value: number;
}
/** 周期效果DoT/HoT */
export interface BuffTickEffect {
interval: number;
damage_or_heal: number; // 正=治疗,负=伤害
scale_by_ap_pct: number; // 按施法者 ap 缩放百分比0=不吃加成
}
/** Buff 静态定义 */
export interface BuffConfig {
id: number;
name: string;
icon: string;
category: BuffCategory;
duration: number; // 单层持续时间0=永久
max_stack: number; // 默认 0=无限叠加1=不可叠层N=最多N层
modifiers?: BuffModifier[];
tick?: BuffTickEffect;
is_control?: boolean;
control_kind?: 'frost' | 'stun' | 'none';
info: string;
}
/** Buff 配置表 */
export const BuffList: Record<number, BuffConfig> = {
// 攻击强化(限时版)
7001: {
id: 7001, name: "攻击强化", icon: "Stat_Attack_03",
category: BuffCategory.Buff, duration: 10, max_stack: 0,
modifiers: [{ attr: Attrs.ap, op: ModOp.Flat, value: 5 }],
info: "攻击力 +5持续 10 秒",
},
// 灼烧DoT可叠层
7002: {
id: 7002, name: "灼烧", icon: "Stat_Burn",
category: BuffCategory.Debuff, duration: 5, max_stack: 5,
tick: { interval: 0.5, damage_or_heal: -10, scale_by_ap_pct: 30 },
info: "每 0.5 秒受到 10 伤害,可叠加",
},
// 冰冻(控制,走统一框架,双写兼容)
7003: {
id: 7003, name: "冰冻", icon: "Stat_Freeze",
category: BuffCategory.Control, duration: 2, max_stack: 1,
is_control: true, control_kind: 'frost',
info: "冰冻目标,无法行动",
},
// 击晕(控制)
7004: {
id: 7004, name: "击晕", icon: "Stat_Stun",
category: BuffCategory.Control, duration: 2, max_stack: 1,
is_control: true, control_kind: 'stun',
info: "击晕目标,无法行动",
},
};