Ix Dev 7 - Effects 1 - Overview
Effects are plain JSON data objects that describe what should happen, without encoding specific targets and other run-time behavior. They're a core part of the game's systems, acting as the lowest layer of functionality for game data & scripting.
Effect Structure
Effects have a few core properties:
- an ID, from a hardcoded list of supported effects
- an optional explicit target, overriding the default for that effect type
- a list of conditions, applied against the source entity; the effect fails the chain if any source condition fails.
- a list of conditions, applied against every target entity; targets that fail any condition are excluded from the effect, and the effect fails if all targets are excluded.
Effect Shape
Loading syntax highlighter...
Effect Targets
Effects have a concept of "default" and explicit targets. Effect appliers choose a default target that makes sense for their effect; cost and grant effects apply to the source by default, while damage effects apply to each target (filtered by targetConditions).
Effect appliers use getEffectTargets, which applies targetCondition filtering automatically when retrieving the list.
Loading syntax highlighter...
Context
Effects are applied with an effect context, populated at runtime with the concrete entities (or IDs) in scope. They also have an optional direct | indirect (defaults to assuming indirect); this is used in part to differentiate initial vs recurring effects.
Loading syntax highlighter...
Effect Appliers
Effect appliers