1
0

DamageProtectionBuffSystem.cs 594 B

12345678910111213141516171819
  1. using Content.Shared.Damage.Components;
  2. namespace Content.Shared.Damage.Systems;
  3. public sealed class DamageProtectionBuffSystem : EntitySystem
  4. {
  5. public override void Initialize()
  6. {
  7. base.Initialize();
  8. SubscribeLocalEvent<DamageProtectionBuffComponent, DamageModifyEvent>(OnDamageModify);
  9. }
  10. private void OnDamageModify(EntityUid uid, DamageProtectionBuffComponent component, DamageModifyEvent args)
  11. {
  12. foreach (var modifier in component.Modifiers.Values)
  13. args.Damage = DamageSpecifier.ApplyModifierSet(args.Damage, modifier);
  14. }
  15. }