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).
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.
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.)
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.
register
Register this category’s native fns.
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 }.
vampiric_touch_cast
019589f7-... — on_cast + launch projectile 0196a6b4 (vampiric strike).

Type Aliases§

CastAbilityFn
Signature of a cast_ability native fn.