public static boolean isGroundToAir(Entity attacker, Targetable target) { if ((attacker == null) || (target == null)) { return false; } return !attacker.isAirborne() && target.isAirborne(); }
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())); }
public static boolean isAirToAir(Entity attacker, Targetable target) { if ((attacker == null) || (target == null)) { return false; } // According to errata, VTOL and WiGes are considered ground targets return attacker.isAirborne() && target.isAirborne(); }
public static boolean isGroundToGround(Entity attacker, Targetable target) { if ((attacker == null) || (target == null)) { return false; } return !attacker.isAirborne() && !target.isAirborne(); }
public boolean isDropping() { return isAirborne() && !(isAero()); }
private void updateDropButton() { final Entity ce = ce(); if (null == ce) { return; } setDropEnabled(ce.isAirborne() && (ce.getDroppableUnits().size() > 0)); }
@SuppressWarnings("unchecked") public static List<TargetRoll> getPSRList(MovePath md) { // certain types of entities, such as airborne aero units, do not require many of the checks // carried out in the full PSR Check. So, we call a method that skips most of those. if(md.getEntity().isAirborne()) { return (List<TargetRoll>) getAeroSpecificPSRList(md, false); } else { return (List<TargetRoll>) doPSRCheck(md, false); } }
/** * Convenience method to determine whether this entity should be treated as an airborne aero on a ground map. * @return True if this is an airborne aircraft on a ground map. */ public boolean isAirborneAeroOnGroundMap() { return isAero() && isAirborne() && getGame().getBoard().onGround(); }
public static boolean isAirToGround(Entity attacker, Targetable target) { if ((attacker == null) || (target == null)) { return false; } //Artillery attacks need to return differently, since none of the usual air to ground modifiers apply to them if (target.getTargetType() == Targetable.TYPE_HEX_ARTILLERY) { return false; } if (attacker.isSpaceborne()) { return false; } // According to errata, VTOL and WiGes are considered ground targets return attacker.isAirborne() && !target.isAirborne() && attacker.isAero(); }
/** * Helper function that insinuates an "evade" step for aircraft that will not be shooting. * @param path The path to process */ private void evadeIfNotFiring(MovePath path, boolean possibleToInflictDamage) { Entity pathEntity = path.getEntity(); // we cannot evade if we are out of control if(pathEntity.isAero() && pathEntity.isAirborne() && ((IAero) pathEntity).isOutControlTotal()) { return; } // if we're an airborne aircraft // and we're not going to do any damage anyway // and we can do so without causing a PSR // then evade if(pathEntity.isAirborne() && !possibleToInflictDamage && (path.getMpUsed() <= AeroPathUtil.calculateMaxSafeThrust((IAero) path.getEntity()) - 2)) { path.addStep(MoveStepType.EVADE); } }
public boolean accept(Entity entity) { Integer id = new Integer(entity.getId()); if ((player == entity.getOwnerId()) && spottersBefore.contains(id) && !(LosEffects.calculateLos(game, entity.getId(), targ, true)) .isBlocked() && entity.isActive() // airborne aeros can't spot for arty && !((entity.isAero()) && entity .isAirborne()) && !entity.isINarcedWith(INarcPod.HAYWIRE)) { return true; } return false; } });
public boolean accept(Entity entity) { Integer id = new Integer(entity.getId()); if ((player == entity.getOwnerId()) && spottersBefore.contains(id) && !(LosEffects.calculateLos(game, entity.getId(), targ, true)) .isBlocked() && entity.isActive() // airborne aeros can't spot for arty && !(entity.isAero() && entity .isAirborne()) && !entity.isINarcedWith(INarcPod.HAYWIRE)) { return true; } return false; } });
private void updateRecklessButton() { final Entity ce = ce(); if (null == ce) { return; } if (ce.isAirborne()) { setRecklessEnabled(false); } if (ce instanceof Protomech) { setRecklessEnabled(false); } else { setRecklessEnabled((null == cmd) || (cmd.length() == 0)); } }
/** * Should we treat this movement as if it is occuring for an aerodyne unit * flying in atmosphere? */ boolean useAeroAtmosphere(IGame game, Entity en) { if (!en.isAero()) { return false; } if (((IAero) en).isSpheroid()) { return false; } // are we in space? if (game.getBoard().inSpace()) { return false; } // are we airborne in non-vacuum? return en.isAirborne() && !game.getPlanetaryConditions().isVacuum(); }
@Override protected int calcDamagePerHit() { AmmoType atype = (AmmoType) ammo.getType(); double toReturn = atype.getDamagePerShot(); int minRange; if (ae.isAirborne()) { minRange = wtype.getATRanges()[RangeType.RANGE_MINIMUM]; } else { minRange = wtype.getMinimumRange(); } if ((nRange <= minRange) && !weapon.isHotLoaded()) { toReturn /= 2; toReturn = Math.floor(toReturn); } if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { toReturn = Compute.directBlowInfantryDamage(toReturn, bDirect ? toHit.getMoS() / 3 : 0, wtype.getInfantryDamageClass(), ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); } else if (bDirect) { toReturn = Math.min(toReturn + (toHit.getMoS() / 3), toReturn * 2); } return (int) Math.ceil(toReturn); }
/** * Should we treat this movement as if it is occurring for a spheroid unit * flying in atmosphere? * * @param game * @param en * @return */ private boolean useSpheroidAtmosphere(IGame game, Entity en) { if (en.isAero()) { return false; } // are we in space? if (game.getBoard().inSpace()) { return false; } // aerodyne's will operate like spheroids in vacuum if (!((IAero) en).isSpheroid() && !game.getPlanetaryConditions().isVacuum()) { return false; } // are we in atmosphere? return en.isAirborne(); }
boolean isAirborne = movePath.getEntity().isAirborne(); boolean isSpheroid = UnitType.isSpheroidDropship(movePath.getEntity());
/** * is the unit flying Nape of the Earth? (i.e. one elevation above ground) */ public boolean isNOE() { if (!isAirborne()) { return false; } if (game.getBoard().inAtmosphere()) { return (1 == (getAltitude() - game.getBoard().getHex(getPosition()) .ceiling(true))); } if (game.getBoard().onGround()) { return 1 == getAltitude(); } return false; }
default String hasRoomForVerticalLanding() { Coords pos = ((Entity) this).getPosition(); IHex hex = ((Entity) this).getGame().getBoard().getHex(((Entity) this).getPosition()); if (((Entity) this).getGame().getBoard().getBuildingAt(pos) != null) { return "Buildings in the way"; } // no units in the way for (Entity en : ((Entity) this).getGame().getEntitiesVector(pos)) { if (!en.isAirborne()) { return "Ground units in the way"; } } hex = ((Entity) this).getGame().getBoard().getHex(pos); // if the hex is null, then we are offboard. Don't let units // land offboard. if (null == hex) { return "landing area not on the map"; } // landing must contain only acceptable terrain if (!hex.isClearForLanding()) { return "Unacceptable terrain for landing"; } return null; }
private synchronized void updateTakeOffButtons() { if ((null != cmd) && (cmd.length() > 0)) { // you can't take off if you have already moved // http://www.classicbattletech.com/forums/index.php?topic=54112.0 setTakeOffEnabled(false); setVTakeOffEnabled(false); return; } final Entity ce = ce(); if (null == ce) { return; } if (ce.isAero()) { if (ce.isAirborne()) { setTakeOffEnabled(false); setVTakeOffEnabled(false); } else if (!ce.isShutDown()) { setTakeOffEnabled(((IAero) ce).canTakeOffHorizontally()); setVTakeOffEnabled(((IAero) ce).canTakeOffVertically()); } } else { setTakeOffEnabled(false); setVTakeOffEnabled(false); } }