&& (entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO,Mech.LOC_CT) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_LLEG) > 0)) {
&& (entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO,Mech.LOC_CT) > 0 || entity.hasHipCrit())) {
    public static void compile(Game game, int entityId, MovementData md) {        final Entity entity = game.getEntity(entityId);                // some flags        int curFacing = entity.getFacing();        Coords lastPos;        Coords curPos = new Coords(entity.getPosition());        int mpUsed = 0;        int distance = 0;        boolean isProne = entity.isProne();        boolean hasJustStood = false;        boolean firstStep = true;                int overallMoveType = Entity.MOVE_WALK;        boolean isJumping = false;        boolean isRunProhibited = false;        boolean isMovementLegal = true;                boolean isDanger = false;        boolean isPastDanger = false;                // check for jumping        if (md.contains(MovementData.STEP_START_JUMP)) {            overallMoveType = Entity.MOVE_JUMP;            isJumping = true;        }                // check for backwards movement        if (md.contains(MovementData.STEP_BACKWARDS)) {            isRunProhibited = true;        }                // first pass: set position, facing and mpUsed; figure out overallMoveType        for (final Enumeration i = md.getSteps(); i.hasMoreElements();) {            final MovementData.Step step = (MovementData.Step)i.nextElement();                        int stepMp = 0;                        lastPos = new Coords(curPos);                        //             switch(step.getType()) {            case MovementData.STEP_TURN_LEFT :            case MovementData.STEP_TURN_RIGHT :                stepMp = (isJumping || hasJustStood) ? 0 : 1;                curFacing = MovementData.getAdjustedFacing(curFacing, step.getType());                break;            case MovementData.STEP_FORWARDS :            case MovementData.STEP_BACKWARDS :            case MovementData.STEP_CHARGE :            case MovementData.STEP_DFA :                // step forwards or backwards                if (step.getType() == MovementData.STEP_BACKWARDS) {                    curPos = curPos.translated((curFacing + 3) % 6);                } else {                    curPos = curPos.translated(curFacing);                }                stepMp = getMovementCostFor(game, entityId, lastPos, curPos,                                            overallMoveType);                // check for water                if (game.board.getHex(curPos).getTerrainType() == Terrain.WATER) {                    isRunProhibited = true;                }                hasJustStood = false;                distance += 1;                break;            case MovementData.STEP_GET_UP :                // mechs with 1 MP are allowed to get up                stepMp = entity.getWalkMP() == 1 ? 1 : 2;                hasJustStood = true;                break;            default :                stepMp = 0;            }                        mpUsed += stepMp;                        // check for running            if (overallMoveType == Entity.MOVE_WALK                 && mpUsed > entity.getWalkMP()) {                overallMoveType = Entity.MOVE_RUN;            }                        // set flags            step.setPosition(curPos);            step.setFacing(curFacing);            step.setMpUsed(mpUsed);            step.setDistance(distance);        }                // running with gyro or hip hit is dangerous!        if (!isRunProhibited && overallMoveType == Entity.MOVE_RUN            && (entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM,                                             Mech.SYSTEM_GYRO,Mech.LOC_CT) > 0                || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM,                                                Mech.ACTUATOR_HIP, Mech.LOC_RLEG) > 0                || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM,                                                Mech.ACTUATOR_HIP, Mech.LOC_LLEG) > 0)) {            md.getStep(0).setDanger(true);        }                // second pass: set moveType, illegal, trouble flags        curPos = new Coords(entity.getPosition());        firstStep = true;        for (final Enumeration i = md.getSteps(); i.hasMoreElements();) {            final MovementData.Step step = (MovementData.Step)i.nextElement();                        lastPos = new Coords(curPos);            curPos = step.getPosition();                        // guilty until proven innocent            int moveType = Entity.MOVE_ILLEGAL;                        // check for valid jump mp            if (overallMoveType == Entity.MOVE_JUMP                 && step.getMpUsed() <= entity.getJumpMP()                && !entity.isProne()) {                moveType = Entity.MOVE_JUMP;            }                        // check for valid walk/run mp            if ((overallMoveType == Entity.MOVE_WALK || overallMoveType == Entity.MOVE_RUN)                && (!entity.isProne() || md.contains(MovementData.STEP_GET_UP)                    || step.getType() == MovementData.STEP_TURN_LEFT                     || step.getType() == MovementData.STEP_TURN_RIGHT)) {                if (step.getMpUsed() <= entity.getWalkMP()) {                    moveType = Entity.MOVE_WALK;                } else if (step.getMpUsed() <= entity.getRunMP() && !isRunProhibited) {                    moveType = Entity.MOVE_RUN;                }            }                        // mechs with 1 MP are allowed to get up            if (step.getType() == MovementData.STEP_GET_UP && entity.getWalkMP() == 1) {                moveType = Entity.MOVE_RUN;            }                        // amnesty for the first step            if (firstStep && moveType == Entity.MOVE_ILLEGAL && entity.getWalkMP() > 0 && !entity.isProne() && step.getType() == MovementData.STEP_FORWARDS) {                moveType = Entity.MOVE_RUN;            }                        // check if this movement is illegal for reasons other than points            if (!isMovementPossible(game, entityId, lastPos, curPos, moveType, step.getType())) {                moveType = Entity.MOVE_ILLEGAL;            }                        // no legal moves past an illegal one            if (moveType == Entity.MOVE_ILLEGAL) {                isMovementLegal = false;            }                        // check for danger            isDanger = step.isDanger();            isDanger |= isPilotingSkillNeeded(game, entityId, lastPos,                                               curPos, moveType);                        // getting up is also danger            if (step.getType() == MovementData.STEP_GET_UP) {                isDanger = true;            }                        // set flags            step.setDanger(isDanger);            step.setPastDanger(isPastDanger);            step.setMovementType(isMovementLegal                                  ? moveType : Entity.MOVE_ILLEGAL);                        // set past danger            isPastDanger |= isDanger;                        firstStep = false;        }                // third pass (sigh) : avoid stacking violations        isMovementLegal = false;        for (int i = md.length() - 1; i >= 0; i--) {            final MovementData.Step step = md.getStep(i);                        // find the last legal step            if (!isMovementLegal && step.getMovementType() != Entity.MOVE_ILLEGAL) {                final Entity entityInHex = game.getEntity(step.getPosition());                if (entityInHex != null && !entityInHex.equals(entity)                        && step.getType() != MovementData.STEP_CHARGE                        && step.getType() != MovementData.STEP_DFA) {                    // can't move here                    step.setMovementType(Entity.MOVE_ILLEGAL);                } else {                    isMovementLegal = true;                }            }        }                md.setCompiled(true);    }