Table of Contents

Namespace ElectricDrill.AstraRpgFramework.Conditions

Classes

AllConditions

Composite condition that evaluates to true only when ALL child conditions are satisfied (logical AND). An empty condition list evaluates to true.

AlwaysFalseCondition

Condition that always evaluates to false. Useful to explicitly disable a condition slot during development or as a short-circuit placeholder.

AlwaysTrueCondition

Condition that always evaluates to true. Useful as a default or placeholder in condition chains.

AnyCondition

Composite condition that evaluates to true when ANY child condition is satisfied (logical OR). An empty condition list evaluates to false.

AtLeastNCondition

Composite condition that evaluates to true when at least ElectricDrill.AstraRpgFramework.Conditions.AtLeastNCondition._n child conditions are satisfied.

With N = 1 this is equivalent to AnyCondition. With N = 0 it always evaluates to true.

AtMostNCondition

Composite condition that evaluates to true when at most ElectricDrill.AstraRpgFramework.Conditions.AtMostNCondition._n child conditions are satisfied.

With N = 0 this is equivalent to NoneCondition. An empty condition list always evaluates to true.

AttributeThresholdCondition

Condition that checks an attribute on the resolved target entity against a threshold.

When Absolute, the attribute's final value is compared directly against the configured absolute threshold.
When Percentage, the attribute's position within its defined range [MinValue, MaxValue] is expressed as a percentage (0–100) and compared against the configured percentage threshold. Requires the attribute to have HasMaxValue = true; returns false otherwise. When HasMinValue = false, 0 is used as the implicit minimum. Returns false if the effective range (MaxValue − MinValue) is zero.

Negative MinValue is fully supported: an attribute with MinValue = −100 and MaxValue = 100 at value 0 evaluates to 50 %.

ChangedAttributeCondition

Condition that checks whether the payload of an attribute change event refers to a specific attribute.

Returns false when EventPayload is not an AttributeChangeInfo, when the configured attribute is null, or when the payload attribute is null.

ChangedStatCondition

Condition that checks whether the payload of a stat change event refers to a specific stat.

Returns false when EventPayload is not a StatChangeInfo, when the configured stat is null, or when the payload stat is null.

Condition

Abstract base class for all conditions in the Astra RPG condition system. Conditions are pure predicates evaluated against an EvaluationContext. Subclass and implement Evaluate(EvaluationContext) to define custom logic.

Concrete subclasses must be decorated with [Serializable] to participate in Unity's [SerializeReference] polymorphic serialization.

ConditionCompatibility

Design-time utility that checks whether a Condition subclass is compatible with a given trigger payload type, based on ConditionPayloadAttribute metadata.

A condition with noConditionPayloadAttribute is payload-agnostic and compatible with every trigger. A condition with one or more attributes is compatible when the trigger's payload type is assignable to at least one declared accepted type.

ConditionPayloadAttribute

Declares which event-payload type a Condition subclass can consume.

Apply one or more instances to a Condition subclass to declare the payload types it supports. A condition with no attribute is considered payload-agnostic (compatible with any trigger). A condition with one or more attributes is compatible with a trigger whose PayloadType is assignable to at least one of the declared AcceptedType values.

EntityHasTagCondition

Condition that checks whether the resolved target entity has the required tags.

The entity is resolved from the configured ElectricDrill.AstraRpgFramework.Conditions.EntityHasTagCondition._target slot in the EvaluationContext. Returns false if the target is null or does not implement ITaggable.

EntityLevelCondition

Condition that checks the resolved target entity's current level against a fixed threshold.

The entity is resolved from the configured ElectricDrill.AstraRpgFramework.Conditions.EntityLevelCondition._target slot in the EvaluationContext. Returns false if the target cannot be resolved.

EntityLevelThresholdTransitionCondition

Condition that checks whether an entity level comparison against a fixed threshold becomes satisfied or ceases to be satisfied across a level change payload.

Returns false when the payload does not implement IHasValueChange<T> for int.

EntityReferenceCondition

Condition that compares two entity slots resolved from the current EvaluationContext.

SameEntity and DifferentEntity use reference identity over resolved EntityCore instances and do not treat two missing entities as equal. Use the explicit null-check modes when absence is the desired predicate.

ExactlyNCondition

Composite condition that evaluates to true when exactly ElectricDrill.AstraRpgFramework.Conditions.ExactlyNCondition._n child conditions are satisfied.

With N = 1 this is equivalent to an exclusive-OR (XOR) across all children. An empty condition list with N = 0 evaluates to true.

HasActiveModifierTagCondition

Condition that evaluates to true when at least one active modifier on Holder carries all tags in ElectricDrill.AstraRpgFramework.Conditions.HasActiveModifierTagCondition._tags.

Requires an IActiveModifierTagProvider component on the holder's GameObject (typically provided by the Modifiers package). Returns false when the holder is null or lacks the component.

HolderLevelCondition

Condition that checks the holder entity's current level against a fixed threshold.

IntValueChangeDirectionCondition

Condition that checks the direction of an int value change projected from EventPayload.

Returns false when the payload does not implement IHasValueChange<T> for int.

IntValueChangeModuloCondition

Condition that checks an int value projected from EventPayload against a modulo rule.

Returns false when the payload does not implement IHasValueChange<T> for int, or when ElectricDrill.AstraRpgFramework.Conditions.IntValueChangeModuloCondition._divisor is not positive. Both the projected value and the expected remainder are normalized into the range [0, divisor - 1] before comparison.

IntValueChangeThresholdCondition

Condition that compares an int value projected from EventPayload against a fixed threshold.

Returns false when the payload does not implement IHasValueChange<T> for int, or when the requested projection cannot be represented safely.

IntValueChangeThresholdTransitionCondition

Condition that checks whether an int comparison against a fixed threshold becomes satisfied or ceases to be satisfied across a value change payload.

Returns false when the payload does not implement IHasValueChange<T> for int.

IsPerformerCondition

Condition that evaluates to true when Performer is the same entity as Holder (i.e., the effect was self-applied). Returns false when Performer is null.

LongValueChangeDirectionCondition

Condition that checks the direction of a long value change projected from EventPayload.

Returns false when the payload does not implement IHasValueChange<T> for long.

LongValueChangeModuloCondition

Condition that checks a long value projected from EventPayload against a modulo rule.

Returns false when the payload does not implement IHasValueChange<T> for long, or when ElectricDrill.AstraRpgFramework.Conditions.LongValueChangeModuloCondition._divisor is not positive. Both the projected value and the expected remainder are normalized into the range [0, divisor - 1] before comparison.

LongValueChangeThresholdCondition

Condition that compares a long value projected from EventPayload against a fixed threshold.

Returns false when the payload does not implement IHasValueChange<T> for long, or when the requested projection cannot be represented safely.

LongValueChangeThresholdTransitionCondition

Condition that checks whether a long comparison against a fixed threshold becomes satisfied or ceases to be satisfied across a value change payload.

Returns false when the payload does not implement IHasValueChange<T> for long.

NoneCondition

Composite condition that evaluates to true when NO child condition is satisfied (logical NOR). An empty condition list evaluates to true.

NotCondition

Decorator condition that negates the result of its inner condition (logical NOT). Evaluates to true when the inner condition is false, and vice-versa. When Inner is null, evaluates to true.

RandomChanceCondition

Condition that evaluates to true with the given probability.

ElectricDrill.AstraRpgFramework.Conditions.RandomChanceCondition._chance is expressed as a percentage (0–100). A value of 25 means a 25 % chance. Values ≤ 0 always return false; values ≥ 100 always return true.

StatThresholdCondition

Condition that checks a stat on the resolved target entity against a threshold.

When Absolute, the stat's final value is compared directly against ElectricDrill.AstraRpgFramework.Conditions.StatThresholdCondition._thresholdAbsolute.
When Percentage, the stat's position within its defined range [MinValue, MaxValue] is expressed as a percentage (0–100) and compared against ElectricDrill.AstraRpgFramework.Conditions.StatThresholdCondition._thresholdPercentage. Requires the stat to have HasMaxValue = true; returns false otherwise. When HasMinValue = false, 0 is used as the implicit minimum. Returns false if the effective range (MaxValue − MinValue) is zero to avoid division by zero.

Negative MinValue is fully supported: a stat with MinValue = −100 and MaxValue = 100 at value 0 evaluates to 50 %.

Structs

ConditionCompatibility.UnavailableTarget

Describes one configured ConditionTarget that is unavailable in a specific evaluation context.

ConditionEvaluationAvailability

Design-time description of the payload and entity target slots available to a Condition.

EvaluationContext

Lightweight value type passed to Evaluate(EvaluationContext) on every evaluation. Struct allocation keeps GC pressure at zero even under high tick frequency.

All fields are public for direct assignment via object-initializer syntax. Conditions must treat the context as read-only — mutations are silently discarded (pass-by-value semantics).

Enums

ComparisonMode

Defines how a numeric value is compared against a threshold.

ConditionTarget

Specifies which entity slot in an EvaluationContext a condition should target. Payload-derived slots resolve through contracts exposed by EventPayload and evaluate as null when the payload cannot supply the requested role.

ConditionTargetAvailability

Describes which ConditionTarget slots are available in a condition evaluation context.

EntityReferenceComparisonMode

Defines how two resolved entity slots should be compared.

TagMatchMode

Controls how a tag set is matched against an entity's tags.

ThresholdMode

Specifies whether a stat threshold is expressed as a raw absolute value or as a percentage of the stat's maximum value (0–100).

ThresholdSatisfactionTransition

Describes how a threshold comparison should transition across a value change.

ValueChangeComponent

Selects which numeric projection of an IHasValueChange<T> payload a condition should read.

ValueChangeDirection

Describes the direction of a numeric change between a previous and a new value.