Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

data/effects/

An effect: a bag of parts applied to an entity. An instant effect changes bases and leaves nothing behind; a duration or infinite effect lives as an instance that adds stat modifiers and tags until it ends, and a periodic one runs its instant parts each period. Effects deal damage, heal, chain other effects, grant immunity, cleanse, and run damage hooks while they last. Cooldowns and costs are effects too. Abilities, hooks and items apply them, and stacking decides what a second application does.

Registrymanifold:effect
Filesdata/effects/*.ron, *.update.ron, *.final.ron
Sidesboth: the server and every client load it, and the handshake’s data hash covers it
Readsmanifold:predicate, manifold:stat, manifold:gameplay-config
ContractGameplay framework, data stage

Entry

A record, written Effect(..); the name before the parentheses is optional.

FieldTypeRequiredDefaultDescription
idstringyesThe effect’s key, <mod-id>:<name>.
asset_tagslist of stringnononeTags describing the effect itself (x:effect.poison), which immunity and cleanse queries test. Tagging it manifold:effect.applies_to_dead lets it apply to dead entities.
durationeffect-durationnoInstantHow long it lasts.
periodPeriod or Nonenonot periodicRuns the instant parts every period instead of once. Not for an instant effect.
modifierslist of ModifiernononeStat modifiers: an instant or periodic effect changes the stats’ bases; a duration effect adds modifiers while it is live.
grant_tagslist of stringnononeTags the holder has while the instance is live.
damageDamageSpec or NonenononeDamage dealt to the holder when applied, or each period.
healnumber or NonenononeAn amount healed when applied, or each period, through manifold:incoming_healing.
apply_effectslist of effect-refnononeEffects applied with it (at most four deep).
requirementscondition or Nonenoalways appliesA condition in the effect_apply context that must hold for the effect to apply.
ongoingTagQuery or Nonenonever inhibitedWhile the holder’s tags do not match, the instance is inhibited: it keeps its timer, and its modifiers and tags are revoked.
immunityTagQuery or NonenononeWhile live, blocks applications of effects whose asset tags match.
cleanseTagQuery or NonenononeWhen applied, removes the holder’s effects whose asset tags match.
damage_hookslist of DamageHooknononeDamage hooks active while the instance is live. Not for an instant effect.
stackingStacking or NonenoIndependent(max_instances: 8)What a second application does. Not for an instant effect.
stacking_groupstring or Nonenothe effect’s own keyEffects of one group stack with each other.
removallist of RemovalTriggernononeEvents that end the instance. Not for an instant effect.
cuestring or NonenononeA cue played when applied and each period (manifold:cue key).
uiEffectUi or Noneno<mod>.effect.<id>.name, shown, timer hiddenPlayer-facing presentation.
persistboolnofalseWhether the instance is saved with its holder.
persist_through_deathboolnofalseWhether the instance survives its holder’s death.
set_by_callerlist of stringnononeNames the applier sets per application, read as v.<name> in the effect’s numbers.
partslist of PartnononeRegistered native parts, run after the built-in parts in list order.
executionreserved or NonenononeReserved for guest executions (Talos B6).

Example

From tools/test-mods/guide-creature/data/effects/lunge.ron:

Effect(
    id: "guide-creature:cooldown.lunge",
    duration: For("3s"),
    grant_tags: ["guide-creature:cooldown.lunge"],
    stacking: Replace,
)

Types

Period

An effect’s period. Write every or secs.

A record: Period(..) or (..).

FieldTypeRequiredDefaultDescription
everynumbernouse secsThe period: ticks as an integer, seconds as "1s", or a number of ticks. At least one tick.
secsnumbernouse everyThe period in seconds, as a number.
on_applyboolnofalseWhether the instant parts also run once on application.

Modifier

A stat modifier an effect adds.

A record: Modifier(..) or (..).

FieldTypeRequiredDefaultDescription
statstringyesThe stat (manifold:stat key). A duration effect may not modify a resource: modify its maximum.
opModOpyesHow it combines.
valuenumberyesThe amount, a number in the effect_apply context.
per_stackboolnofalseWhether the amount is multiplied by the instance’s stack count.
scopecondition or Nonenoalways countsA condition in the damage context: the modifier counts only when the stat is read while a hit is resolved and it holds. Only on a duration effect.

ModOp

How a stat modifier combines with the stat’s other modifiers. A stat’s value is (base + Σ Flat) × (1 + Σ Increased) × Π (1 + More) + Σ Final, then the last Override, then the stat’s clamp and rounding.

VariantWrittenDescription
FlatFlatAdded to the base.
IncreasedIncreasedSummed with the other Increased modifiers, then multiplies.
MoreMoreMultiplies on its own (0.5 is +50%, -0.5 is half).
FinalFinalAdded after the multipliers.
OverrideOverrideReplaces the value; the last applied wins.

DamageSpec

Damage to deal: an effect’s damage, or an ability hit’s.

A record: DamageSpec(..) or (..).

FieldTypeRequiredDefaultDescription
damage_typestringyesThe damage type (manifold:damage-type key).
basenumberyesThe base amount, before the formula, a number in the use site’s context.
elementstringnothe damage type’s elementThe element (manifold:element key).
context_tagslist of stringnononeTags the hit carries for hooks and conditions (ContextTags(..)).
can_critboolnotrueWhether the formula may roll a critical hit.

TagQuery

A tag query: which tag sets match. Every part written must hold; () matches everything.

A record: TagQuery(..) or (..).

FieldTypeRequiredDefaultDescription
alllist of tag-matchnononeEvery one of these tags.
anylist of tag-matchnononeAt least one of these tags.
nonelist of tag-matchnononeNone of these tags.
orlist of TagQuerynononeAt least one of these queries.
notTagQuerynononeThis query must not match.

DamageHook

A data hook on the damage pipeline, evaluated in the damage context (This is the victim; v.damage_amount is the stage’s amount). Within a stage, hooks run by priority, then side, then source, then list order.

A record: DamageHook(..) or (..).

FieldTypeRequiredDefaultDescription
stageDamageStageyesThe pipeline stage it runs at, which limits its actions.
sideHookSideyesWhich participant carries it: an Attacker hook on a sword’s effect runs when its holder attacks, a Victim hook on a shield’s when its holder is hit.
priorityi16no0Higher runs first, -32768 to 32767.
whencondition or NonenoalwaysA condition that must hold.
actionDamageActionyesWhat it does.

DamageStage

A stage of the damage pipeline.

VariantWrittenDescription
AdmitAdmitBefore anything: Cancel.
GatherGatherThe attacker’s part: Add, Multiply, Set, AddContextTag.
ConvertConvertBetween elements: Convert.
MitigateMitigateThe victim’s part: Add, Multiply, Set.
PreApplyPreApplyLast changes (blocks, parries, shields): all of the above and Cancel.
PreDeathPreDeathA killing hit only: Cancel (the victim survives), ApplyEffect.
PostHitPostHitAfter the hit: ApplyEffect, Reflect, Leech, Knockback, Cue.
PostKillPostKillAfter a kill: as PostHit.

HookSide

The participant a hook belongs to.

VariantWrittenDescription
AttackerAttackerThe attacker.
DirectDirectThe direct source (an arrow).
OwnerOwnerThe attacker’s owner.
VictimVictimThe victim.

DamageAction

What a hook does. Actions may also be written positionally, in field order (Cancel("x:cancel.blocked")); Add, Multiply and Set take (<value>) or (<element>, <value>).

VariantWrittenDescription
AddAdd(value: .., element: ..)Adds to an element’s amount.
MultiplyMultiply(value: .., element: ..)Multiplies by 1 + value, on one element or all of them.
SetSet(value: .., element: ..)Sets one element’s amount, or the total (rescaling the elements).
ConvertConvert(from: .., to: .., fraction: ..)Moves a fraction of one element’s amount into another.
CancelCancel(reason: ..)Stops the hit, with a reason tag (manifold:cancel.* or the game’s).
AddContextTagAddContextTag(tag: ..)Adds a tag to the hit’s context tags.
ApplyEffectApplyEffect(to: .., effect: .., level: ..)Applies an effect to a participant, with the hook’s holder as source.
ReflectReflect(fraction: .., damage_type: ..)Thorns: deals a fraction of the applied amount back to the attacker as a new hit (never more than two levels deep).
LeechLeech(fraction: .., resource: ..)Lifesteal: heals the attacker by a fraction of the applied amount.
KnockbackKnockback(add: ..)Adds to the hit’s horizontal knockback, m/s.
CueCue(cue: ..)Plays a cue at the hit.

Add fields:

FieldTypeRequiredDefaultDescription
valuenumberyesThe amount, a number.
elementstring or Nonenothe hit’s primary elementThe element (manifold:element key).

Multiply fields:

FieldTypeRequiredDefaultDescription
valuenumberyesThe change (-0.5 halves).
elementstring or Nonenoevery elementThe element.

Set fields:

FieldTypeRequiredDefaultDescription
valuenumberyesThe amount.
elementstring or Nonenothe totalThe element.

Convert fields:

FieldTypeRequiredDefaultDescription
fromstringyesThe element taken from.
tostringyesThe element given to.
fractionnumberyesThe fraction, clamped to 0..=1.

Cancel fields:

FieldTypeRequiredDefaultDescription
reasonstringyesThe reason tag.

AddContextTag fields:

FieldTypeRequiredDefaultDescription
tagstringyesThe tag.

ApplyEffect fields:

FieldTypeRequiredDefaultDescription
tosubjectyesThe participant.
effectstringyesThe effect (manifold:effect key).
levelnumbernothe holding effect’sThe effect’s level.

Reflect fields:

FieldTypeRequiredDefaultDescription
fractionnumberyesThe fraction.
damage_typestringyesThe reflected hit’s damage type.

Leech fields:

FieldTypeRequiredDefaultDescription
fractionnumberyesThe fraction.
resourcestringnomanifold:healthThe resource healed (manifold:stat key).

Knockback fields:

FieldTypeRequiredDefaultDescription
addnumberyesThe speed added.

Cue fields:

FieldTypeRequiredDefaultDescription
cuestringyesThe cue (manifold:cue key).

Stacking

What a second application of an effect does.

VariantWrittenDescription
IndependentIndependent(max_instances: ..)Each application is a new instance; past the cap the oldest goes.
ReplaceReplaceThe new instance replaces the old one (whose removal triggers do not fire).
PerSourcePerSource(reapply: ..)One instance per source.
AggregateAggregate(by: .., max_stacks: .., reapply: .., expire: ..)One instance whose stack count grows.
StrongestWinsStrongestWins(hide_weaker: ..)The strongest instance of the group is active.

Independent fields:

FieldTypeRequiredDefaultDescription
max_instancesu8yesThe most instances.

PerSource fields:

FieldTypeRequiredDefaultDescription
reapplyReapplyyesWhat a reapplication by the same source does to the duration.

Aggregate fields:

FieldTypeRequiredDefaultDescription
byAggregateByyesWhat the stacks are counted per.
max_stacksu16yesThe most stacks.
reapplyReapplyyesWhat a reapplication does to the duration.
expireStackExpireyesHow stacks expire.

StrongestWins fields:

FieldTypeRequiredDefaultDescription
hide_weakerboolyesWhether weaker instances stay hidden (at most two per group) rather than going.

Reapply

What reapplying does to an instance’s duration.

VariantWrittenDescription
RefreshRefreshResets the expiry (not the period’s phase).
ExtendExtend(max_ticks: ..)Adds the new duration, up to a cap.
KeepKeepKeeps the current expiry.

Extend fields:

FieldTypeRequiredDefaultDescription
max_ticksu32yesThe most ticks remaining after extending.

AggregateBy

What Aggregate counts stacks per.

VariantWrittenDescription
TargetTargetOne instance per target, whatever the source.
SourceSourceOne instance per source.

StackExpire

How aggregated stacks expire.

VariantWrittenDescription
AllAllAll at once.
OneOneOne at a time: at expiry one stack falls off and the next runs for one stack’s duration (charges that recover in turn).

RemovalTrigger

An event that ends an effect instance. Distances are checked four times a second. A trigger may also be written positionally (TagAdded((any: [..]))).

VariantWrittenDescription
TagAddedTagAdded(query: ..)A matching tag is added to the holder from another source.
DamageTakenDamageTaken(min: ..)The holder took at least min damage in one hit.
DealtDamageDealtDamageThe holder dealt damage.
AbilityActivatedAbilityActivated(query: ..)The holder activated an ability whose tags match.
SourceDiedSourceDiedThe source died.
SourceGoneSourceGoneThe source despawned or unloaded.
SourceBeyondSourceBeyond(metres: ..)The source is farther away than metres.
MovedMoved(metres: ..)The holder moved metres from where the effect applied.
ChargesCharges(count: .., spent_on: ..)Each event spends a charge; the last ends the instance. At most one per effect.

TagAdded fields:

FieldTypeRequiredDefaultDescription
queryTagQueryyesThe tags.

DamageTaken fields:

FieldTypeRequiredDefaultDescription
minf32no0The smallest hit that counts.

AbilityActivated fields:

FieldTypeRequiredDefaultDescription
queryTagQuerynoany abilityThe ability’s tags.

SourceBeyond fields:

FieldTypeRequiredDefaultDescription
metresf32yesThe distance.

Moved fields:

FieldTypeRequiredDefaultDescription
metresf32yesThe distance.

Charges fields:

FieldTypeRequiredDefaultDescription
countu16yesThe charges, 1 to 65535.
spent_onChargeEventyesThe event that spends one.

ChargeEvent

The event that spends a Charges trigger’s charge.

VariantWrittenDescription
DamageTakenDamageTakenThe holder took damage.
DealtDamageDealtDamageThe holder dealt damage.
AbilityActivatedAbilityActivatedThe holder activated an ability.

EffectUi

An effect’s player-facing presentation, as message keys.

A record: EffectUi(..) or (..).

FieldTypeRequiredDefaultDescription
namestring or Noneno<mod>.effect.<id>.nameThe name’s message key.
iconstring or NonenononeAn icon asset.
categorystring or NonenononeA category the HUD groups effects by.
showboolnotrueWhether the HUD shows it.
timerTimerVisibilitynoHiddenWho sees its timer.

TimerVisibility

Who sees an effect’s timer.

VariantWrittenDescription
HiddenHiddenNo one.
OwnerOwnerThe holder’s owner.
SourceOwnerSourceOwnerThe owner of the effect’s source (the caster sees their debuff’s timer).
PublicPublicEvery client with the holder in scope.

Part

A registered native effect part, which another crate provides (the AI’s taunt, manifold:taunt).

A record: Part(..) or (..).

FieldTypeRequiredDefaultDescription
idstringyesThe part’s id.
argspart-argsnonone, for a part without argumentsIts arguments, as the part declares them.

Value forms used here: condition, effect-duration, effect-ref, number, part-args, reserved, subject, tag-match.