Trait FightSink

Source
pub trait FightSink {
    // Required methods
    fn push_event(&mut self, event: OverlordEvent) -> Result<(), Error>;
    fn push_attack(
        &mut self,
        delay: u64,
        duration: u64,
        target: Uuid,
        origin: CombatEventOrigin,
    ) -> Result<(), Error>;
    fn push_run(
        &mut self,
        coords: Coordinates,
        duration: u64,
        origin: CombatEventOrigin,
    ) -> Result<(), Error>;
    fn claim_once(&mut self, slot: OnceSlot, armed: i64) -> i64;
}
Expand description

Where a fight method emits its results.

Every method takes the provenance of the work it is emitting. The fight primitives always pass CombatEventOrigin::Core — they are genuine combat — and OriginSink merges its own scope on top, so a modifier’s output is marked without a single primitive knowing about modifiers.

Required Methods§

Source

fn push_event(&mut self, event: OverlordEvent) -> Result<(), Error>

Source

fn push_attack( &mut self, delay: u64, duration: u64, target: Uuid, origin: CombatEventOrigin, ) -> Result<(), Error>

Source

fn push_run( &mut self, coords: Coordinates, duration: u64, origin: CombatEventOrigin, ) -> Result<(), Error>

Source

fn claim_once(&mut self, slot: OnceSlot, armed: i64) -> i64

Claims one of the dispatch’s one-shot budgets: returns armed the first time slot is claimed and 0 on every later call for that same slot.

Exists because attack only sees &Entity — a snapshot taken before the dispatch began — so it cannot tell its second call apart from its first. A multi-target ability calls attack once per target against that same snapshot, so a “next attack only” bonus read straight off the entity would boost every target.

Exactly one sink is built per dispatch, so “once per sink” is “once per cast”. The budgets are independent — a swing can be the first to claim the crit chance AND the first to claim the damage bonus — which is why the latch is per slot rather than one for the sink.

Implementors§