public void doMission() {
        final Unit unit = getUnit();
        String reason = invalidReason();
        if (reason != null) {
            logger.finest(tag + " broken(" + reason + "): " + this);
            return;
        }

        // Make random moves in a reasonably consistent direction,
        // checking for a target along the way.
        final AIMain aiMain = getAIMain();
        final AIUnit aiUnit = getAIUnit();
        int check = 0, checkTurns = Utils.randomInt(logger, "Hostile",
                                                    getAIRandom(), 4);
        Direction d = Direction.getRandomDirection(tag, getAIRandom());
        boolean moved = false;
        Mission m;
        while (unit.getMovesLeft() > 0) {
            // Every checkTurns, look for a target of opportunity.
            if (check == 0) {
                Location loc = UnitSeekAndDestroyMission.findTarget(aiUnit, 1);
                if (loc != null) {
                    m = new UnitSeekAndDestroyMission(aiMain, aiUnit, loc);
                    aiUnit.setMission(m);
                    m.doMission();
                    return;
                }
                check = checkTurns;
            } else check--;

            if ((d = moveRandomly(tag, d)) == null) break;
            moved = true;
        }
        if (moved) {
            logger.finest(tag + " moved to " + unit.getLocation()
                + ": " + this);
        }
    }