Module cast_ability

Source
Expand description

Native ports for the cast_ability category — ability scripts (the CastAbility event handler, run via run_event in logic::fighting::handle_cast_ability, returning Vec<OverlordEvent>).

These are the combat effect of casting an ability: most call ctx.on_cast(CasterEntity) then either launch a projectile (Result.push(OverlordEventStartCastProjectile(...))) or apply combat primitives (ctx.attack, ctx.spell_heal, ctx.apply_entity_effect).

§RNG

Ability scripts consume the authoritative Random (via on_cast’s bravery throw, attack’s evasion/counterattack/deceit/crit/block throws, and stat_throw).

§Effect callbacks

on_cast / apply_entity_effect dispatch the applied effect’s on_apply reaction. For the shipped effects those reactions push add_entity_stat_mod (empower/weakness/protection/vulnerability) events; the native path must replicate them, so we pass OverlordEffectCb rather than NoopEffectCb.

§Scope (per the handle_cast_ability run_event call site)

CasterEntity, TargetEntity, Fight, Random, AbilityLevel, AbilitySlotLevel, CurrentTick, FightDurationTicks, and the event.

Structs§

CastAbilityCtx
ability script scope the shipped scripts read.

Functions§

apply_bloodleak_effect
Port of the 50260b1c-... test ability script: RNG-free; used by test_effects::test_effect_with_interval.
apply_low_hp_heal_effect
Port of the 41ee5532-... test ability script: Result.push(OverlordEventEntityApplyEffect(Event.by_entity_id, uuid("3b136901-..."))); Event.by_entity_id is the caster, so the effect is applied to the caster. RNG-free; used by test_effects::test_effect_with_subscribe.
apply_test_effect
01955be6-...ctx.apply_entity_effect(CasterEntity, "test_effect", 3). No on_cast. test_effect’s on_apply is print-only (no events).
arcane_blast_cast
Arcane Blast (Mage, 019dfcfb): the nuke lands on the target and washes over every OTHER living enemy at a share of it — with no target cap (BAL-034), which is what makes the Mage the wave-clear class rather than a single-target one.
backstab_cast
Backstab (Rogue, 019dfc4c): heavy crit gamble — like crit_strike but with the kit’s own budget/crit split.
band_targets
§1 AoE cap: the band-eligible enemies of a forward 3-cell cone (caster_x < x ≤ caster_x+3), capped to the first max_targets in the deterministic fight.entities iteration order (None ⇒ unlimited, legacy behaviour). No RNG, no sorting. Shared by cone_strike / Rewind / War Cry / Holy Nova so the cap is byte-identical everywhere.
bare_projectile_bat
019a0246-cf87-... — bare push projectile 019a0244-aad4.
bare_projectile_chipmunk
019a0246-5aaf-... — bare push projectile 019a0244-7a0a.
bare_projectile_mushroom
019a0245-ff0c-... — bare push projectile 019a0244-4675.
bare_projectile_shot
019c00a4-... — bare push projectile 019c009c.
battle_heal_cast
Battle Heal (Priest, 019dfd02-0c6a): the WHOLE TEAM is healed and empowered (BAL-033). In solo that is the Priest alone, so the ability never reads as weaker than it did — it just stops being self-only the moment there is somebody to heal.
cone_strike
019584f4-... — cone/AoE: on_cast, roll one shared crit, then attack every enemy in a forward 3-cell x-band with { power, is_crit }.
crit_strike
019584aa-... — on_cast + attack { power, crit_chance_bonus * 10000.0 }.
damage_target_5
Port of the shared test ability script (generate_ability_script): Result.push(OverlordEventDamage(TargetEntity.id, unsigned(5), CustomEventData())); RNG-free; used by the test-config gacha/class abilities.
dot_strike
01958efd-... — on_cast + attack { dot_power: ability_info.damage } (no instant power; pure DoT application).
fireball_cast
01958172-... — on_cast + launch projectile 01966cbc.
fireball_projectile_cast
019dfc4c-... / 019dfc4f / 019dfcfb / 019dfcfe / 019dfd00 / 019dfd01 / 019dfd02-0c6a / 019dfd02-add4 — all identical: on_cast + launch projectile 01966cbc. (One shared native fn; config points all eight ability script_native refs at it.)
fortify_cast
Fortify (Warrior, 019dfd00): Protection on self (received damage halved) plus an instant self-heal from the rest of the budget.
holy_nova_cast
Holy Nova (Priest, 019dfd02-add4): AoE smite plus exactly ONE heal for a share of the recipient’s Max HP — the ally with the lowest HP share, which in solo is the caster.
melee_strike
0194d64e-... — on_cast + attack { power }.
mob_melee_average
019cc465-14b8-... — on_cast + attack { power }.
mob_melee_quick
019cc464-... — on_cast + attack { power }.
mob_melee_slow
019cc465-2f63-... — on_cast + attack { power }.
multi_projectile
019589e6-... — on_cast + launch ability_info.projectiles projectiles, each delayed i * 150.
night_pounce_projectile_cast
Pet-ult deliveries: same combat math as the instant versions (crit_strike / cone_strike / dot_strike), moved onto a projectile so the pet’s cast is readable in combat. The damage resolves in the paired projectile_pet_* fn on arrival.
odd_flame_projectile_cast
register
Register this category’s native fns.
rewind_cast
rust_wave_projectile_cast
self_hot_heal
01958ed0-... — on_cast + spell_heal(caster, caster, #{ hot_power }).
strike_then_empower
01958a30-... — on_cast + attack { power }; if damage dealt (!= ()), apply empower for ability_info.effect_duration.
strike_then_vulnerability
01958ef2-... — on_cast + attack { power }; if damage dealt, apply vulnerability on the TARGET for ability_info.effect_duration.
sword_slash
019bff40-... — on_cast + attack { power }.
test_band_strike
Test-config only: an AoE strike whose payload, coverage and support stones all come from the CAST ability’s own template, so the fixture can exercise the coverage and shape supports end to end without a bespoke content::ability_info closure.
test_swing
A real swing for the test config: runs mechanics::fight::attack with a fixed power and a forced non-crit.
test_swing_aoe
The AoE counterpart of test_swing: one cast, one swing per living enemy, all inside the cast’s own tick.
thousand_cuts_cast
Thousand Cuts (Rogue, 019dfc4f): a flurry of projectiles direct cuts on the target — each rolls its own crit/evasion, so the flurry FEELS like a storm of numbers rather than one hit.
vampiric_touch_cast
019589f7-... — on_cast + launch projectile 0196a6b4 (vampiric strike).
war_cry_cast
War Cry (Warrior, 019dfd01): AoE shout + +30% outgoing damage on self while any enemy was struck.

Type Aliases§

CastAbilityFn
Signature of a cast_ability native fn.