2022-01-18 16:44:22 -05:00
|
|
|
using System.Text.Json.Serialization;
|
2021-07-31 04:50:32 -07:00
|
|
|
using Content.Shared.Chemistry.Reagent;
|
|
|
|
|
using Content.Shared.Damage;
|
2021-11-27 00:31:49 -07:00
|
|
|
using Content.Shared.FixedPoint;
|
2021-10-21 07:30:55 +11:00
|
|
|
using JetBrains.Annotations;
|
2021-07-31 04:50:32 -07:00
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-09-15 03:07:37 +10:00
|
|
|
/// Default metabolism for medicine reagents.
|
2021-07-31 04:50:32 -07:00
|
|
|
/// </summary>
|
2021-10-21 07:30:55 +11:00
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class HealthChange : ReagentEffect
|
2021-07-31 04:50:32 -07:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-09-15 03:07:37 +10:00
|
|
|
/// Damage to apply every metabolism cycle. Damage Ignores resistances.
|
2021-07-31 04:50:32 -07:00
|
|
|
/// </summary>
|
2022-01-18 16:44:22 -05:00
|
|
|
[JsonPropertyName("damage")]
|
2021-09-15 03:07:37 +10:00
|
|
|
[DataField("damage", required: true)]
|
|
|
|
|
public DamageSpecifier Damage = default!;
|
2021-07-31 04:50:32 -07:00
|
|
|
|
2021-11-27 00:31:49 -07:00
|
|
|
/// <summary>
|
|
|
|
|
/// Should this effect scale the damage by the amount of chemical in the solution?
|
|
|
|
|
/// Useful for touch reactions, like styptic powder or acid.
|
|
|
|
|
/// </summary>
|
2022-01-18 16:44:22 -05:00
|
|
|
[JsonPropertyName("scaleByQuantity")]
|
2021-11-27 00:31:49 -07:00
|
|
|
[DataField("scaleByQuantity")]
|
|
|
|
|
public bool ScaleByQuantity = false;
|
|
|
|
|
|
|
|
|
|
[DataField("ignoreResistances")]
|
2022-01-18 16:44:22 -05:00
|
|
|
[JsonPropertyName("ignoreResistances")]
|
2021-11-27 00:31:49 -07:00
|
|
|
public bool IgnoreResistances = true;
|
|
|
|
|
|
2021-11-21 00:35:02 -07:00
|
|
|
public override void Effect(ReagentEffectArgs args)
|
2021-07-31 04:50:32 -07:00
|
|
|
{
|
2021-11-27 00:31:49 -07:00
|
|
|
var scale = ScaleByQuantity ? args.Quantity : FixedPoint2.New(1);
|
|
|
|
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(args.SolutionEntity, Damage * scale, IgnoreResistances);
|
2021-07-31 04:50:32 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|