Module combat_facts

Source
Expand description

One vocabulary for what a dispatched combat event established.

Laws (crate::logic::laws) and Trigger Stones (crate::logic::stones) react to the same handful of Core outcomes, and each used to read them off the raw event itself. Two readings of one design phrase drift apart silently, and they had: “a hit on the hero” counted a poison tick for a stone and not for a law, while “killed an enemy” was derived from Damage on one side and from EntityDeath on the other.

The reading now lives here once. Both hooks consume CombatFacts and neither parses OverlordEvent for combat meaning any more, so a refinement to one definition reaches both systems or neither.

§The definitions

  • A hit needs an attacker. Only Damage carrying by_entity_id is a hit. A poison tick, a bleed and environment damage are damage taken, but they are nobody’s hit, so they open no condition on either side.
  • A kill is attributed to the hit that made it, not to the corpse: EntityDeath names who died and never who did it, and it fires for allies too. Keying off the killing Damage gives an explicit killer and an explicit pair of teams.
  • Only Core counts. Everything a law, a stone, a bridge, an echo or a pet produced arrives Proc and is refused here — the single anti-loop boundary both systems rest on.

Enums§

CastKind
Which family a cast belongs to. A Basic Attack and an original Skill are the same wire event (CastAbility); the caster’s class kit is what separates them, which is why this cannot be read off the event alone.
CombatFact
One fact a dispatched Core event established about one combatant.

Functions§

cast_kind
Which family ability_id belongs to for entity.
classify
Everything event established, grouped by the combatant it is about.
clear_paid_mana
Drops the recorded payment for a cast that skips the mana gate (a pet ult, an entity with no pool), so its resolution cannot read the previous cast’s price. A no-op when nothing is recorded, keeping unused entities free of bookkeeping.
current_cast_kind
The family of the cast this entity is currently resolving, or None before its first cast of the fight.
facts_for
The facts about one specific combatant, flattened.
paid_mana_x100
Mana the resolving cast paid, in x100 fixed point — Some(0) for a cast the pool let through for free, None for one that never paid (no pool, a pet ult, or nothing cast yet).
record_cast_kind
Records the family of the cast about to resolve, on the caster itself.
record_paid_mana
Records what the cast about to resolve actually paid at the mana gate, in x100 fixed point. Same contract as record_cast_kind: written before the cast resolves, read once by each condition that prices it.