Characteristic.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Robust.Shared.Serialization;
  2. namespace Content.Shared._Stalker.Characteristics;
  3. [Serializable, NetSerializable]
  4. public struct Characteristic
  5. {
  6. public readonly CharacteristicPrototype Proto;
  7. public string ProtoId => Proto.ID;
  8. public string Name => Proto.Name;
  9. public string Description => Proto.Description;
  10. public CharacteristicAccess Access => Proto.Access;
  11. public CharacteristicType Type => Proto.Type;
  12. public int MinLevel => Proto.MinLevel;
  13. public int MaxLevel => Proto.MaxLevel;
  14. public int BaseLevel => Proto.BaseLevel;
  15. public int DefaultLevel => Proto.DefaultLevel;
  16. public int Value => Level - BaseLevel;
  17. public int Level { get; private set; }
  18. public Characteristic(CharacteristicPrototype proto)
  19. {
  20. Proto = proto;
  21. Level = DefaultLevel;
  22. }
  23. public Characteristic(Characteristic characteristic)
  24. {
  25. Proto = characteristic.Proto;
  26. Level = characteristic.Level;
  27. }
  28. public Characteristic WithLevel(int level)
  29. {
  30. return new(this) { Level = level };
  31. }
  32. }