using Unity.Entities;
using Unity.NetCode;
namespace ProjectM.Simulation
{
///
/// One runtime stat modifier (from an upgrade, pickup, or buff) on a modifiable entity. The
/// per-entity DynamicBuffer of these is the server-authoritative source StatRecomputeSystem folds
/// into the effective-stat components, on both the server and the predicting client.
///
/// Replication: this is a GhostField buffer, so it is part of the ghost snapshot and is restored on
/// rollback - that is what lets the predicting owner recompute identical effective stats.
/// OwnerSendType.All is explicit so the owning (predicting) client receives it; without it the
/// owner would recompute from an empty list and mispredict every tick. Target/Op replicate as raw
/// bytes (not the enums) to keep the generated serializer trivial and avoid the cross-assembly
/// enum-codegen hazard that already de-Bursted ProjectileClassificationSystem.
///
[GhostComponent(OwnerSendType = SendToOwnerType.All)]
[InternalBufferCapacity(8)]
public struct StatModifier : IBufferElementData
{
/// The this modifier applies to (stored as a byte).
[GhostField] public byte Target;
/// The combine operation (stored as a byte).
[GhostField] public byte Op;
/// Magnitude: a flat amount, or a fractional percent (0.1 = +10%).
[GhostField(Quantization = 1000)] public float Value;
/// Provenance tag (e.g. pickup SpawnId / debug sentinel). Reserved for future ClearByType / timed buffs.
[GhostField] public uint SourceId;
}
}