Class Commitment

java.lang.Object
privbot.mechanics.Commitment

public final class Commitment extends Object
What the engine is committed to: a STYLE, and on top of it at most one fixed-plan EPISODE (plan fix 6, D44).

Why one object. F1 had 13 equip bursts in 84 ticks, seven of them spec-freeze-spec swaps inside 8 ticks, because only the style plan had a commitment window: the spec, freeze and Tele Block sets were re-decided from scratch every tick, and the spec set's equips renewed the MELEE style commitment on the way (its weapon is a melee weapon), so GEAR held "wearing Melee (committed)" on T56-T58 while srtutor prayed melee. Here the style and the episode are separate facts folded from the same plans:

  • a plan whose commit set is a STYLE set (any style, the same one included) ends the episode, and restarts styleSince only when the style changes;
  • a plan whose commit set is a fixed plan (SPEC, FREEZE, TELEBLOCK) other than the running episode starts a new episode at its tick, and leaves the style alone; so does a SPEC commit after the running SPEC episode's spec fired (a second spec is its own episode, C3 review round 1);
  • a new opponent resets both;
  • a plan with no commit set changes nothing: a GEAR hold that names no set, and every hold the engine invents (the arbiter's deferrals, the stale-state filter) never starts, ends or renews anything.
The commit set is the plan's (ActionPlan.commitSet), which GEAR writes on every equip and every hold it makes in a set, from PvPPolicy.GearPlan.set(): the style's name, or the fixed plan's kind.

Which breakers end a running episode is the policy's (PvPPolicy, D45, D47, D50): this is only the record of what was committed to and since when.

Immutable and pure; no client reads, any thread. Lifted from ElorinPvP model/Commitment, with its Style replaced by CombatStyle (same constant names, so the commit-set strings are unchanged).

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    A fixed-plan episode, or none.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The opponent this commitment belongs to; -1 before the first.
    The fixed-plan episode running on top of it, and the tick it started.
    final int
     
    static final int
    "Never happened".
    The style we are committed to, or null; and the tick it was chosen.
    final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    after(int tick, int opponentId, String commitSet)
    Folds one plan's commit set, decided on tick against opponentId (-1: no opponent in the state, which keeps the one we have).
    after(int tick, int opponentId, String commitSet, int specFiredTick)
    As above, with specFiredTick: the tick the last spec fired as the decision on this state saw it, or NEVER (the engine passes NEVER while the orb is still latched, so an armed read lagging the fire is that spec, not a second one).
    static Commitment
     
    episodeOf(String commitSet)
    The fixed-plan episode a commit set names, or null for a style set.
    facing(int opponentId)
    The commitment as a decision on a state against opponentId reads it: the same one, or nothing when that is a different opponent from the one it belongs to (a new fight; -1 is no opponent, which is a one-tick blip and keeps it).
    The commitment part of the capture's memory map (plan T9.5): plain data, never read back.
    int
    ticksIntoEpisode(int tick)
    Ticks into the running episode at tick, or -1 when none runs.
     

    Methods inherited from class java.lang.Object

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

    • NEVER

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

      public final CombatStyle style
      The style we are committed to, or null; and the tick it was chosen.
    • styleSince

      public final int styleSince
    • episode

      public final Commitment.Episode episode
      The fixed-plan episode running on top of it, and the tick it started.
    • episodeSince

      public final int episodeSince
    • against

      public final int against
      The opponent this commitment belongs to; -1 before the first.
  • Method Details

    • empty

      public static Commitment empty()
    • facing

      public Commitment facing(int opponentId)
      The commitment as a decision on a state against opponentId reads it: the same one, or nothing when that is a different opponent from the one it belongs to (a new fight; -1 is no opponent, which is a one-tick blip and keeps it).
    • after

      public Commitment after(int tick, int opponentId, String commitSet)
      Folds one plan's commit set, decided on tick against opponentId (-1: no opponent in the state, which keeps the one we have). commitSet is null for a plan that committed to nothing. No spec has fired: after(int, int, String, int) with NEVER.
    • after

      public Commitment after(int tick, int opponentId, String commitSet, int specFiredTick)
      As above, with specFiredTick: the tick the last spec fired as the decision on this state saw it, or NEVER (the engine passes NEVER while the orb is still latched, so an armed read lagging the fire is that spec, not a second one). A SPEC commit when the running SPEC episode's spec has fired (specFiredTick >= episodeSince, exactly when PvPPolicy.specPhase stops calling the episode running) is a SECOND spec and starts its own episode here (C3 review round 1, C3-2). Without it a double spec (100% energy at a 50% cost) kept the first episode's start, so the second never had a window or the 60/75 band and flipped on the tick-by-tick start rules.
    • ticksIntoEpisode

      public int ticksIntoEpisode(int tick)
      Ticks into the running episode at tick, or -1 when none runs.
    • episodeOf

      public static Commitment.Episode episodeOf(String commitSet)
      The fixed-plan episode a commit set names, or null for a style set.
    • summary

      public Map<String,Object> summary()
      The commitment part of the capture's memory map (plan T9.5): plain data, never read back.
    • toString

      public String toString()
      Overrides:
      toString in class Object