41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.EntityEffects;
|
|
using Robust.Shared.Prototypes;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Content.Shared._Goobstation.Chemistry;
|
|
|
|
public sealed partial class TakeStaminaDamage : EntityEffect
|
|
{
|
|
/// <summary>
|
|
/// How much stamina damage to take.
|
|
/// </summary>
|
|
[DataField]
|
|
public int Amount = 10;
|
|
|
|
/// <summary>
|
|
/// Whether stamina damage should be applied immediately
|
|
/// </summary>
|
|
[DataField]
|
|
public bool Immediate;
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
=> Loc.GetString("reagent-effect-guidebook-deal-stamina-damage",
|
|
("immediate", Immediate),
|
|
("amount", MathF.Abs(Amount)),
|
|
("chance", Probability),
|
|
("deltasign", MathF.Sign(Amount)));
|
|
|
|
public override void Effect(EntityEffectBaseArgs args)
|
|
{
|
|
if (args is EntityEffectReagentArgs reagentArgs)
|
|
{
|
|
if (reagentArgs.Scale != 1f)
|
|
return;
|
|
}
|
|
|
|
args.EntityManager.System<SharedStaminaSystem>()
|
|
.TakeStaminaDamage(args.TargetEntity, Amount, visual: false);
|
|
}
|
|
}
|