overallMoveType, lastStepOnPavement)
overallMoveType)
  public void addStep(int step_type) {      // We *might* skid if we move after turning.      boolean isTurning = false;    try {      if (firstStep && step_type == MovementData.STEP_START_JUMP) {        this.overallMoveType = Entity.MOVE_JUMP;        this.isJumping = true;      }      //check to make sure we're not jumping after the first move.      if (!firstStep && step_type == MovementData.STEP_START_JUMP) {        this.overallMoveType = Entity.MOVE_ILLEGAL;      }      super.addStep(step_type);      Steps.add(new Integer(step_type));      int entityId = entity.getId();      Coords lastPos = new Coords(curPos);      int stepMp = 0;      //calculate mps used      switch(step_type) {        case MovementData.STEP_TURN_LEFT :        case MovementData.STEP_TURN_RIGHT :          stepMp = (isJumping || hasJustStood) ? 0 : 1;          curFacing = MovementData.getAdjustedFacing(curFacing,step_type);          break;        case MovementData.STEP_BACKWARDS :          isRunProhibited = true;        case MovementData.STEP_FORWARDS :        case MovementData.STEP_CHARGE :        case MovementData.STEP_DFA :          // step forwards or backwards          if (step_type == MovementData.STEP_BACKWARDS) {            curPos = curPos.translated((curFacing + 3) % 6);          } else {            curPos = curPos.translated(curFacing);          }          if (game.board.getHex(curPos) == null) {            this.overallMoveType = Entity.MOVE_ILLEGAL;            return;          }          stepMp = Compute.getMovementCostFor(game, this.entity.getId(), lastPos, curPos,          overallMoveType);          // check for water          if (game.board.getHex(curPos).contains(Terrain.WATER)) {            isRunProhibited = true;          }          //should check for heatBuildup related to movement          hasJustStood = false;          break;        case MovementData.STEP_GET_UP :          // mechs with 1 MP are allowed to get up          stepMp = entity.getWalkMP() == 1 ? 1 : 2;          heatBuildup += 1;          hasJustStood = true;          isProne = false;          break;        default :          stepMp = 0;      }      isDanger = false;      boolean runningDanger = false;      mpUsed += stepMp;      // check for running      if (overallMoveType == Entity.MOVE_WALK && mpUsed > entity.getWalkMP()) {        overallMoveType = Entity.MOVE_RUN;        // running with gyro or hip hit is dangerous!        if (!isRunProhibited && (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)) {          isDanger = true;          runningDanger = true;        }      } else if (overallMoveType != Entity.MOVE_JUMP && overallMoveType != Entity.MOVE_ILLEGAL) {        overallMoveType = Entity.MOVE_WALK; //walk before you run      }      // second pass: set moveType, illegal, trouble flags      // guilty until proven innocent      int moveType = Entity.MOVE_ILLEGAL;      // check for valid jump mp      if (overallMoveType == Entity.MOVE_JUMP      && mpUsed <= entity.getJumpMP() && !isProne) {        moveType = Entity.MOVE_JUMP;      }      // check for valid walk/run mp      if ((overallMoveType == Entity.MOVE_WALK || overallMoveType == Entity.MOVE_RUN)      && (!isProne || step_type == MovementData.STEP_TURN_LEFT      || step_type == MovementData.STEP_TURN_RIGHT)) {        if (mpUsed <= entity.getWalkMP()) {          moveType = Entity.MOVE_WALK;        } else if (mpUsed <= entity.getRunMP() && !isRunProhibited) {          moveType = Entity.MOVE_RUN;        }      }      // mechs with 1 MP are allowed to get up      if (step_type == 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_type == MovementData.STEP_FORWARDS) {        moveType = Entity.MOVE_RUN;      }      // check if this movement is illegal for reasons other than points      if (!this.isMovementPossible(game, entity.getId(), lastPos, curPos, moveType, step_type)) {        moveType = Entity.MOVE_ILLEGAL;      }      // no legal moves past an illegal one      if (moveType == Entity.MOVE_ILLEGAL || overallMoveType == Entity.MOVE_ILLEGAL) {        isMovementLegal = false;      }      // We need the previous step.      MovementData.Step prevStep = null;      boolean lastStepOnPavement = false;      if (this.length() > 1) {	  prevStep = (MovementData.Step)getStep(length() - 1);          lastStepOnPavement = prevStep.isOnPavement();      }      // check for danger      isDanger = (Compute.isPilotingSkillNeeded(game, entityId,                                                lastPos, curPos,                                                moveType, isTurning,                                                overallMoveType,                                                lastStepOnPavement)                  || step_type == MovementData.STEP_GET_UP);      // Record if we're turning *after* check for danger,      // because the danger lies in moving *after* turn.      switch(step_type) {      case MovementData.STEP_UNLOAD:          // Unloading transported units doesn't protect vs. skids.          break;      case MovementData.STEP_TURN_LEFT :      case MovementData.STEP_TURN_RIGHT :          isTurning = true;          break;      default:          isTurning = false;          break;      }      //this should be a more exact calculation, but for now it just serves as a deterent      //for example it should actaully be a proportion of the threat if you end up stuck in      //this state      if (isDanger) {        double mod = 1;        if (centity.base_psr_odds < .1) {          moveType = Entity.MOVE_ILLEGAL;        } else if (runningDanger) {          if (centity.base_psr_odds < .5) {            moveType = Entity.MOVE_ILLEGAL;           } else {            mod = 5;          }        } else {          double threat = mod*this.centity.getThreatUtility(.2*this.entity.getWeight(),CEntity.SIDE_REAR)*(1-Math.pow(this.centity.base_psr_odds, 2));          this.movement_threat += threat;          this.tv.add(threat +" Movement Threat \n");        }      }      this.overallMoveType = isMovementLegal ? moveType : Entity.MOVE_ILLEGAL;      firstStep = false;      delta_distance = curPos.distance(entity.getPosition());    } catch (Exception e) {      this.overallMoveType = Entity.MOVE_ILLEGAL;    }  }