Skip to content

defineEffect ​

Function of @v12-engine/engine

ts
export declare function defineEffect<K extends keyof EffectTypes>(def: {
    type: K;
    run: (context: EffectContext, effect: EffectOf<K>) => void;
} & EffectTypeOptions): EffectType<K>;

A kind of effect, its type and what it does together: defineEffect({ type: 'pull', run: (context, effect) => ... }), listed in Rules.effects. Its fields are said by declaring the type in EffectTypes (declare module '@v12-engine/engine' { interface EffectTypes { pull: { distance: number } } }), so that a handler reads them typed, and an ability's effect of the type is checked for them