Class SpellEffects

java.lang.Object
privbot.mechanics.SpellEffects

public final class SpellEffects extends Object
Freeze, Vengeance and Tele Block on us and on opponents, tracked from the graphics and animations a PvP snapshot reads each tick.

Lifted from ElorinPvP's engine/Vengeance and engine/FreezeMemo (the cast and freeze graphics), FreezeClock (the duration rounding) and tasks/TeleblockNode (the Tele Block graphic), without their fight-state types. This tracker only sees graphics, animations and (optionally) damage; it never sees movement, so a freeze that BROKE early (the target teleported, or the freeze splashed and the graphic was someone else's) still reads frozen until its full length. Every length here is an upper bound.

Ids. Graphic ids are OSRS ids and are compared as they are read: no translation. Animation ids go through the constructor's animationToServer, which maps an OSRS animation id to this server's id. ctx.pvp .effects() supplies it from ctx.ids' animation translation for Elorin and refuses servers whose effect cues are not verified. A cast animation matches its translated id OR the OSRS id itself: ElorinPvP saw the Lunar cast as 4410 unchanged on Elorin (Vengeance.java:16, the 2026-09-25 capture), where the +19000 animation offset holds only for OSRS-era ids (ElorinPvPConstants.java:326). A translator that throws, or answers a negative id, is treated as "cannot translate".

Unreadable is unknown. A null graphic, animation, name or damage does not update an effect or count as "no graphic", so the same graphic read on both sides of an unreadable tick is one cast, not two. A supplied tick still advances that actor's event ordering; older events are ignored, including after an unreadable sample. The boolean accessors describe this tracker's observed history, not authoritative current game state: false can mean that a cue was missed, while true can be stale after an early break or an unobserved hit. In particular, vengeanceReady(int) is not proof that the spell is ready when no cast was observed. Callers must obtain independent evidence before using these estimates for safety-critical decisions.

Thread rule: mutable, single-owner. Feed it once per tick from the thread that reads the snapshot.

  • Field Details

    • NEVER

      public static final int NEVER
      "Never happened".
      See Also:
    • FREEZE_SECONDS_BY_GRAPHIC

      public static final Map<Integer,Integer> FREEZE_SECONDS_BY_GRAPHIC
      Freeze hit graphics (OSRS ids) to the seconds each holds for: Ice Rush 361 5, Ice Burst 363 10, Ice Blitz 367 15, Ice Barrage 369 20; Bind 181 5, Snare 180 10, Entangle 179 15. Source: ElorinPvP ElorinPvPConstants.FREEZE_GRAPHICS and FREEZE_SECONDS_BY_GRAPHIC (ElorinPvPConstants.java:173, :179). The Blood, Shadow and Smoke Barrage graphics (377, 383, 391) do not freeze and are not here.
    • FREEZE_IMMUNITY_TICKS

      public static final int FREEZE_IMMUNITY_TICKS
      Ticks after a freeze ends during which a new freeze does not land. Source: ElorinPvP PvPSettings.Builder.freezeImmunityTicks = 5 (PvPSettings.java:415; config default ElorinPvPConfig.java:399).
      See Also:
    • VENGEANCE_GRAPHIC

      public static final int VENGEANCE_GRAPHIC
      Vengeance cast graphic. Source: ElorinPvP Vengeance.GRAPHIC (Vengeance.java:41).
      See Also:
    • VENGEANCE_ANIMATION

      public static final int VENGEANCE_ANIMATION
      Lunar self-cast animation, OSRS id. Source: ElorinPvP Vengeance.ANIMATION (Vengeance.java:42).
      See Also:
    • VENGEANCE_COOLDOWN_TICKS

      public static final int VENGEANCE_COOLDOWN_TICKS
      Ticks before Vengeance can be cast again (30 s). Source: ElorinPvP Vengeance.COOLDOWN_TICKS (Vengeance.java:43).
      See Also:
    • TELEBLOCK_GRAPHIC

      public static final int TELEBLOCK_GRAPHIC
      Tele Block hit graphic. Source: ElorinPvP ElorinPvPConstants.TELEBLOCK_GRAPHICS (ElorinPvPConstants.java:185).
      See Also:
    • TELEBLOCK_TICKS

      public static final int TELEBLOCK_TICKS
      Tele Block length: 300 s (ElorinPvP ElorinPvPConstants.TELEBLOCK_SECONDS, ElorinPvPConstants.java:187), 500 ticks. It is halved when the target prays Protect from Magic as it lands, which this tracker cannot know, so 500 is an upper bound.
      See Also:
  • Constructor Details

    • SpellEffects

      public SpellEffects(IntUnaryOperator animationToServer)
      Parameters:
      animationToServer - maps an OSRS animation id to this server's id; null is the identity function. ctx.pvp.effects() supplies ctx.ids' animation translation.
  • Method Details

    • observeLocal

      public void observeLocal(int tick, Integer graphic, Integer animation)
      One tick's reading of our own graphic and animation; null is unreadable.
    • observeOpponent

      public void observeOpponent(String name, int tick, Integer graphic, Integer animation)
      One tick's reading of an opponent's graphic and animation; a null name, graphic or animation changes nothing.
    • observeLocalDamage

      public void observeLocalDamage(int tick, Integer damage)
      A hit on us this tick. A damaging hit on a tick after our Vengeance cast uses it; null is unreadable.
    • observeOpponentDamage

      public void observeOpponentDamage(String name, int tick, Integer damage)
      Our hit on an opponent this tick. A damaging hit uses their Vengeance; null is unreadable.
    • forgetOpponent

      public void forgetOpponent(String name)
      Drops what is known about one opponent (a new fight).
    • frozen

      public boolean frozen(int tick)
      Whether an observed freeze's estimated upper-bound window includes tick.
    • frozenUntil

      public int frozenUntil()
      The estimated upper-bound end of the last observed freeze, or NEVER.
    • freezeImmune

      public boolean freezeImmune(int tick)
      Whether tick is in the estimated immunity window after an observed freeze.
    • opponentFrozen

      public boolean opponentFrozen(String name, int tick)
    • opponentFreezeImmune

      public boolean opponentFreezeImmune(String name, int tick)
    • vengeanceUp

      public boolean vengeanceUp(int tick)
      Whether our Vengeance is up: cast seen, and not yet used by a damaging hit reported through observeLocalDamage(int, java.lang.Integer) on a later tick. Without damage reports it stays up once cast.
    • vengeanceReady

      public boolean vengeanceReady(int tick)
      Whether Vengeance can be cast at tick: never seen cast, or VENGEANCE_COOLDOWN_TICKS have passed.
    • vengeanceReadyAt

      public int vengeanceReadyAt()
      The first tick Vengeance can be cast again, or NEVER when it has not been seen cast.
    • opponentVengeance

      public boolean opponentVengeance(String name, int tick)
      Whether the opponent's Vengeance is up: seen cast, and not yet used by our damaging hit on them.
    • teleblocked

      public boolean teleblocked(int tick)
      Whether we are tele-blocked at tick (upper bound: TELEBLOCK_TICKS from the graphic).
    • teleblockedUntil

      public int teleblockedUntil()
      The estimated upper-bound end of the last observed Tele Block, or NEVER.
    • opponentTeleblocked

      public boolean opponentTeleblocked(String name, int tick)