diff --git a/Content.Server/Chemistry/ReagentEffectConditions/MobStateCondition.cs b/Content.Server/Chemistry/ReagentEffectConditions/MobStateCondition.cs new file mode 100644 index 0000000000..45d8ddda07 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffectConditions/MobStateCondition.cs @@ -0,0 +1,26 @@ +using Content.Shared.Chemistry.Reagent; +using Content.Shared.Mobs; +using Content.Shared.Mobs.Components; + +namespace Content.Server.Chemistry.ReagentEffectConditions +{ + public sealed class MobStateCondition : ReagentEffectCondition + { + + + [DataField("mobstate")] + public MobState mobstate = MobState.Alive; + + public override bool Condition(ReagentEffectArgs args) + { + if (args.EntityManager.TryGetComponent(args.SolutionEntity, out MobStateComponent? mobState)) + { + if (mobState.CurrentState == mobstate) + return true; + } + + return false; + } + } +} + diff --git a/Resources/Prototypes/Reagents/medicine.yml b/Resources/Prototypes/Reagents/medicine.yml index 5fc0d36988..f7260c4eb5 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -227,9 +227,9 @@ effects: - !type:HealthChange conditions: - - !type:TotalDamage # they gotta be in crit first - min: 100 + - !type:MobStateCondition + mobstate: Critical - !type:ReagentThreshold min: 0 max: 20