/** {@inheritDoc} */ @Override public boolean traverse(final EnumSet<TraversalOption> options) { final Tile next = getNext(); if (next == null) { return false; } if (next.equals(getEnd())) { if (Calculations.distanceTo(next) <= 1 || end && (!Players.getLocal().isMoving() || Calculations.distanceTo(next) < 3)) { return false; } end = true; } else { end = false; } if (options != null && options.contains(TraversalOption.HANDLE_RUN) && !Walking.isRunEnabled() && Walking.getEnergy() > 50) { Walking.setRun(true); Task.sleep(300); } if (options != null && options.contains(TraversalOption.SPACE_ACTIONS)) { final Tile dest = Walking.getDestination(); if (dest != null && Players.getLocal().isMoving() && Calculations.distanceTo(dest) > 5 && Calculations.distanceBetween(next, dest) < 7) { return true; } } return Walking.walkTileMM(next, 0, 0); }
/** {@inheritDoc} */ @Override public Tile getNext() { for (int i = tiles.length - 1; i >= 0; --i) { final Tile dest = Walking.getDestination(); if (tiles[i].isOnMap() && (Calculations.canReach(tiles[i], false) || (i != 0 && (dest != null ? Calculations.distanceBetween(dest, tiles[i - 1]) < 3 : Calculations.distanceTo(tiles[i - 1]) < 7)))) { return tiles[i]; } } return null; }