Class SpecEnergy
java.lang.Object
privbot.mechanics.SpecEnergy
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe smallest energy drop that is a spec; any smaller wobble is not (from ElorinPvP). -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanconfirms(SpecEnergy.Fired previous, int pct, boolean readable) Whether the reading after a SUSPECT_ZERO confirms it: readable, and still 0.static SpecEnergy.Firedfired(int prevPct, boolean prevArmed, boolean prevReadable, int pct, boolean armed, boolean readable) What happened between the previous reading (prev*) and this one.
-
Field Details
-
MIN_SPEC_DROP
public static final int MIN_SPEC_DROPThe 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
Whether the reading after a SUSPECT_ZERO confirms it: readable, and still 0.
-