/** {@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 boolean isValid() { return tiles.length > 0 && getNext() != null && !Players.getLocal().getLocation().equals(getEnd()); }