Module start_cast

Source
Expand description

Native ports for the start_cast_ability category — ability start_behavior (run via run_start_cast_ability, returns Vec<StartCastAbilityResult>).

Unlike the data categories, these run combat logic that consumes the authoritative RNG (try_cast’s multicast roll, attack rolls, …), drawing values from the game Random in order.

The 27 shipped ability start_scripts are dominated by ctx.try_cast(CasterEntity, "<self ability id>") — one parameterised native fn (try_cast_self) covers them; the small attack-based tail gets its own fns.

Structs§

StartCastAbilityCtx
start_behavior sees (CasterEntity, Fight, Random) plus the cast ability id and config/lookups the combat API needs.
StartCastAbilityScriptResult
One pushed result from an ability start_behavior — either an attack or a run. The native start-cast-ability port fills a Vec of these, which StartCastAbilityResult::vec_from_script_results classifies into typed StartCastAbilityResults.
StartCastProjectileCtx
Inputs available to a start_cast_projectile native fn — the subset of the scope (run_start_cast_projectile via handle_start_cast_projectile) also binds CasterEntity, Fight, ProjectileLevel, CurrentTick, FightDurationTicks and the event, but no shipped start_behavior reads anything beyond the caster/target coordinates; add fields here if a future script does.
StartCastProjectileResult

Enums§

StartCastAbilityResult

Functions§

attack_first_enemy
Port of the shared test start_behavior (generate_start_ability_script): Attacks the first entity on the opposing team (anim 500). RNG-free.
distance_x100
Native port of the distance×100 start_behavior (the common case).
distance_x380
Native port of the distance×380 start_behavior (projectile 0196a6b3-f885-7fdc-af8c-92a1ffb79ceb).
fixed_200
Native port of the fixed Result.animation_duration_ticks = unsigned(200) start_behavior (projectile 019aeeed-5bcc-7dcc-a74f-589031a6b8f2).
fixed_500_damage_300
Port of the test projectile start_behavior Result.animation_duration_ticks = unsigned(500); Result.projectile_data.add("damage", 300); — fixed 500-tick anim with a damage=300 entry in projectile_data. Used by test_fighting_abilities.
register
Register both start-cast scopes (ability wind-up + projectile wind-up).
self_attack_400
Port of Result.push_attack(unsigned(0), unsigned(400), CasterEntity.id) — a single self-targeting attack (delay 0, anim 400 ticks). No RNG. Used by the one non-try_cast ability start_behavior (01955be6).
self_attack_500
Port of Result.push_attack(unsigned(0), unsigned(500), CasterEntity.id); (the 41ee5532-... test ability start_behavior) — a single self-targeting attack (delay 0, anim 500 ticks). RNG-free.
try_cast_self
Port of ctx.try_cast(CasterEntity, "<self ability id>") — the dominant wrapper does (casts=1 default; identical RNG consumption: multicast roll, valid-target filtering, per-cast rolls), then classifies the pushed results.

Type Aliases§

StartCastAbilityFn
Signature of a start_cast_ability native fn.
StartCastProjectileFn
Signature of a start_cast_projectile native fn. Free fn (no captured state) so it is Copy and trivially stored in the registry; runtime context arrives via StartCastProjectileCtx.