/** * Damage that an Aero suffers after a successful charge. */ public static int getDamageTakenBy(IAero attacker, Entity target) { int avel = attacker.getCurrentVelocity(); int tvel = 0; if(target.isAero()) { tvel = ((IAero)target).getCurrentVelocity(); } return getDamageTakenBy(attacker, target, ((Entity)attacker).getPriorPosition(), avel, tvel); }
/** * Damage that an Aero does on a successful ramming attack * */ public static int getDamageFor(IAero attacker, Entity target) { int avel = attacker.getCurrentVelocity(); int tvel = 0; if(target.isAero()) { tvel = ((IAero)target).getCurrentVelocity(); } return getDamageFor(attacker, target, ((Entity)attacker).getPriorPosition(), avel, tvel); }
/** * Generates a list of possible step combinations that should be done at the beginning of a path * This implementation generates exactly one path, which is either no moves or one hex forward when velocity > 0 * @return "List" of all possible "starting" paths */ @Override protected List<MovePath> generateStartingPaths(MovePath startingEdge) { List<MovePath> startingPaths = new ArrayList<>(); // calculate max and min safe velocity // in space, we can go as slow or as fast as we want. IAero aero = (IAero) startingEdge.getEntity(); int maxThrust = AeroPathUtil.calculateMaxSafeThrust(aero); int maxVelocity = aero.getCurrentVelocity() + maxThrust; int minVelocity = Math.max(0, aero.getCurrentVelocity() - maxThrust); startingPaths.addAll(AeroPathUtil.generateValidAccelerations(startingEdge, minVelocity, maxVelocity)); // all non-zero-velocity paths must move at least one hex forward for(MovePath path : startingPaths) { if(path.getFinalVelocity() > 0) { path.addStep(MoveStepType.FORWARDS); } } return startingPaths; }
/** * This is a homebrew function partially drawn from pg. 40-1 of AT2R that * allows units that flee the field for any reason to return after a certain * number of rounds It can potentially be expanded to include other * conditions * * @param en * @return number of rounds until return (-1 if never) */ public static int roundsUntilReturn(IGame game, Entity en) { if (!en.isAero()) { return -1; } if (!game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_RETURN_FLYOVER)) { return -1; } IAero a = (IAero) en; // the table in AT2R is backwards, it should take longer to return if // your velocity is higher int turns = 1 + (int) Math.ceil(a.getCurrentVelocity() / 4.0); // OOC units should take longer, how about two extra turns? if (a.isOutControlTotal()) { turns += 2; } return turns; }
int maxVelocity = Math.min(getMaximumVelocity(aero), aero.getCurrentVelocity() + maxThrust); int minVelocity = Math.max(getMinimumVelocity(aero), aero.getCurrentVelocity() - maxThrust); Collection<MovePath> validAccelerations = AeroPathUtil.generateValidAccelerations(startingEdge, minVelocity, maxVelocity);
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; }
/** * Compares the initiative of two aerospace units in the same hex to determine attack angle. * The attack angle is computed as if the unit with the higher initiative were in its previous hex. * * @param e1 The first <code>Entity</code> to compare * @param e2 The second <code>Entity</code> to compare * @return < 0 if the first unit has a higher initiative, > 0 if the second is higher, * or 0 if one of the units is not an aerospace unit, does not have a valid position, * or the two units are not in the same hex. */ public static int shouldMoveBackHex(Entity e1, Entity e2) { if (null == e1.getPosition() || null == e2.getPosition() || !e1.getPosition().equals(e2.getPosition()) || !e1.isAero() || !e2.isAero()) { return 0; } int retVal = e1.getUnitType() - e2.getUnitType(); if (retVal == 0) { retVal = ((IAero)e2).getCurrentVelocity() - ((IAero)e1).getCurrentVelocity(); } // if all criteria are the same, select randomly if (retVal == 0) { retVal = d6() < 4? -1 : 1; } return retVal; }
if (entity.isAero()) { output.write("\" velocity=\""); output.write(((IAero)entity).getCurrentVelocity() + ""); output.write("\" altitude=\""); output.write(entity.getAltitude() + "");
fldStartVelocity.setText(new Integer(a.getCurrentVelocity()) .toString()); fldStartVelocity.addActionListener(this);
addToTT("AeroVelocity", BR, thisAero.getCurrentVelocity());
velocity = a.getCurrentVelocity(); velocityN = a.getNextVelocity(); velocityLeft = a.getCurrentVelocity() - entity.delta_distance; if (game.getBoard().onGround()) { velocityLeft = a.getCurrentVelocity() - (entity.delta_distance / 16);
IAero a = (IAero) getEntity(); if (getLastStep() == null) { if ((a.getCurrentVelocity() > 0) && !getGame().useVectorMove()) { return false;
curMoveR.setString(Integer.toString(a.getCurrentVelocity()) + Messages.getString("GeneralInfoMapSet.velocity")); int currentFuel = a.getCurrentFuel();
int vel = a.getCurrentVelocity(); if (null != last) { vel = last.getVelocityLeft();
int facing = ce.getFacing(); int velocityLeft = a.getCurrentVelocity(); if (step != null) { position = step.getPosition();
int vel = a.getCurrentVelocity();
int toAttacker = RamAttackAction.getDamageTakenBy(ae, (Entity)ta, cmd.getSecondFinalPosition(ce.getPosition()), cmd.getHexesMoved(), ta.getCurrentVelocity()); int toDefender = RamAttackAction.getDamageFor(ae, (Entity)ta, cmd.getSecondFinalPosition(ce.getPosition()), cmd.getHexesMoved(), ta.getCurrentVelocity());
MoveStep last = cmd.getLastStep(); int vel = a.getCurrentVelocity(); int veln = a.getNextVelocity(); if (null != last) {
unusedVelocity = cmd.getLastStep().getVelocityLeft() > 0; } else { unusedVelocity = (((IAero) ce()).getCurrentVelocity() > 0) && (ce().delta_distance == 0);