|| type == MovePath.STEP_EJECT) ) {
|| type == MovePath.STEP_EJECT || type == MovePath.STEP_SEARCHLIGHT) ) {
    public boolean isMovementPossible(IGame game, Coords src) {        final IHex srcHex = game.getBoard().getHex(src);        final Coords dest = this.getPosition();        final IHex destHex = game.getBoard().getHex(dest);        final Entity entity = parent.getEntity();        if (null == dest) {            throw new IllegalStateException( "Step has no position." );        }        if (src.distance(dest) > 1) {            StringBuffer buf = new StringBuffer();            buf.append( "Coordinates " )                .append( src.toString() )                .append( " and " )                .append( dest.toString() )                .append( " are not adjacent." );            throw new IllegalArgumentException( buf.toString() );        }        // If we're a tank and immobile, check if we try to unjam        // or eject and the crew is not unconscious        if ( entity instanceof Tank             && !entity.getCrew().isUnconscious()             && ( type == MovePath.STEP_UNJAM_RAC                  || type == MovePath.STEP_EJECT) ) {            return true;        }        // super-easy        if (entity.isImmobile()) {            return false;        }        // another easy check        if (!game.getBoard().contains(dest)) {            return false;        }        // Can't back up across an elevation change.        if ( !(entity instanceof VTOL) && isThisStepBackwards()             && ( entity.elevationOccupied(destHex)                  != entity.elevationOccupied(srcHex) ) ) {            return false;        }        // Swarming entities can't move.        if (Entity.NONE != entity.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 (entity.getOwner() == other.getOwner()                    && !entity.equals(other)) {                    // The moving unit should be able to load the other unit.                    if (!entity.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;        Enumeration iter = entity.getAmmo();        while ( iter.hasMoreElements() ) {            if (((Mounted) iter.nextElement()).isDumping()) {                bDumping = true;                break;            }        }        if (bDumping && (movementType == IEntityMovementType.MOVE_RUN                         || movementType == IEntityMovementType.MOVE_VTOL_RUN                         || movementType == IEntityMovementType.MOVE_JUMP)) {            return false;        }        // check elevation difference > max        int nSrcEl = entity.elevationOccupied(srcHex);        int nDestEl = entity.elevationOccupied(destHex);        int nMove = entity.getMovementMode();        // Make sure that if it's a VTOL unit with the VTOL MP listed as jump MP...        // That it can't jump.        if ((movementType == IEntityMovementType.MOVE_JUMP)                && (nMove == IEntityMovementMode.VTOL)) {            return false;        }        if ( movementType != IEntityMovementType.MOVE_JUMP             && ( Math.abs(nSrcEl - nDestEl)                  > entity.getMaxElevationChange() ) ) {            return false;        }        // Units moving backwards may not change elevation levels.        // (Ben thinks this rule is dumb)        if ((type == MovePath.STEP_BACKWARDS            || type == MovePath.STEP_LATERAL_LEFT_BACKWARDS            || type == MovePath.STEP_LATERAL_RIGHT_BACKWARDS)            && nSrcEl != nDestEl && !(entity instanceof VTOL)) {            return false;        }        // Can't run into water unless hovering, naval, first step, using a bridge, or fly.        if ((movementType == IEntityMovementType.MOVE_RUN                || movementType == IEntityMovementType.MOVE_VTOL_RUN)                && nMove != IEntityMovementMode.HOVER                && nMove != IEntityMovementMode.NAVAL                && nMove != IEntityMovementMode.HYDROFOIL                && nMove != IEntityMovementMode.SUBMARINE                && nMove != IEntityMovementMode.VTOL                && destHex.terrainLevel(Terrains.WATER) > 0                && !firstStep                && !isPavementStep) {            return false;        }        // ugh, stacking checks. well, maybe we're immune!        if ( !parent.isJumping()             && type != MovePath.STEP_CHARGE             && type != MovePath.STEP_DFA ) {            // can't move a mech into a hex with an enemy mech            if (entity instanceof Mech                && Compute.isEnemyIn(game, entity.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, entity.getId(), src, false, getElevation())                 && !src.equals(entity.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 == IEntityMovementType.MOVE_JUMP             && ( destHex.getElevation()                  > (entity.getElevation()                     + entity.game.getBoard().getHex(entity.getPosition()).getElevation()                     + entity.getJumpMPWithTerrain()) ) ) {            return false;        }        // Certain movement types have terrain restrictions; terrain        // restrictions are lifted when moving along a road or bridge,        // or when flying                if (entity.isHexProhibited(destHex) && !isPavementStep() &&            movementType != IEntityMovementType.MOVE_VTOL_WALK &&            movementType != IEntityMovementType.MOVE_VTOL_RUN) {            // We're allowed to pass *over* invalid            // terrain, but we can't end there.            if (parent.isJumping()) {                terrainInvalid = true;            }            else {                // This is an illegal move.                return false;            }                        }        // If we are *in* restricted terrain, we can only leave via roads.        if ( movementType != IEntityMovementType.MOVE_JUMP             && movementType != IEntityMovementType.MOVE_VTOL_WALK             && movementType != IEntityMovementType.MOVE_VTOL_RUN             && entity.isHexProhibited(srcHex)             && !isPavementStep ) {            return false;        }        if( type == MovePath.STEP_UP) {            //only VTOLs have Z movement.            return (entity.getMovementMode() == IEntityMovementMode.VTOL)? true : false;        }        if( type == MovePath.STEP_DOWN) {            //only VTOLs have Z movement.            if(!(entity.getMovementMode() == IEntityMovementMode.VTOL)) {                return false;            }            if(!(entity.canGoDown(elevation+1,getPosition()))) {                return false;//We can't intentionally crash.            }        }        if (entity instanceof VTOL) {            if((type == MovePath.STEP_BACKWARDS)                     || (type == MovePath.STEP_FORWARDS)                     || (type == MovePath.STEP_TURN_LEFT)                     || (type == MovePath.STEP_TURN_RIGHT)) {                if(elevation==0) {//can't move on the ground.                    return false;                }            }        }        if ((entity instanceof VTOL)                && (type == MovePath.STEP_BACKWARDS || type == MovePath.STEP_FORWARDS)) {            if (elevation<=(destHex.ceiling()-destHex.surface())) {                return false; //can't fly into woods or a cliff face            }        }        return true;    }