Class FreezeClock
java.lang.Object
privbot.mechanics.FreezeClock
The clock of a freeze on an opponent: when it should end, whether a move of theirs ended it by running out or by
breaking, and the immunity after it.
Why the distinction matters: a move near the expected end is the freeze running out, and immunity follows it.
Calling every move while they were believed frozen a "break" drops the immunity, and the next freeze is then cast
into it. A move at expectedEnd - FREEZE_EXPIRY_EARLY_TICKS or later is an expiry.
Plain ints: the caller resolves the spell's length in seconds and its immunity ticks and passes them in. Whether a given server enforces freeze immunity at all is not verified here.
Pure; no client reads, any thread. From ElorinPvP.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow a move of theirs relates to a running freeze. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA move this soon after the freeze graphic is the step already under way when it landed: the drawn tile trails the server tile by 0-1 ticks (from ElorinPvP).static final intA move this many ticks before the expected end, or later, is the freeze running out, not breaking: the drawn tile trails the server's, and the clock runs in plugin ticks (from ElorinPvP).static final int"Never happened". -
Method Summary
Modifier and TypeMethodDescriptionstatic FreezeClock.MoveclassifyMove(int start, int expectedEnd, int moveTick) What a move of theirs atmoveTickwas, for a freeze that landed atstart.static intexpectedEnd(int start, int seconds) The first tick the freeze no longer holds them:start + ceil(seconds * 10 / 6)(a tick is 0.6 s).static intimmuneUntil(int endedAt, FreezeClock.Move kind, int immunityTicks) The first tick they can be frozen again after a freeze that ended atendedAt, orNEVER.
-
Field Details
-
NEVER
public static final int NEVER"Never happened".- See Also:
-
FREEZE_BROKEN_GRACE_TICKS
public static final int FREEZE_BROKEN_GRACE_TICKSA move this soon after the freeze graphic is the step already under way when it landed: the drawn tile trails the server tile by 0-1 ticks (from ElorinPvP).- See Also:
-
FREEZE_EXPIRY_EARLY_TICKS
public static final int FREEZE_EXPIRY_EARLY_TICKSA move this many ticks before the expected end, or later, is the freeze running out, not breaking: the drawn tile trails the server's, and the clock runs in plugin ticks (from ElorinPvP).- See Also:
-
-
Method Details
-
expectedEnd
public static int expectedEnd(int start, int seconds) The first tick the freeze no longer holds them:start + ceil(seconds * 10 / 6)(a tick is 0.6 s). -
classifyMove
What a move of theirs atmoveTickwas, for a freeze that landed atstart. -
immuneUntil
The first tick they can be frozen again after a freeze that ended atendedAt, orNEVER.
-