Flags functionality - thatlonelybugbear/automated-conditions-5e GitHub Wiki
AC5e processes Active Effects with relevant module flags. If the effect's condition evaluates to true
, it alters the relevant roll accordingly.
Affects rolls made by the actor who has an Active effect with this flag.
Affects rolls made by other actors whose token is within range of the source token.
-
radius=10;
— Sets the aura range in grid units.
-
singleAura;
– Only one aura of the same name applies (strongest or closest). -
includeSelf;
– Affects the aura source as well. -
allies;
– Affects only allies of the aura source. -
enemies;
– Affects only enemies of the aura source.
If neither allies
nor enemies
is used, the aura affects all tokens in range.
Affects rolls made against the actor (i.e., when the actor is the target of the roll).
Replace ACTIONTYPE
with a roll type to affect:
all
attack
check
damage
save
concentration
death
initiative
skill
tool
Replace MODE
with one of the following:
-
advantage
— Grants advantage -
disadvantage
— Imposes disadvantage -
critical
— Forces a critical success -
fumble
— Forces a critical failure -
success
— Treats the roll as a success -
fail
— Treats the roll as a failure -
bonus
— Adds a numeric or calculated bonus- When using
MODE = bonus
, include:bonus=XXX;
where XXX is:- A fixed number (e.g., bonus=2;)
- A formula, referencing actors via:
-
@
orrollingActor
— e.g.,@abilities.cha.mod
orrollingActor.cha.mod
-
#
ortargetActor
— e.g.,##attributes.spell.dc
ortargetActor.concentration.effects.size
-
auraActor
— e.g.,auraActor.attributes.ac.value
for any aura related ones.
-
- When using
Conditions are semicolon-separated expressions evaluated using a dynamic "sandbox" of data relevant to the current roll.
✅ If any one condition is true, the roll is affected.
The sandbox contains detailed data about the actor performing the roll, potential targets, and other contextual information. This data can be referenced in condition expressions like so:
rollingActor.abilities.cha.mod >= 4 && targetActor.attributes.hp.value < 10 && (fire || cold); targetActor.statuses.incapacitated;
Depending on the type of roll, actors are categorized like this:
-
rollingActor
– the actor performing the roll. -
opponentActor
– the opposing actor (if any). For example:- During an attack, this is the target of the attack.
- During a saving throw, this is the actor whose item or effect triggered the save.
-
targetActor
will be deprecated from AC5e v13.502.2
-
-
auraActor
– only present if the roll is affected by an aura. Represents the aura's source.
Each <actorType>
(e.g. rollingActor
, targetActor
) includes the following:
This mirrors the Foundry system data structure. Example fields:
rollingActor.abilities.cha.mod // Charisma modifier
rollingActor.attributes.hp.value // Current HP
Includes token-specific information:
rollingActor.token.name
rollingActor.tokenSize // token.width x token.height
rollingActor.tokenElevation // token.document.elevation
rollingActor.tokenSenses // List of token's detection modes
rollingActor.tokenUuid // Unique token UUID
rollingActor.effects // List of active effects
rollingActor.equippedItems // Array of equipped item names
Includes token statuses like prone
, bloodied
, etc.
rollingActor.statuses.prone // true if the rolling actor is prone
An Array of data, derived from race or custom type:
rollingActor.creatureType.includes('elemental') || targetActor.creatureType.includes('green')
In addition to actor data, some useful values are also available:
Key | Description |
---|---|
distance |
Distance between rolling and target token (if any) |
isConcentration |
true if this is a concentration check |
isInitiative |
true if this is an initiative roll |
isDeathSave |
true if this is a death saving throw |
isTurn |
true if it's currently the rolling actor's turn |
isTargetTurn |
true if it's the target's turn |
canSee |
true if the rolling actor can see the target |
isSeen |
true if the target can see the rolling actor |
spellLevel |
spell level if relevant |
worldTime |
Current world time in seconds |
tokenId |
Rolling actor's active token ID |
targetId |
Targeted token's ID if any |
effectOriginTokenId |
ID of the effect's origin active token |
If the roll involves a specific action or item, you'll also have access to:
activity.name
-
activity.activation.type
— e.g.,action
,bonus
,reaction
-
activity.actionType
— e.g.,mwak
,rsak
,save
-
activity.type
— item type (e.g.,spell
,feat
) -
activity.damageTypes
— array of damage types involved
-
item.name
,item.type
,item.school
(for spells) item.identifier
item.properties
All these are accessible directly as paths. For example:
('mgc' && 'fin') || ('Claw' && 'poison') // true if either an the roll involves a magical finesse weapon, or one named Claw and dealing poison damage
If the activity deals specific damage types, each one is added to the sandbox:
cold || fire // true if the damage type is either cold or fire
If the activity has an action type (e.g., mwak
, rsak
, save
, etc.), that is also flagged:
mwak // true for Melee Weapon Attack
These work in combination with other flags:
mwak && fire // true for fire-dealing melee weapon attacks
The sandbox also exposes some config constants:
CONFIG = {
abilities, skills, tools, damageTypes, spellSchools,
attackModes, actionTypes, itemProperties, etc.
}
And helpers like:
ac5e.checkDistance(), ac5e.checkVisibility(), ac5e.checkCreatureType(), ac5e.checkArmor()
This sandbox gives you powerful control over when a specific AC5e module flags should apply, letting you create smart, level-aware, context-sensitive automation with minimal code.