/** * Returns true if this MovePath contains a lateral shift * @return */ public boolean containsLateralShift() { return this.contains(MoveStepType.LATERAL_LEFT) || this.contains(MoveStepType.LATERAL_RIGHT) || this.contains(MoveStepType.LATERAL_LEFT_BACKWARDS) || this.contains(MoveStepType.LATERAL_RIGHT_BACKWARDS); }
/** * Convenience function to determine whether this path results in the unit explicitly moving off board * More relevant for aircraft * @return Whether or not this path will result in the unit moving off board */ public boolean fliesOffBoard() { return contains(MoveStepType.OFF) || contains(MoveStepType.RETURN) || contains(MoveStepType.FLEE); }
/** * Determines if the aircraft undertaking the given path will become a lawn dart * @param movePath the path to check * @return True or false */ public static boolean willCrash(MovePath movePath) { return movePath.getEntity().isAero() && (movePath.getFinalAltitude() < 1) && !movePath.contains(MoveStepType.VLAND) && !movePath.contains(MoveStepType.LAND); }
default PilotingRollData checkStall(MovePath md) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(md.getLastStepMovementType()); // if the entity has already moved, its movement got interrupted (probably by a hidden unit, not much else can interrupt an aero unit) // in which case, the movement is complete. We just need to allow the user to hit 'done'. if(((Entity) this).delta_distance > 0) { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: aero has already moved"); // an airborne, aerodyne aero is considered to "stall" if it's not moving anywhere, // hovering, landing, or going off board } else if ((md.getFinalVelocity() == 0) && !md.contains(MoveStepType.HOVER) && isAirborne() && !isSpheroid() && !((Entity) this).getGame().getBoard().inSpace() && !md.contains(MoveStepType.LAND) && !md.contains(MoveStepType.VLAND) && !md.contains(MoveStepType.RETURN) && !md.contains(MoveStepType.OFF) && !md.contains(MoveStepType.FLEE)) { roll.append(new PilotingRollData(((Entity) this).getId(), 0, "stalled out")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: entity not stalled out"); } return roll; }
private void updateSearchlightButton() { final Entity ce = ce(); if (null == ce) { return; } setSearchlightEnabled( ce.hasSpotlight() && !cmd.contains(MoveStepType.SEARCHLIGHT), ce().isUsingSpotlight()); }
if (getEntity().isConvertingNow() && !this.contains(MovePath.MoveStepType.CONVERT_MODE)) { getEntity().setConvertingNow(false);
default PilotingRollData checkHover(MovePath md) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(md.getLastStepMovementType()); if (md.contains(MoveStepType.HOVER) && (md.getLastStepMovementType() == EntityMovementType.MOVE_OVER_THRUST)) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), 0, "hovering above safe thrust")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: entity did not hover"); } return roll; }
if (!md.contains(MoveStepType.CHARGE)) { return new ToHitData(TargetRoll.IMPOSSIBLE, "Charge action not found in movement path"); if (md.contains(MoveStepType.START_JUMP)) { return new ToHitData(TargetRoll.IMPOSSIBLE, "No jumping allowed while charging"); if (md.contains(MoveStepType.BACKWARDS) || md.contains(MoveStepType.LATERAL_LEFT_BACKWARDS) || md.contains(MoveStepType.LATERAL_RIGHT_BACKWARDS)) { return new ToHitData(TargetRoll.IMPOSSIBLE, "No backwards movement allowed while charging"); if (md.contains(MoveStepType.EVADE)) { return new ToHitData(TargetRoll.IMPOSSIBLE, "No evading while charging"); chargeStep.getMovementType(true), false, md.contains(MoveStepType.GET_UP) || md.contains(MoveStepType.CAREFUL_STAND));
private void updateRollButton() { final Entity ce = ce(); if (null == ce) { return; } if (!ce.isAero()) { return; } setRollEnabled(true); if (!clientgui.getClient().getGame().getBoard().inSpace()) { setRollEnabled(false); } if (cmd.contains(MoveStepType.ROLL)) { setRollEnabled(false); } return; }
&& !movePath.contains(MoveStepType.VLAND)) { return true;
/** * A quick determination that checks the given path for the most common causes of a PSR and whether it leads us off board. * The idea being that a safe path off board should not include any PSRs. * @param movePath The path to check * @return True or false */ public static boolean isSafePathOffBoard(MovePath movePath) { // common causes of PSR include, but are not limited to: // stalling your aircraft // crashing your aircraft into the ground // executing maneuvers // thrusting too hard // see your doctor if you experience any of these symptoms as it may lead to your aircraft transforming into a lawn dart return !willStall(movePath) && !willCrash(movePath) && movePath.fliesOffBoard() && !movePath.contains(MoveStepType.MANEUVER) && (movePath.getMpUsed() <= movePath.getEntity().getWalkMP()) && (movePath.getEntity().isAero() && (movePath.getMpUsed() <= ((IAero) movePath.getEntity()).getSI())); }
private void updateHoverButton() { final Entity ce = ce(); if (null == ce) { return; } if (ce.isAero()) { if (!((IAero)ce).isVSTOL()) { return; } if (clientgui.getClient().getGame().getBoard().inSpace()) { return; } } else if (!(ce instanceof Protomech) && !(ce instanceof LandAirMech && (((LandAirMech)ce).getConversionMode() == LandAirMech.CONV_MODE_AIRMECH)) && (ce.getAltitude() <= 3)) { return; } if (!cmd.contains(MoveStepType.HOVER)) { setHoverEnabled(true); } else { setHoverEnabled(false); } }
private void updateManeuverButton() { final Entity ce = ce(); if (null == ce) { return; } if (clientgui.getClient().getGame().getBoard().inSpace()) { return; } if (!ce.isAirborne()) { return; } if (!ce.isAero()) { return; } IAero a = (IAero) ce; if (a.isSpheroid()) { return; } if (a.didFailManeuver()) { setManeuverEnabled(false); } if ((null != cmd) && cmd.contains(MoveStepType.MANEUVER)) { setManeuverEnabled(false); } else { setManeuverEnabled(true); } }
if (!md.contains(MoveStepType.RAM)) { return new ToHitData(TargetRoll.IMPOSSIBLE, "Ram action not found in movement path");
private synchronized void updateElevationButtons() { final Entity ce = ce(); if (null == ce) { return; } if (ce.isAirborne()) { // then use altitude not elevation setRaiseEnabled(ce.canGoUp(cmd.getFinalAltitude(), cmd.getFinalCoords())); setLowerEnabled(ce.canGoDown(cmd.getFinalAltitude(), cmd.getFinalCoords())); return; } // WiGEs (and LAMs and glider protomechs) cannot go up if they've used ground movement. if ((ce.getMovementMode() == EntityMovementMode.WIGE) && !ce.isAirborneVTOLorWIGE() && (cmd.getMpUsed() > 0) && !cmd.contains(MoveStepType.UP)) { setRaiseEnabled(false); } else { setRaiseEnabled(ce.canGoUp(cmd.getFinalElevation(), cmd.getFinalCoords())); } setLowerEnabled(ce.canGoDown(cmd.getFinalElevation(), cmd.getFinalCoords())); }
private void updateAeroButtons() { if (ce() != null && ce().isAero()) { getBtn(MoveCommand.MOVE_THRUST).setEnabled(true); getBtn(MoveCommand.MOVE_YAW).setEnabled(true); getBtn(MoveCommand.MOVE_END_OVER).setEnabled(true); getBtn(MoveCommand.MOVE_TURN_LEFT).setEnabled(true); getBtn(MoveCommand.MOVE_TURN_RIGHT).setEnabled(true); setEvadeAeroEnabled(cmd != null && !cmd.contains(MoveStepType.EVADE)); setEjectEnabled(true); // no turning for spheroids in atmosphere if ((((IAero) ce()).isSpheroid() || clientgui.getClient().getGame() .getPlanetaryConditions().isVacuum()) && !clientgui.getClient().getGame().getBoard().inSpace()) { setTurnEnabled(false); } } }