Class OverheadWatch

java.lang.Object
privbot.mechanics.OverheadWatch

public final class OverheadWatch extends Object
An opponent's overhead prayer, debounced: "has their prayer blocked this style long enough to act on it".

Lifted from ElorinPvP model/OverheadMemo, with HeadIcon replaced by the overhead's NAME (the HeadIcon constant name, as ctx.pvp reports it), so no client enum constant is referenced. A one-tick flick is evidence, not a command: a style counts as blocked only once the same overhead has been read for debounceTicks readable ticks in a row (default 2, ElorinPvP's COMMIT_BREAK_DEBOUNCE_TICKS, ElorinPvPConstants.java:146).

Null is UNKNOWN. An unreadable overhead (null) neither restarts the run nor counts as a tick of it, so MELEE, null, MELEE is two ticks of MELEE. A readable change, including "NONE", starts a candidate run; the last established block remains in force until that candidate itself reaches the debounce window.

Names to styles: MELEE/DEFLECT_MELEE block melee, RANGED/DEFLECT_RANGE ranged, MAGIC/DEFLECT_MAGE magic; the combined icons RANGE_MAGE, RANGE_MELEE, MAGE_MELEE block both their styles and RANGE_MAGE_MELEE all three. Matching is case-blind.

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

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Readable ticks in a row before an overhead blocks a style.
    static final int
    "Never happened".
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    OverheadWatch(int debounceTicks)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    blocked(int tick)
    The one style their overhead has blocked for at least the debounce window.
    int
    How many readable ticks in a row their overhead has blocked style, regardless of the debounce; 0 when the current overhead does not block it or nothing readable has been seen.
    blockedSet(int tick)
    Every style their overhead has blocked for at least the debounce window; empty when none, when nothing readable has been seen, or when tick is before the newest reading.
    int
    The first tick of the current run when its overhead blocks any style (debounced or not), else NEVER.
    blocks(String overhead)
    The styles an overhead name blocks; empty for null, "NONE" or a non-protection prayer.
    observe(int tick, String overhead)
    One tick's reading of their overhead name.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_DEBOUNCE_TICKS

      public static final int DEFAULT_DEBOUNCE_TICKS
      Readable ticks in a row before an overhead blocks a style.
      See Also:
    • NEVER

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

    • OverheadWatch

      public OverheadWatch()
    • OverheadWatch

      public OverheadWatch(int debounceTicks)
      Parameters:
      debounceTicks - readable ticks in a row before a style counts as blocked; at least 1
  • Method Details

    • observe

      public OverheadWatch observe(int tick, String overhead)
      One tick's reading of their overhead name. Null is unreadable: nothing changes. The same overhead again is one more tick of the run (the same tick twice counts once); a different one starts a new run at this tick.
      Returns:
      this watch, for chaining
    • blocked

      public CombatStyle blocked(int tick)
      The one style their overhead has blocked for at least the debounce window. Null when none is blocked, when nothing readable has been seen, when tick is before the newest reading, or when the overhead blocks more than one style (a combined icon: read blockedSet(int)).
    • blockedSet

      public Set<CombatStyle> blockedSet(int tick)
      Every style their overhead has blocked for at least the debounce window; empty when none, when nothing readable has been seen, or when tick is before the newest reading.
    • blockedFor

      public int blockedFor(CombatStyle style)
      How many readable ticks in a row their overhead has blocked style, regardless of the debounce; 0 when the current overhead does not block it or nothing readable has been seen.
    • blockedSince

      public int blockedSince()
      The first tick of the current run when its overhead blocks any style (debounced or not), else NEVER.
    • blocks

      public static Set<CombatStyle> blocks(String overhead)
      The styles an overhead name blocks; empty for null, "NONE" or a non-protection prayer.
    • toString

      public String toString()
      Overrides:
      toString in class Object