demonic gollias: use tick counter
This commit is contained in:
@@ -74,8 +74,6 @@ public class DemonicGorillaPlugin extends Plugin
|
|||||||
@Getter
|
@Getter
|
||||||
private Map<NPC, DemonicGorilla> gorillas;
|
private Map<NPC, DemonicGorilla> gorillas;
|
||||||
|
|
||||||
private int tickCounter;
|
|
||||||
|
|
||||||
private List<WorldPoint> recentBoulders;
|
private List<WorldPoint> recentBoulders;
|
||||||
|
|
||||||
private List<PendingGorillaAttack> pendingAttacks;
|
private List<PendingGorillaAttack> pendingAttacks;
|
||||||
@@ -85,7 +83,6 @@ public class DemonicGorillaPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
tickCounter = 0;
|
|
||||||
gorillas = new HashMap<>();
|
gorillas = new HashMap<>();
|
||||||
recentBoulders = new ArrayList<>();
|
recentBoulders = new ArrayList<>();
|
||||||
pendingAttacks = new ArrayList<>();
|
pendingAttacks = new ArrayList<>();
|
||||||
@@ -206,7 +203,7 @@ public class DemonicGorillaPlugin extends Plugin
|
|||||||
// so we keep track of the attack here until the damage splat
|
// so we keep track of the attack here until the damage splat
|
||||||
// has appeared on the player.
|
// has appeared on the player.
|
||||||
|
|
||||||
int damagesOnTick = tickCounter;
|
int damagesOnTick = client.getTickCount();
|
||||||
if (attackStyle == DemonicGorilla.AttackStyle.MAGIC)
|
if (attackStyle == DemonicGorilla.AttackStyle.MAGIC)
|
||||||
{
|
{
|
||||||
MemorizedPlayer mp = memorizedPlayers.get(target);
|
MemorizedPlayer mp = memorizedPlayers.get(target);
|
||||||
@@ -255,11 +252,13 @@ public class DemonicGorillaPlugin extends Plugin
|
|||||||
|
|
||||||
checkGorillaAttackStyleSwitch(gorilla, protectedStyle);
|
checkGorillaAttackStyleSwitch(gorilla, protectedStyle);
|
||||||
|
|
||||||
|
int tickCounter = client.getTickCount();
|
||||||
gorilla.setNextAttackTick(tickCounter + DemonicGorilla.ATTACK_RATE);
|
gorilla.setNextAttackTick(tickCounter + DemonicGorilla.ATTACK_RATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkGorillaAttacks()
|
private void checkGorillaAttacks()
|
||||||
{
|
{
|
||||||
|
int tickCounter = client.getTickCount();
|
||||||
for (DemonicGorilla gorilla : gorillas.values())
|
for (DemonicGorilla gorilla : gorillas.values())
|
||||||
{
|
{
|
||||||
Player interacting = (Player)gorilla.getNpc().getInteracting();
|
Player interacting = (Player)gorilla.getNpc().getInteracting();
|
||||||
@@ -544,6 +543,7 @@ public class DemonicGorillaPlugin extends Plugin
|
|||||||
private void checkPendingAttacks()
|
private void checkPendingAttacks()
|
||||||
{
|
{
|
||||||
Iterator<PendingGorillaAttack> it = pendingAttacks.iterator();
|
Iterator<PendingGorillaAttack> it = pendingAttacks.iterator();
|
||||||
|
int tickCounter = client.getTickCount();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
PendingGorillaAttack attack = it.next();
|
PendingGorillaAttack attack = it.next();
|
||||||
@@ -688,7 +688,5 @@ public class DemonicGorillaPlugin extends Plugin
|
|||||||
checkPendingAttacks();
|
checkPendingAttacks();
|
||||||
updatePlayers();
|
updatePlayers();
|
||||||
recentBoulders.clear();
|
recentBoulders.clear();
|
||||||
|
|
||||||
tickCounter++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user