Files
crystall-punk-14/Content.Shared/_CP14/MagicSpell/Spells/CP14SpellApplyStatusEffect.cs
Ed 36d3ba35d1 Replace SharedStatusEffectsSystem with StatusEffectsSystem
Updated references from SharedStatusEffectsSystem to StatusEffectsSystem in spell and magic weakness systems to use the correct status effects system implementation.
2025-07-21 11:36:17 +03:00

30 lines
859 B
C#

using Content.Shared.StatusEffectNew;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.MagicSpell.Spells;
public sealed partial class CP14SpellApplyStatusEffect : CP14SpellEffect
{
[DataField(required: true)]
public EntProtoId StatusEffect = default;
[DataField(required: true)]
public TimeSpan Duration = TimeSpan.FromSeconds(1f);
[DataField]
public bool Refresh = true;
public override void Effect(EntityManager entManager, CP14SpellEffectBaseArgs args)
{
if (args.Target is null)
return;
var effectSys = entManager.System<StatusEffectsSystem>();
if (!Refresh)
effectSys.TryAddStatusEffectDuration(args.Target.Value, StatusEffect, Duration);
else
effectSys.TrySetStatusEffectDuration(args.Target.Value, StatusEffect, Duration);
}
}