Files
crystall-punk-14/Content.Shared/_CP14/MagicRitual/Requirements/RequiredStability.cs
Ed d2c5aa74b4 Ritualizm (#474)
* ritual cucumber setup

* entities requirements

* try graph???

* Revert "try graph???"

This reverts commit c90c6353cb.

* pipyau

* fixes

* yay, it works

* spawn effect

* regex lower message restrictions

* unique speakers support

* apply entity effect ritual

* ritual chalk

* Update SpawnEntity.cs

* ritual stability

* stability event

* add guidebook description to all ritual actions

* Readability added

* Update RequiredResource.cs

* finish describer

* clean up describer

* Update triggers.ftl

* cave ambient loop

* parry sound update

* rituals end start

* magic ambience add

* global sharedization

* Update phases.yml

* daytime requirement

* Update phases.yml

* start ritual

* fixes

* more ambient work

* rritual visualizer

* end ritual

* magic orbs!

* required orbs

* orbs design

* consume orbs

* setup neutral cluster triggers and edges

* listener proxy

* restucture graph

* fix time triggers

* healing cluster

* fixes

* Create CP14RitualTest.cs

* test errors for check test

* YEEEE

* Fuck triggers, its broken now, YAY

* triggers redo

* fix

* fix test

* Update CP14RitualTest.cs

* Update neutral_cluster.yml

* Update CP14RitualSystem.Triggers.cs

* clean up, documentation

* redo triggers again

* and another one

* species sacrifice trigger

* whitelist trigger

* fix

* describer refactor

* fix memory leaking  + hyperlinks

* dd
2024-10-06 18:04:18 +03:00

37 lines
1.2 KiB
C#

using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.MagicRitual.Requirements;
/// <summary>
/// Requires that the stability of the ritual be within specified limits. If the stability is above or below the specified values, the check will fail
/// </summary>
public sealed partial class RequiredStability : CP14RitualRequirement
{
[DataField]
public float Min = 0;
[DataField]
public float Max = 1;
public override string? GetGuidebookRequirementDescription(IPrototypeManager prototype, IEntitySystemManager entSys)
{
return Min switch
{
> 0 when Max < 1 =>
Loc.GetString("cp14-ritual-required-stability-minmax", ("min", Min*100), ("max", Max*100)),
> 0 => Loc.GetString("cp14-ritual-required-stability-min", ("min", Min*100)),
< 0 => Loc.GetString("cp14-ritual-required-stability-max", ("min", Max*100)),
_ => null,
};
}
public override bool Check(EntityManager entManager, Entity<CP14MagicRitualPhaseComponent> phaseEnt, float stability)
{
if (phaseEnt.Comp.Ritual is null)
return false;
var s = phaseEnt.Comp.Ritual.Value.Comp.Stability;
return !(s < Min) && !(s > Max);
}
}