/** * Create a step of the given type. * * @param type - should match one of the MovePath constants, but this is not * currently checked. */ public MoveStep(MovePath path, MoveStepType type) { this.type = type; if (path != null) { entity = path.getEntity(); isJumpingPath = path.isJumping(); isCarefulPath = path.isCareful(); } if ((type == MoveStepType.UNLOAD) || (type == MoveStepType.LAUNCH) || (type == MoveStepType.DROP) || (type == MoveStepType.UNDOCK) || (type == MoveStepType.DISCONNECT)) { hasEverUnloaded = true; } else { hasEverUnloaded = false; } }
public PathState(MovePath p) { location = p.getFinalCoords(); facing = p.getFinalFacing(); hulldown = p.getFinalHullDown() || p.getFinalProne(); isjumping = p.isJumping(); }
public Key getKey() { return new Key(getFinalCoords(), getFinalFacing(), getFinalProne() ? 0 : isJumping() ? 1 : 2); }
/** * Returns true if a jump using mechanical jump boosters would cause falling * damage. Mechanical jump boosters are only designed to handle the stress * of falls from a height equal to their jumpMP; if a jump has a fall that * is further than the jumpMP of the unit, fall damage applies. * * @return */ public boolean shouldMechanicalJumpCauseFallDamage() { if (isJumping() && (getEntity().getJumpType() == Mech.JUMP_BOOSTER) && (getJumpMaxElevationChange() > getEntity().getJumpMP())) { return true; } return false; }
private int getFacingDiff(final MovePath first) { if (first.isJumping()) { return 0; } if (first.getFinalCoords().equals(destination)) { return 0; } int firstFacing = Math.abs(((first.getFinalCoords().direction(destination) + (backward ? 3 : 0)) % 6) - first.getFinalFacing()); if (firstFacing > 3) { firstFacing = 6 - firstFacing; } if (first.canShift()) { firstFacing = Math.max(0, firstFacing - 1); } if ((first.getFinalCoords().degree(destination) % 60) != 0) { firstFacing++; } return firstFacing; } }
/** * Helper function that appends an unjam RAC command to the end of a qualifying path. * @param path The path to process. */ private void unjamRAC(MovePath path) { if(path.getEntity().canUnjamRAC() && (path.getMpUsed() <= path.getEntity().getWalkMP()) && !path.isJumping()) { path.addStep(MoveStepType.UNJAM_RAC); } }
private void updateTurnButton() { final Entity ce = ce(); if (null == ce) { return; } setTurnEnabled(!ce.isImmobile() && !ce.isStuck() && ((ce.getWalkMP() > 0) || (ce.getJumpMP() > 0)) && !(cmd.isJumping() && (ce instanceof Mech) && (ce .getJumpType() == Mech.JUMP_BOOSTER))); }
public static int getFacingDiff(final MovePath mp, Coords dest, boolean backward) { if (mp.isJumping()) { return 0;
/** * @param boardView1 * @param mp */ public MovementModifierEnvelopeSprite(BoardView1 boardView1, MovePath mp) { super(boardView1, mp.getFinalCoords()); facing = Facing.valueOfInt(mp.getFinalFacing()); int modi = Compute.getTargetMovementModifier(mp.getHexesMoved(), mp.isJumping(), mp.getEntity() instanceof VTOL, boardView1.game).getValue(); //Add evasion bonus for 'Mech with dual cockpit if (mp.getEntity().getCrew().getCrewType().equals(CrewType.DUAL) && mp.getEntity().getCrew().hasDedicatedPilot() && !mp.isJumping() && mp.getHexesMoved() > 0) { modi++; } float hue = 0.7f - 0.15f * modi; color = new Color(Color.HSBtoRGB(hue, 1, 1)); modifier = String.format("%+d", modi); }
if (mp.isJumping()) { return 0;
if (path.isJumping()) { logMsg.append("\n\tJumping"); Coords endCoords = path.getFinalCoords();
IBoard board, Entity ent) { if (mp.isJumping()) { return 0;
if (path.isJumping()) { final Coords finalCoords = path.getFinalCoords(); final Building building = game.getBoard().getBuildingAt(finalCoords);
if ((hex.terrainLevel(Terrains.WATER) > 0) && !cmd.isJumping() && (cmd.getFinalElevation() < 0)) { if ((fieldofFireUnit instanceof Mech) && !fieldofFireUnit.isProne()
private void removeLastStep() { cmd.removeLastStep(); if (cmd.length() == 0) { clear(); if ((gear == MovementDisplay.GEAR_JUMP) && (!cmd.isJumping())) { cmd.addStep(MoveStepType.START_JUMP); } else if (ce().isConvertingNow()) { cmd.addStep(MoveStepType.CONVERT_MODE); } } else { clientgui.bv.drawMovementData(ce(), cmd); clientgui.bv.setWeaponFieldofFire(ce(), cmd); // Set the button's label to "Done" // if the entire move is impossible. MovePath possible = cmd.clone(); possible.clipToPossible(); if (possible.length() == 0) { butDone.setText("<html><b>" + Messages.getString("MovementDisplay.Done") + "</b></html>"); //$NON-NLS-1$ } } updateButtons(); }
public boolean canShift() { return ((getEntity() instanceof QuadMech // QuadVee cannot shift in vee mode && !(getEntity() instanceof QuadVee && (entity.getConversionMode() == QuadVee.CONV_MODE_VEHICLE || getEntity().isConvertingNow()))) // Maneuvering Ace allows Bipeds and VTOLs moving at cruise // speed to perform a lateral shift || (getEntity().isUsingManAce() && ((getEntity() instanceof BipedMech) || ((getEntity() instanceof VTOL) && (getMpUsed() <= getEntity().getWalkMP())))) || (game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_VEHICLE_ADVANCED_MANEUVERS) && getEntity() instanceof Tank && (getEntity().getMovementMode() == EntityMovementMode.VTOL || getEntity().getMovementMode() == EntityMovementMode.HOVER)) || ((getEntity() instanceof TripodMech) && (((Mech) getEntity()).countBadLegs() == 0))) && !isJumping(); }
/** * Initialize an entity state from a movement path */ EntityState(MovePath path) { position = path.getFinalCoords(); facing = path.getFinalFacing(); hexesMoved = path.getHexesMoved(); heat = path.getEntity().heat; if (path.getLastStepMovementType() == EntityMovementType.MOVE_WALK) { heat = getHeat() + 1; } else if (path.getLastStepMovementType() == EntityMovementType.MOVE_RUN) { heat = getHeat() + 2; } else if ((path.getLastStepMovementType() == EntityMovementType.MOVE_JUMP) && (getHexesMoved() <= 3)) { heat = getHeat() + 3; } else if ((path.getLastStepMovementType() == EntityMovementType.MOVE_JUMP) && (getHexesMoved() > 3)) { heat = getHeat() + getHexesMoved(); } prone = path.getFinalProne() || path.getFinalHullDown(); immobile = path.getEntity().isImmobile(); jumping = path.isJumping(); movementType = path.getLastStepMovementType(); naturalAptGun = path.getEntity().hasAbility(OptionsConstants.PILOT_APTITUDE_GUNNERY); naturalAptPilot = path.getEntity().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING); setSecondaryFacing(getFacing()); }
clear(); if (!cmd.isJumping()) { cmd.addStep(MoveStepType.START_JUMP);
GUIPreferences.ADVANCED_MOVE_DEFAULT_COLOR); clientgui.getBoardView().setHighlightColor(walkColor); } else if (!cmd.isJumping()) { cmd.addStep(MoveStepType.START_JUMP);