if (entity.getMovementType() == Entity.MovementType.WHEELED) { if (destHex.contains(Terrain.WOODS) || destHex.contains(Terrain.ROUGH) || destHex.levelOf(Terrain.WATER) > 0 || destHex.contains(Terrain.RUBBLE)) { return false; } } else if (entity.getMovementType() == Entity.MovementType.TRACKED) { if (destHex.levelOf(Terrain.WOODS) > 1 || destHex.levelOf(Terrain.WATER) > 0) { return false; } } else if (entity.getMovementType() == Entity.MovementType.HOVER) { if (destHex.contains(Terrain.WOODS)) { return false; } }
    public static boolean isMovementPossible(Game game, int entityId,                                              Coords src, Coords dest,                                             int entityMoveType,                                             int stepType, boolean firstStep) {        final Entity entity = game.getEntity(entityId);        final Hex srcHex = game.board.getHex(src);        final Hex destHex = game.board.getHex(dest);                // arguments valid?        if (entity == null) {            throw new IllegalArgumentException("Entity invalid.");        }        if (src.distance(dest) > 1) {            throw new IllegalArgumentException("Coordinates must be adjacent.");        }                if (entityMoveType == Entity.MOVE_ILLEGAL) {            // that was easy            return false;        }        // another easy check        if (!game.board.contains(dest)) {            return false;        }        // check elevation difference > 2        if (entityMoveType != Entity.MOVE_JUMP             && Math.abs(srcHex.floor() - destHex.floor()) > 2) {            return false;        }        // units moving backwards may not change elevation levels (I think this rule's dumb)        if ((stepType == MovementData.STEP_BACKWARDS || stepType == MovementData.STEP_LATERAL_LEFT_BACKWARDS            || stepType == MovementData.STEP_LATERAL_RIGHT_BACKWARDS) && srcHex.floor() != destHex.floor()) {            return false;        }        // can't run into water        if (entityMoveType == Entity.MOVE_RUN             && destHex.levelOf(Terrain.WATER) > 0 && !firstStep) {            return false;        }        // can't move into a hex with an enemy unit, unless charging or jumping        if (entityMoveType != Entity.MOVE_JUMP            && stepType != MovementData.STEP_CHARGE            && stepType != MovementData.STEP_DFA            && game.getEntity(dest) != null            && entity.isEnemyOf(game.getEntity(dest))) {            return false;        }        // can't jump over too-high terrain        if (entityMoveType == Entity.MOVE_JUMP            && destHex.getElevation()                > (entity.elevation() +                  entity.getJumpMPWithTerrain())) {            return false;        }                return true;    }