mwg API
    Preparing search index...

    Class Scheduler<A>

    Type Parameters

    Index
    now: number = 0

    the current time; advances to each actor's turn as it comes up

    • Puts an actor in the queue.

      Parameters

      • actor: A
      • delay: number = 0

        time before its first turn. Spawning a monster with a small random delay stops a room full of them from acting in lockstep.

      • priority: number = ...

        higher-priority actors resolve first when scheduled at the same time.

      Returns void

    • Pushes a specific actor's next turn back, independent of whose turn it currently is - a stun or slow effect landing on someone other than the current actor, for instance.

      Parameters

      • actor: A
      • delay: number

        time added to that actor's next scheduled turn

      Returns void

    • Charges the current actor for what it did, and hands the turn on.

      Parameters

      • cost: number

        time the action took at speed 1; divided by the actor's speed. A cost of 0 is a free action: the actor keeps its place at now but still goes behind any other actor already tied with it, since its sequence number is refreshed like any other spend.

      Returns void

    • the time at which an actor next acts, for a debug view or an interface

      Parameters

      • actor: A

      Returns number | null