1
0

DamageModifierSet.cs 1.3 KB

123456789101112131415161718192021222324252627
  1. using Content.Shared.Damage.Prototypes;
  2. using Robust.Shared.Serialization;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
  4. namespace Content.Shared.Damage
  5. {
  6. /// <summary>
  7. /// A set of coefficients or flat modifiers to damage types. Can be applied to <see cref="DamageSpecifier"/> using <see
  8. /// cref="DamageSpecifier.ApplyModifierSet(DamageSpecifier, DamageModifierSet)"/>. This can be done several times as the
  9. /// <see cref="DamageSpecifier"/> is passed to it's final target. By default the receiving <see cref="DamageableComponent"/>, will
  10. /// also apply it's own <see cref="DamageModifierSet"/>.
  11. /// </summary>
  12. /// <remarks>
  13. /// The modifier will only ever be applied to damage that is being dealt. Healing is unmodified.
  14. /// </remarks>
  15. [DataDefinition]
  16. [Serializable, NetSerializable]
  17. [Virtual]
  18. public partial class DamageModifierSet
  19. {
  20. [DataField("coefficients", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, DamageTypePrototype>))]
  21. public Dictionary<string, float> Coefficients = new();
  22. [DataField("flatReductions", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, DamageTypePrototype>))]
  23. public Dictionary<string, float> FlatReduction = new();
  24. }
  25. }