Conditions

Yes/no tests that gate powers and actions.

A condition is a test that answers true or false. Conditions are how Apoli asks questions about the world: are you sneaking? is it raining? is your health below half? They gate powers, branch meta-actions, and filter targets.

The shape of a condition

The familiar typed object:

{ "type": "apoli:sneaking" }

Conditions never do anything — they only report. Something else decides what to do with the answer.

Where conditions are used

  • On a power — the shared condition field makes a power active only while the test passes.
  • In a meta-actionapoli:if_else and friends branch on a condition.
  • In an action power — many, like apoli:action_on_hit, take a condition that must hold for the action to fire.
  • Inside other conditions — meta-conditions combine several tests.

Flavours

Like actions, conditions come typed by what they examine:

FlavourTestsExamples
Entityone entityapoli:sneaking, apoli:health
Bi-entitya pairapoli:attacker, apoli:undirected
Blocka blockapoli:block_state, apoli:in_tag
Iteman item stackapoli:enchantment, apoli:food
Damagea damage sourceapoli:type, apoli:amount
Biome / Fluidsurroundingsapoli:temperature, apoli:fluid
Metaother conditionsapoli:all_of, apoli:any_of

Inverting

Add "inverted": true to flip any condition. There is no not_sneaking — you invert sneaking:

{ "type": "apoli:sneaking", "inverted": true }

Combining — the meta-conditions

To test several things at once, wrap them:

{
  "type": "apoli:and",
  "conditions": [
    { "type": "apoli:sneaking" },
    { "type": "apoli:on_fire", "inverted": true }
  ]
}
Meta-conditionPasses when…
apoli:and / apoli:all_ofevery listed condition passes
apoli:or / apoli:any_ofany listed condition passes
apoli:constantalways the value you give it (true/false)

Nest these freely — an apoli:or of two apoli:ands is fine.

Next