while(altitudePath.getFinalAltitude() != desiredAltitude) { if(altitudePath.getFinalAltitude() < desiredAltitude && altitudePath.getMpUsed() < maxThrust - 1) { altitudePath.addStep(MoveStepType.UP); else if(altitudePath.getFinalAltitude() > desiredAltitude && altitudePath.getFinalAltitude() >= startingPath.getFinalAltitude() - 1) { altitudePath.addStep(MoveStepType.DOWN);
/** * Determines whether or not the given move path is "redundant". * In this situation, "redundant" means "there is already a shorter path that goes to the ending coordinates/facing/height" combo. */ @Override protected boolean pathIsRedundant(MovePath mp) { if(!mp.fliesOffBoard()) { CoordsWithFacing destinationCoords = new CoordsWithFacing(mp); if(!visitedCoords.containsKey(destinationCoords)) { visitedCoords.put(destinationCoords, new HashMap<>()); } // we may or may not have been to these coordinates before, but we haven't been to this height. Not redundant. if(!visitedCoords.get(destinationCoords).containsKey(mp.getFinalAltitude())) { visitedCoords.get(destinationCoords).put(mp.getFinalAltitude(), mp.getMpUsed()); return false; // we *have* been to these coordinates and height before. This is redundant if the previous visit used less MP. } else { return visitedCoords.get(destinationCoords).get(mp.getFinalAltitude()) < mp.getMpUsed(); } } else { return false; } } }
/** * 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); }
if((path.getFinalAltitude() + altChange > 10) || path.getMpUsed() + altChangeCost > path.getEntity().getRunMP()) { break; if((childPath.getFinalAltitude() > 10) || childPath.getMpUsed() > path.getEntity().getRunMP()) { break; if(path.getFinalAltitude() > 1) { for(int altChange = 1; ; altChange++) { MovePath childPath = path.clone(); if((childPath.getFinalAltitude() < 1) || childPath.getMpUsed() > path.getEntity().getRunMP()) { break;
(path.getFinalAltitude() < 2)) { msg.append("\n\tNo bombs but at altitude 1. No way."); continue;
Mockito.when(mockFlightPath.getFinalAltitude()).thenReturn(5);
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())); }
if (AeroGroundPathFinder.NAP_OF_THE_EARTH >= flightPath.getFinalAltitude() && 0 == shooter.getBombs(BombType.F_GROUND_BOMB).size()) { owner.log(getClass(), METHOD_NAME, LogLevel.ERROR, "Shooter will crash if striking at altitude 1!"); if (AeroGroundPathFinder.OPTIMAL_STRIKE_ALTITUDE < flightPath.getFinalAltitude()) { owner.log(getClass(), METHOD_NAME, LogLevel.ERROR, "Shooter's altitude is too high!"); return myPlan;
if (ce.isAirborne() && (cmd.getFinalAltitude() == 1)) { setLandEnabled(((IAero) ce).canLandHorizontally()); setVLandEnabled(((IAero) ce).canLandVertically());
if (!ce.isAero() && cmd.getFinalAltitude() > 0) { disableButtons(); if (ce instanceof LandAirMech) {
if (!ce.isAero() && cmd.getFinalAltitude() > 0) { disableButtons(); if (ce instanceof LandAirMech) {