Class PvpSnapshot
java.lang.Object
privbot.mechanics.PvpSnapshot
A detached copy of one tick of a PvP fight: the local player and the other players around it. Immutable, so it can
be kept, compared with the next tick's and fed to the pure rules (
OverheadWatch, StylePolicy,
SpellEffects, OpponentLock) on any thread.
Produced by ctx.pvp.snapshot(..), which reads everything in one client-thread batch. A snapshot that
exists proves the local player, its tile and the player list were read, so an empty opponents() means
"nobody the query keeps is in range". Single fields that could not be read are null in their PlayerView.
Pure data: no client calls, safe on any thread.
-
Constructor Summary
ConstructorsConstructorDescriptionPvpSnapshot(int tick, PlayerView local, List<PlayerView> opponents, Integer localSpecPercent) -
Method Summary
-
Constructor Details
-
PvpSnapshot
public PvpSnapshot(int tick, PlayerView local, List<PlayerView> opponents, Integer localSpecPercent) - Parameters:
tick- the client's tick countlocal- the local playeropponents- the players the query keptlocalSpecPercent- the local special attack energy 0..100, or null when unreadable
-
-
Method Details
-
tick
public int tick()- Returns:
- the client's tick count when this was read
-
local
- Returns:
- the local player
-
opponents
- Returns:
- the players the query kept (unmodifiable)
-
localSpecPercent
- Returns:
- the local special attack energy 0..100 (
ctx.combat's read), or null when unreadable
-
find
- Parameters:
name- a player name (case and tags ignored)- Returns:
- the opponent with that name, or null when none was kept
-
currentTarget
- Returns:
- the opponent the local player interacts with, or null when it interacts with no player, the
interaction could not be read, or that player is not among
opponents()(out of range or filtered out)
-