Module fight_start

Source
Expand description

Native ports for the fight_start category — a fight template’s start_behavior (run via run_event, returning Vec<OverlordEvent>).

The deployed start_behaviors are dominated by a single shape: ctx.init_fight(State, "<self template id>") — covered by init_fight_self. A small tail additionally pushes a static attribute increment on the player (and, when present, the party player) — covered by init_fight_self_static_buff.

Unlike the combat event/start_cast_ability categories these scripts do NOT consume the authoritative RNG (init_fight is RNG-free and the shipped bodies never touch Random).

Structs§

FightStartCtx
Inputs available to a fight_start native fn — the fight start_behavior scope (Fight, State) plus the lookups init_fight needs. The fight template id is fight.fight_id (the deployed scripts always pass the template’s own $.id to init_fight).

Functions§

apply_spawn_on_death_to_player
Port of the test fight start_behavior Result.push(OverlordEventEntityApplyEffect(Fight.player_id, uuid("39f135d2-..."))); — applies the spawn-on-death effect to the player. RNG-free; used by test_fighting::test_spawn_entity.
damage_first_entity_5
Port of the test fight start_behavior Result.push(OverlordEventDamage(Fight.entities[0].id, unsigned(5), CustomEventData())) — damages the first fight entity by 5. RNG-free; used by test_fighting::test_start_fight_script.
init_fight_self
Port of ctx.init_fight(State, "<self template id>") — the dominant fight start_behavior. Delegates to the already-native fight::init_fight with fight.fight_id as the template id (identical to passing $.id).
init_fight_self_static_buff
Port of the static-buff variant: the init_fight call followed by Result.push(OverlordEventEntityIncrAttribute(Fight.player_id, "static", 1)) and the same for Fight.party_player_id when it is set. Event order matches static).
noop
No-op fight start: the equivalent of an empty start_behavior (the program produces no Result events). Used by test fight templates whose start_behavior is "".
register
Register this category’s native fns.

Type Aliases§

FightStartFn
Signature of a fight_start native fn.