Class SpecEnergy

java.lang.Object
privbot.mechanics.SpecEnergy

public final class SpecEnergy extends Object
Whether a special attack fired between two readings of special-attack energy: a fire is an energy drop.

Use one function for every reader (a fight memory, a tracker, a scoreboard) so they never disagree about what a spec was. Watching only for a drop shortly after the orb was armed misses specs: the orb can flip between two samples, and a spec can fire many ticks after it was armed.

What recorded fights show: every energy drop was exactly the weapon's cost, some drops had no observable orb transition (it flipped between samples), and energy otherwise only rises (regeneration steps, or to 100 on respawn or login). So:

  • FIRED when both readings are readable, the energy fell by at least MIN_SPEC_DROP, and either energy is left or the orb went armed -> unarmed;
  • a drop to exactly 0 with no orb transition is SUSPECT: it is also what a read that failed back to 0 looks like, and it is confirmed only if the next reading is still 0;
  • an unreadable reading on either side is never a fire (unreadable is unknown, never a fact).

Pure; no client reads, any thread. From ElorinPvP.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The smallest energy drop that is a spec; any smaller wobble is not (from ElorinPvP).
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    confirms(SpecEnergy.Fired previous, int pct, boolean readable)
    Whether the reading after a SUSPECT_ZERO confirms it: readable, and still 0.
    fired(int prevPct, boolean prevArmed, boolean prevReadable, int pct, boolean armed, boolean readable)
    What happened between the previous reading (prev*) and this one.

    Methods inherited from class java.lang.Object

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

    • MIN_SPEC_DROP

      public static final int MIN_SPEC_DROP
      The smallest energy drop that is a spec; any smaller wobble is not (from ElorinPvP).
      See Also:
  • Method Details

    • fired

      public static SpecEnergy.Fired fired(int prevPct, boolean prevArmed, boolean prevReadable, int pct, boolean armed, boolean readable)
      What happened between the previous reading (prev*) and this one. A percent below 0 is the unreadable marker whatever the readable flag says.
    • confirms

      public static boolean confirms(SpecEnergy.Fired previous, int pct, boolean readable)
      Whether the reading after a SUSPECT_ZERO confirms it: readable, and still 0.