Debuff.h
Source/MassBattle/Public/Fragments/Debuff.h
概述 Overview
减益(Debuff)系统的 fragment 集合。三个参数子结构 FLaunchParams(击退)、FTemporalDmgParams(延时伤害)、FSlowParams(减速);基础配置 FDebuff(三子结构 + 衰减开关);运行时状态 FDebuffing(施加者列表与综合减速倍数,带自旋锁);以及按施加路径区分的派生配置 FDebuff_Point / FDebuff_Radial / FDebuff_Beam(均提供从 FDebuff 的转换构造)。
Debuff fragment collection. Three parameter substructs FLaunchParams (knockback), FTemporalDmgParams (damage over time), FSlowParams (slow); base config FDebuff (three substructs + falloff switch); runtime state FDebuffing (causer lists and combined slow multiplier, with a spin-lock); and path-specific variants FDebuff_Point / FDebuff_Radial / FDebuff_Beam (all with converting constructors from FDebuff).
FLaunchParams USTRUCT
击退参数(非 fragment)。控制目标是否可被击退、击退速度(XY 与 Z 分量)与击退来源位置。
Knockback parameters (not a fragment). Controls whether the target can be knocked back, the knockback speed (XY and Z components) and the knockback source location.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bCanLaunch | bool | false | 是否可以将目标击退。Whether the target can be knocked back. |
LaunchSpeed | FVector2f | (2000, 0) | 击退的速度,分为 XY 与 Z(X=XY 速度, Y=Z 速度)。仅 bCanLaunch 时可编辑。Knockback speed, split into XY and Z (X=XY speed, Y=Z speed). Editable only when bCanLaunch. |
bHitFromInstigator | bool | true | 启用且施法者有效时,使用施法者的位置作为击退来源位置;未启用时使用自身的位置作为击退来源位置。If enabled and the instigator is valid, use the instigator's location as the knockback source; otherwise use self's location. |
FTemporalDmgParams USTRUCT
延时伤害(DOT)参数(非 fragment)。控制总伤害、分段数量与伤害间隔。
Damage-over-time (DOT) parameters (not a fragment). Controls total damage, segment count and damage interval.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bDealTemporalDmg | bool | false | 是否可以造成延时伤害。Whether to deal damage over time. |
TemporalDmg | float | 60.f | 总延时伤害。仅 bDealTemporalDmg 时可编辑。Total damage over time. Editable only when bDealTemporalDmg. |
TemporalDmgSegment | int32 | 6 | 分段数量。仅 bDealTemporalDmg 时可编辑。Number of damage segments. Editable only when bDealTemporalDmg. |
TemporalDmgInterval | float | 0.5f | 伤害间隔(秒)。仅 bDealTemporalDmg 时可编辑。Damage interval (seconds). Editable only when bDealTemporalDmg. |
FSlowParams USTRUCT
减速参数(非 fragment)。控制是否可减速、持续时间与强度。
Slow parameters (not a fragment). Controls whether the target can be slowed, the duration and the strength.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bCanSlow | bool | false | 是否可以使目标减速。Whether the target can be slowed. |
SlowTime | float | 4.f | 减速的持续时间(秒)。仅 bCanSlow 时可编辑。Duration of the slow effect (seconds). Editable only when bCanSlow. |
SlowStrength | float | 1.f | 减速的强度。仅 bCanSlow 时可编辑。Strength of the slow effect. Editable only when bCanSlow. |
FDebuff USTRUCT
减益配置 fragment(FA_MassBattleBaseFragment 派生)。组合三个参数子结构与距离衰减开关,是 FDebuff_Point / FDebuff_Radial / FDebuff_Beam 的转换来源。
Debuff config fragment (derived from FA_MassBattleBaseFragment). Combines the three parameter substructs and the distance-falloff switch; the conversion source for FDebuff_Point / FDebuff_Radial / FDebuff_Beam.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用减益。Whether to enable debuffs. |
bUseFalloff | bool | false | 是否启用距离衰减,目前为线性衰减。Whether to enable distance falloff (currently linear). |
LaunchParams | FLaunchParams | — | 击退参数。Knockback parameters. |
TemporalDmgParams | FTemporalDmgParams | — | 延时伤害参数。Damage-over-time parameters. |
SlowParams | FSlowParams | — | 减速参数。Slow parameters. |
FDebuffing USTRUCT
减益运行时状态 fragment(FA_MassBattleBaseFragment 派生)。记录当前施加延时伤害/减速的实体列表与综合减速倍数;带自旋锁 Lock/Unlock 供并行段安全修改。经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明为不可平凡拷贝(含 std::atomic 与 TArray 成员)。
Debuff runtime state fragment (derived from FA_MassBattleBaseFragment). Tracks the current temporal-damage / slow causer lists and the combined slow multiplier; ships a spin-lock (Lock/Unlock) for safe parallel mutation. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE as not-trivially-copyable (contains std::atomic and TArray).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
TemporalDmgCausers | TArray<FEntityHandle> | 空 | 造成延时伤害的实体列表。List of entities causing temporal damage. |
SlowCausers | TArray<FEntityHandle> | 空 | 造成减速效果的实体列表。List of entities causing the slow effect. |
CombinedSlowMult | float | 1 | 当前综合减速倍数(1 = 无减速)。Current combined slow multiplier (1 = no slow). |
方法 Methods
自旋锁加锁:对 LockFlag 做 exchange(acquire 语义)忙等,直至拿到锁。并行段中修改本 fragment 前调用。
Spin-lock acquire: busy-waits on LockFlag with an acquire-semantics exchange until the lock is held. Called before mutating this fragment from parallel sections.
Input
无参数。
No parameters.
Output
无返回值。副作用:置位 LockFlag。
No return value. Side effect: sets LockFlag.
自旋锁释放:以 release 语义将 LockFlag 清零。
Spin-lock release: clears LockFlag with release semantics.
Input
无参数。
No parameters.
Output
无返回值。副作用:清零 LockFlag。
No return value. Side effect: clears LockFlag.
FDebuff_Point USTRUCT
单体减益配置 fragment(FA_MassBattleBaseFragment 派生)。无 bUseFalloff 字段;提供从 FDebuff 的转换构造(不拷贝衰减开关)。
Single-target debuff config fragment (derived from FA_MassBattleBaseFragment). No bUseFalloff field; provides a converting constructor from FDebuff (falloff switch not copied).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用减益。Whether to enable debuffs. |
LaunchParams | FLaunchParams | — | 击退参数。Knockback parameters. |
TemporalDmgParams | FTemporalDmgParams | — | 延时伤害参数。Damage-over-time parameters. |
SlowParams | FSlowParams | — | 减速参数。Slow parameters. |
FDebuff_Radial USTRUCT
范围减益配置 fragment(FA_MassBattleBaseFragment 派生)。在 FDebuff 基础上保留 bUseFalloff;提供从 FDebuff 的转换构造(拷贝衰减开关)。
Area debuff config fragment (derived from FA_MassBattleBaseFragment). Keeps bUseFalloff from FDebuff; provides a converting constructor from FDebuff (falloff switch copied).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用减益。Whether to enable debuffs. |
bUseFalloff | bool | false | 是否启用距离衰减,目前为线性衰减。Whether to enable distance falloff (currently linear). |
LaunchParams | FLaunchParams | — | 击退参数。Knockback parameters. |
TemporalDmgParams | FTemporalDmgParams | — | 延时伤害参数。Damage-over-time parameters. |
SlowParams | FSlowParams | — | 减速参数。Slow parameters. |
FDebuff_Beam USTRUCT
光束减益配置 fragment(FA_MassBattleBaseFragment 派生)。提供三个转换构造:FDebuff(拷贝衰减开关)、FDebuff_Point(不拷贝衰减开关)与 FDebuff_Radial(拷贝衰减开关)。
Beam debuff config fragment (derived from FA_MassBattleBaseFragment). Provides three converting constructors: from FDebuff (falloff copied), from FDebuff_Point (falloff not copied) and from FDebuff_Radial (falloff copied).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用减益。Whether to enable debuffs. |
bUseFalloff | bool | false | 是否启用距离衰减,目前为线性衰减。Whether to enable distance falloff (currently linear). |
LaunchParams | FLaunchParams | — | 击退参数。Knockback parameters. |
TemporalDmgParams | FTemporalDmgParams | — | 延时伤害参数。Damage-over-time parameters. |
SlowParams | FSlowParams | — | 减速参数。Slow parameters. |
管线角色 Pipeline Role
派生配置由伤害/反应处理器在命中时转换应用(grep 验证:MassBattleProjectileMonoProcessor、MassBattleAgentBehaviorProcessor 等引用 FDamage_Point 家族,同类路径消费 debuff 配置);FDebuffing 运行时状态由 MassBattleDebuffMonoProcessor 修改(经 Lock/Unlock 保护,grep 验证)。减速实体由 UMassBattleDebuffSubsystem 生成(见 Subsystems/MassBattleDebuffSubsystem.html),其快照骨架模板 Key 为 Debuff_Slow / Debuff_TemporalDmg。
The variants are applied by damage/reaction processors at hit time (verified by grep: MassBattleProjectileMonoProcessor, MassBattleAgentBehaviorProcessor etc. reference the FDamage_Point family; sibling paths consume the debuff configs); FDebuffing runtime state is mutated by MassBattleDebuffMonoProcessor (protected by Lock/Unlock, verified by grep). Slow debuffs are spawned by UMassBattleDebuffSubsystem (see Subsystems/MassBattleDebuffSubsystem.html), with snapshot skeleton template keys Debuff_Slow / Debuff_TemporalDmg.