Expand description
Developer-facing effect-authoring helpers (design §4.1).
This is the second of the two real gaps the generalization closes (design
§0): today the only HandlerFns that exist are buried in pokered’s
#[cfg(test)] parity harness, with no ergonomic, documented way to author a
move / ability / item / weather. This module is concept-free: it adds no
new runtime type — it is pure constructors over the existing
Effect / EventHook
shape (plus the typed RelayVar accessors, which
live on RelayVar itself). It introduces no game concept and no
rand; a game authors a const Effect with zero-capture fn handlers.
§The effect! macro
Builds the same &'static [EventHook] table the engine folds, in a
const/static context, so registrations stay zero-alloc constants:
fn flamethrower<P: EffectProvider + ?Sized>() -> Effect<P> {
effect!(EffectId(0x10), EffectType::Move, {
DamagingHit => my_hit::<P>,
Residual(20) => my_residual::<P>, // explicit on<Event>Order
})
}The first form (Event => fn) defaults order to u32::MAX (fires last,
matching the engine’s EventHook default); the second form
(Event(order) => fn) sets on<Event>Order explicitly. priority defaults
to 0 and sub_order to None (derive from the effect’s EffectType),
exactly as a hand-written EventHook would.