if (parent.getEntity() instanceof Mech && Compute.isEnemyIn(game, parent.getEntity().getId(), dest, true)) {
if (entity instanceof Mech && Compute.isEnemyIn(game, entity.getId(), dest, true)) {
    public boolean isMovementPossible(Game game, Coords src) {        final Hex srcHex = game.board.getHex(src);        final Coords dest = this.getPosition();        final Hex destHex = game.board.getHex(dest);        if (src.distance(dest) > 1) {            throw new IllegalArgumentException("Coordinates must be adjacent.");        }        /* 2004-03-31 : don't look at overall movement, just this step. **        if (movementType == Entity.MOVE_ILLEGAL) {            // that was easy            return false;        }        /* 2004-03-31 : don't look at overall movement, just this step. */        // If we're a tank and immobile, check if we try to unjam        // or eject and the crew is not unconscious        if (parent.getEntity() instanceof Tank && !parent.getEntity().getCrew().isUnconscious()             && ( type == MovePath.STEP_UNJAM_RAC || type == MovePath.STEP_EJECT) ) {            return true;        }                // super-easy        if (parent.getEntity().isImmobile()) {            return false;        }        // another easy check        if (!game.board.contains(dest)) {            return false;        }        // Can't back up across an elevation change.        if (isThisStepBackwards() && parent.getEntity().elevationOccupied(destHex) != parent.getEntity().elevationOccupied(srcHex)) {            return false;        }        // Swarming entities can't move.        if (Entity.NONE != parent.getEntity().getSwarmTargetId()) {            return false;        }        // The entity is trying to load. Check for a valid move.        if (type == MovePath.STEP_LOAD) {            // Transports can't load after the first step.            if (!firstStep) {                return false;            }            // Find the unit being loaded.            Entity other = null;            Enumeration entities = game.getEntities(src);            while (entities.hasMoreElements()) {                // Is the other unit friendly and not the current entity?                other = (Entity) entities.nextElement();                if (parent.getEntity().getOwner() == other.getOwner() && !parent.getEntity().equals(other)) {                    // The moving unit should be able to load the other unit.                    if (!parent.getEntity().canLoad(other)) {                        return false;                    }                    // The other unit should be able to have a turn.                    if (!other.isSelectableThisTurn()) {                        return false;                    }                    // We can stop looking.                    break;                } else {                    // Nope. Discard it.                    other = null;                }            } // Check the next entity in this position.            // We were supposed to find someone to load.            if (other == null) {                return false;            }        } // End STEP_LOAD-checks        // mechs dumping ammo can't run        boolean bDumping = false;        for (Enumeration e = parent.getEntity().getAmmo(); e.hasMoreElements();) {            if (((Mounted) e.nextElement()).isDumping()) {                bDumping = true;                break;            }        }        if (bDumping && (movementType == Entity.MOVE_RUN || movementType == Entity.MOVE_JUMP)) {            return false;        }        // check elevation difference > max        int nSrcEl = parent.getEntity().elevationOccupied(srcHex);        int nDestEl = parent.getEntity().elevationOccupied(destHex);        int nMove = parent.getEntity().getMovementType();        if (movementType != Entity.MOVE_JUMP && Math.abs(nSrcEl - nDestEl) > parent.getEntity().getMaxElevationChange()) {            return false;        }        // units moving backwards may not change elevation levels (I think this        // rule's dumb)        if ((type == MovePath.STEP_BACKWARDS            || type == MovePath.STEP_LATERAL_LEFT_BACKWARDS            || type == MovePath.STEP_LATERAL_RIGHT_BACKWARDS)            && nSrcEl != nDestEl) {            return false;        }        // Can't run into water unless hovering, or using a bridge.        if (movementType == Entity.MOVE_RUN            && nMove != Entity.MovementType.HOVER            && destHex.levelOf(Terrain.WATER) > 0            && !firstStep            && !isPavementStep) {            return false;        }        // ugh, stacking checks. well, maybe we're immune!        if (movementType != Entity.MOVE_JUMP && type != MovePath.STEP_CHARGE && type != MovePath.STEP_DFA) {            // can't move a mech into a hex with an enemy mech            if (parent.getEntity() instanceof Mech && Compute.isEnemyIn(game, parent.getEntity().getId(), dest, true)) {                return false;            }            // Can't move out of a hex with an enemy unit unless we started            // there, BUT we're allowed to turn, unload, or go prone.            if (Compute.isEnemyIn(game, parent.getEntity().getId(), src, false)                && !src.equals(parent.getEntity().getPosition())                && type != MovePath.STEP_TURN_LEFT                && type != MovePath.STEP_TURN_RIGHT                && type != MovePath.STEP_UNLOAD                && type != MovePath.STEP_GO_PRONE) {                return false;            }        }        // can't jump over too-high terrain        if (movementType == Entity.MOVE_JUMP            && destHex.getElevation() > (parent.getEntity().getElevation() + parent.getEntity().getJumpMPWithTerrain())) {            return false;        }        // Certain movement types have terrain restrictions; terrain        // restrictions are lifted when moving along a road or bridge.        if (movementType != Entity.MOVE_JUMP && parent.getEntity().isHexProhibited(destHex) && !isPavementStep) {            return false;        }        // If we are *in* restricted terrain, we can only leave via roads.        if (movementType != Entity.MOVE_JUMP && parent.getEntity().isHexProhibited(srcHex) && !isPavementStep) {            return false;        }        return true;    }