AttackTimer
Immutable attack-cooldown snapshot for one side of the current combat focus.
Final classRLPlugins API
public final class AttackTimerThe timer is event-driven. It is updated from attack animations and, for magic, from XP/fake-XP confirmation. A value of 0 means the side is considered ready now. Local timers may go slightly negative to expose free-eat windows.
Members
Constructors
- newAttackTimer(int, int, CombatAttackStyle, int, String)
Creates an immutable timer snapshot.
Methods
- booleancanAttack()
Returns whether an attack command may be issued now or on the ready tick.
- booleancanFreeEat()
Returns whether a local free-eat window is available.
- booleancanFreeEatAndAttackSameTick()
Returns whether a free eat and attack can be attempted in the same tick.
- AttackTimerempty()
Returns an empty ready timer used when no combat evidence has been seen.
- booleanequals(Object)
Whether this and the other object are the same thing.
- CombatAttackStylegetLastStyle()
Returns the inferred style of the most recent known attack.
- intgetSnapshotTick()
Returns the game tick used for this snapshot.
- StringgetSource()
Returns a compact diagnostic label for the evidence that set this timer.
- intgetTicksAtZero()
Returns how many consecutive ticks this timer has been ready.
- intgetTicksRemaining()
Returns ticks until the next attack.
- inthashCode()
A number Java uses when this is put in a set or a map.
- booleanisIdle()
Returns whether the side appears idle after being ready.
- booleanisOnCooldown()
Returns whether this side is still cooling down.
- booleanisPerfectAttackTick()
Returns whether this is the ideal attack issue tick.
- StringtoString()
A text form, for log lines.
AttackTimer(int, int, CombatAttackStyle, int, String)
public AttackTimer(int ticksRemaining, int ticksAtZero, CombatAttackStyle lastStyle, int snapshotTick, String source)Creates an immutable timer snapshot.
Parameters
ticksRemaining- Ticks until the next attack;
0means ready. ticksAtZero- Number of consecutive ticks this timer has been ready.
lastStyle- Inferred style of the most recent known attack.
snapshotTick- Game tick when this snapshot was created.
source- Short diagnostic string describing the evidence source.
canAttack()
public boolean canAttack()Returns whether an attack command may be issued now or on the ready tick.
Returns
true when the timer is at or below the ready threshold.
canFreeEat()
public boolean canFreeEat()Returns whether a local free-eat window is available.
Returns
true when the local cooldown has reached the free-eat threshold.
canFreeEatAndAttackSameTick()
public boolean canFreeEatAndAttackSameTick()Returns whether a free eat and attack can be attempted in the same tick.
Returns
true when both the free-eat and attack conditions are met.
empty()static
public static AttackTimer empty()Returns an empty ready timer used when no combat evidence has been seen.
Returns
Empty ready timer.
equals(Object)
public boolean equals(Object o)Whether this and the other object are the same thing.
Parameters
o- O.
getLastStyle()
public CombatAttackStyle getLastStyle()Returns the inferred style of the most recent known attack.
Returns
Last inferred attack style.
getSnapshotTick()
public int getSnapshotTick()Returns the game tick used for this snapshot.
Returns
Snapshot game tick, or -1 if unavailable.
getSource()
public String getSource()Returns a compact diagnostic label for the evidence that set this timer.
Returns
Evidence source label.
getTicksAtZero()
public int getTicksAtZero()Returns how many consecutive ticks this timer has been ready.
Returns
Ready-at-zero tick count.
getTicksRemaining()
public int getTicksRemaining()Returns ticks until the next attack.
Returns
Ticks remaining; 0 means ready.
hashCode()
public int hashCode()A number Java uses when this is put in a set or a map.
isIdle()
public boolean isIdle()Returns whether the side appears idle after being ready.
Returns
true when ready for at least three observed ticks.
isOnCooldown()
public boolean isOnCooldown()Returns whether this side is still cooling down.
Returns
true when more than one tick remains.
isPerfectAttackTick()
public boolean isPerfectAttackTick()Returns whether this is the ideal attack issue tick.
Returns
true when one tick remains.
toString()
public String toString()A text form, for log lines.