/** * Returns the logical number of hexes moved the path (does not count turns, * etc). */ public int getHexesMoved() { if (getLastStep() == null) { return 0; } return getLastStep().getDistance(); }
public int getFinalNDown() { if (getLastStep() != null) { return getLastStep().getNDown(); } return 0; }
/** * Returns the number of MPs used in the path */ public int getMpUsed() { if (getLastStep() != null) { return getLastStep().getMpUsed(); } return 0; }
public EntityMovementType getLastStepMovementType() { if (getLastStep() == null) { return EntityMovementType.MOVE_NONE; } return getLastStep().getMovementType(true); }
public MoveStep getSecondLastStep() { if (steps.size() > 1) { return getStep(steps.size() - 2); } return getLastStep(); }
@Override public boolean shouldStay(MovePath mp) { MoveStep step = mp.getLastStep(); if (step == null) { return true; } return !step.isDanger(); } }
/** * Returns the final vector for advanced movement */ public int[] getFinalVectors() { if (getLastStep() != null) { return getLastStep().getVectors(); } return getEntity().getVectors(); }
/** * get final altitude */ public int getFinalAltitude() { if (getLastStep() != null) { return getLastStep().getAltitude(); } return getEntity().getAltitude(); }
/** * get final elevation relative to the hex. */ public int getFinalElevation() { if (getLastStep() != null) { return getLastStep().getElevation(); } return getEntity().getElevation(); }
/** * If the path contains mode conversions, this will determine the movement mode at the end * of movement. Note that LAMs converting from AirMech to Biped mode require two convert commands. * * @return The movement mode resulting from any mode conversions in the path. */ public EntityMovementMode getFinalConversionMode() { if (getLastStep() != null) { return getLastStep().getMovementMode(); } return getEntity().getMovementMode(); }
/** * Returns whether or not a unit would end up prone after all of the steps */ public boolean getFinalProne() { if (getLastStep() != null) { return getLastStep().isProne(); } if (getEntity() == null) { return false; } return getEntity().isProne(); }
/** * Returns whether or not a unit would end up hull-down after all of the steps */ public boolean getFinalHullDown() { if (getLastStep() != null) { return getLastStep().isHullDown(); } if (getEntity() == null) { return false; } return getEntity().isHullDown(); }
/** * Returns whether or not a unit would be in climb mode after all the steps */ public boolean getFinalClimbMode() { if (getLastStep() != null) { return getLastStep().climbMode(); } if (getEntity() == null) { return false; } return getEntity().climbMode(); }
public int getFinalVelocity() { if (getLastStep() != null) { return getLastStep().getVelocity(); } if (getEntity().isAero()) { return ((IAero) getEntity()).getCurrentVelocity(); } return 0; }
public int getFinalVelocityLeft() { if (getLastStep() != null) { return getLastStep().getVelocityLeft(); } if (getEntity().isAero()) { return ((IAero) getEntity()).getCurrentVelocity(); } return 0; }
/** * Returns the final facing if a mech were to perform all the steps in this * path. */ public int getFinalFacing() { MoveStep last = getLastStep(); if (last != null) { return last.getFacing(); } return getEntity().getFacing(); }
/** * Returns the final coordinates if a mech were to perform all the steps in * this path. */ public Coords getFinalCoords() { if(getGame().useVectorMove()) { return Compute.getFinalPosition(getEntity().getPosition(), getFinalVectors()); } if (getLastStep() != null) { return getLastStep().getPosition(); } return getEntity().getPosition(); }
/** * get final elevation relative to the tops of any buildings in the hex * @return */ public int getFinalClearance() { if (getLastStep() != null) { return getLastStep().getClearance(); } IHex hex = entity.getGame().getBoard().getHex(getEntity().getPosition()); if (hex.containsTerrain(Terrains.BLDG_ELEV)) { return getEntity().getElevation() - hex.terrainLevel(Terrains.BLDG_ELEV); } return getEntity().getElevation(); }
@Override public CoordsWithFacing getDestination(MovePath e) { MoveStep lastStep = e.getLastStep(); /* * entity moving backwards is like entity with an opposite facing * moving forwards :) NOOOT */ CoordsWithFacing cfw; if (lastStep != null && lastStep.isThisStepBackwards()) { Facing f = Facing.valueOfInt(e.getFinalFacing()); cfw = new CoordsWithFacing(e.getFinalCoords(), f.getOpposite().getIntValue()); } else { cfw = new CoordsWithFacing(e); } return cfw; }
private void updateRACButton() { final Entity ce = ce(); if (null == ce) { return; } GameOptions opts = clientgui.getClient().getGame().getOptions(); setUnjamEnabled(ce.canUnjamRAC() && ((gear == MovementDisplay.GEAR_LAND) || (gear == MovementDisplay.GEAR_TURN) || (gear == MovementDisplay.GEAR_BACKUP)) && ((cmd.getMpUsed() <= ce.getWalkMP()) || (cmd.getLastStep().isOnlyPavement() && (cmd.getMpUsed() <= (ce.getWalkMP() + 1)))) && !(opts.booleanOption("tacops_tank_crews") && (cmd.getMpUsed() > 0) && (ce instanceof Tank) && (ce.getCrew().getSize() < 2))); }