Module effects

Source
Expand description

Native ports for the event category — effect scripts (run via run_event, returning Vec<OverlordEvent>).

Effect scripts are arbitrary per-effect programs that read Entity.attributes and push events (and, for the combat ones, call ctx.* fight primitives). Like start_cast_ability they can consume the authoritative RNG (the game Random).

Scope (per the effect run_event call site): Entity, Fight, Random, CurrentTick, FightDurationTicks, and the caller Event.

Structs§

EventCtx
Inputs available to an event (effect) native fn — the effect run_event scope plus config/lookups the combat primitives need.

Functions§

bloodleak_tick
RNG-free; only used by test_effects::test_effect_with_interval.
dot_tick
Port of the damage-over-time (DoT) tick — the damage sibling of hot_tick. Same 5-slot rolling schedule (effect.dot.next cursor + effect.dot.tick.<i> amounts); on a populated slot it advances the cursor, zeroes the slot, and deals damage_entity with {dot, no_hit_anim} custom data. Unlike HoT this CONSUMES rng (damage_entity rolls one block stat_throw).
effect_tick_stun
Port of the Shield + Stun effect tick. Both deployed .scripts have the identical body ctx.tick_entity_effect(Entity, "stun") (plus a test-only Result array-drain we deliberately don’t replicate — it never runs on the production EventVec path).
empower_duration_decrement
hot_tick
Port of the heal-over-time (HoT) tick. The effect stores a rolling 5-slot schedule: effect.hot.next is the slot index to consume this tick, and effect.hot.tick.<i> holds each slot’s heal amount. Each tick: if the current slot is empty (absent), reset the cursor to 0; otherwise advance the cursor (wrapping 5→1), zero the consumed slot, and heal by its amount. set_entity_attr/add_entity_attr push IncrAttributes; heal_entity is RNG-free (no draw), so this needs no RNG snapshot.
low_hp_heal_on_damage
Port of the test “heal when about to die” effect (3b136901-...), subscribed RNG-free; only used by test_effects::test_effect_with_subscribe.
protection_duration_decrement
regeneration_tick
Port of the regeneration tick: heal the entity by its regeneration_rate stat. get_entity_stat reads the stat (base + bonus + mod); heal_entity pushes a Heal event clamped to missing HP (no RNG).
register
Register this category’s native fns.
sleep_wake_tick
Port of the sleep tick: if the entity already woke (sleep attr absent), remove the wake_up_delay entirely; otherwise decrement wake_up_delay by 1 and, when it reaches 1 or less, clear the sleep attr.
spawn_two_on_death
Port of the test “spawn two enemies on death” effect (39f135d2-...), Each spawn draws a random uuid from the authoritative RNG (in order, like the
test_effect_tick
Port of the [TEST] Test effect tick: bump a test_effect_ticks counter by one. RNG-free; only used by the effect’s own unit test.
tutorial_buff_tick
Port of the tutorial damage buff: when THIS entity is the one that took damage (the effect subscribes to Damage, and the script guards on Event.entity_id == Entity.id), scale crit chance and damage-reduction by fraction of HP lost and push the four attribute deltas. RNG-free.
vulnerability_duration_decrement
weakness_duration_decrement

Type Aliases§

EventFn
Signature of an event (effect) native fn.