For AI agents: the complete documentation index is available at /AchReactive/en/llms.txt, the full documentation bundle is available at /AchReactive/en/llms-full.txt, and this page is available as Markdown at /AchReactive/en/usage/reactions.md.

Reactions and default behaviors

Execution flow

var engine = new ReactionEngine();
engine.Run("on_use", skillData, ctx);

Run(trigger, data, ctx) iterates over data.reactions and processes each reaction as follows.

1. Does the trigger channel name match?      (otherwise skip)
2. Does the trigger guard pass?              (TriggerRegistry, passes if none)
3. Do all conditions (AND) pass?             (ConditionRegistry)
4. Execute effects in order                  (EffectRegistry)

The return value is the number of reactions actually executed.

ReactionContext

var ctx = new ReactionContext
{
    Source  = caster,     // subject
    Target  = target,     // single target
    Targets = targets,    // area targets (takes priority if present)
    World   = world,      // spawn/query boundary
};

An effect reads its own arguments from ctx.Params. The engine injects them per item.

Default effects

typeDescriptionparams
damagereduces hp by atk*power + flat - defpower, flat
healheals atk*power + flat (capped at hp_max)power, flat
set_statset a stat base valuestat, value
add_statincrease/decrease a stat base valuestat, delta
add_modifieradd a stat modifier (basic buff form)stat, modifier, value, source
remove_modifierremove modifiers for a source tokensource
spawnspawn an entity via WorldentityId
logdebug logmessage

The modifier value is one of flat / percent_add / percent_mul. The targets are all of Targets if present, otherwise Target.

Default conditions

typeDescriptionparams
alwaysalways true—
alive / deadtarget alive/dead—
chancepass by probabilityvalue (0~1)
hp_below / hp_abovecompare HP ratiovalue (0~1)
stat_above / stat_belowcompare a stat valuestat, value

Unless otherwise specified, conditions evaluate Target (or Source if absent).

Default trigger guard

Most triggers (on_use, on_hit, on_equip, etc.) fire on the channel name alone, so they have no guard. Only triggers that need a threshold comparison have a guard.

typeDescriptiontriggerParams
on_hp_belowfires only when Source's HP ratio is at or below thresholdthreshold (0~1)

Stat conventions

The default effects/conditions use the following keys (StatKeys). To use a different scheme, register the effect directly to override it.

KeyMeaning
hpcurrent health (resource)
hp_maxmaximum health (denominator for ratio conditions)
atkattack power (modifiers applied)
defdefense (modifiers applied)