/** * @return true if the entity is a QuadVee or LAM changing movement mode */ public boolean isChangingMode() { if (steps.size() > 0) { for (MoveStep step : steps) { if (step.getType() == MovePath.MoveStepType.CONVERT_MODE) { return true; } } } return false; }
/** * Returns true if the entity is jumping or if it's a flying lam. */ public boolean isJumping() { if (steps.size() > 0) { boolean jump = false; for (MoveStep step : steps) { if (step.getType() == MovePath.MoveStepType.START_JUMP) { jump = true; } } return jump; } return false; }
/** * Helper function that rebuilds the "contained step types" from scratch. * Loops over all the steps in the path, so should only be used when removing or replacing steps. */ private void regenerateStepTypes() { containedStepTypes.clear(); for(MoveStep step : steps) { containedStepTypes.add(step.getType()); } }
/** * Removes impossible steps. */ public void clipToPossible() { if (steps.size() == 0) { // nothing to clip return; } // Do final check for bad moves, and clip movement after first bad one // also clear and re-constitute "contained steps" cache containedStepTypes = new HashSet<>(); final Vector<MoveStep> goodSteps = new Vector<>(); for (MoveStep step : steps) { if (step.getMovementType(isEndStep(step)) != EntityMovementType.MOVE_ILLEGAL) { containedStepTypes.add(step.getType()); goodSteps.addElement(step); } else { break; } } steps = goodSteps; }
/** * Worker function to calculate whether, if the given move step is added to the given move path, there will be * "too much turning", where a turn of 180 degrees or more is considered too much (we can yaw instead) * @param path The move path to consider * @param stepType The step type to consider * @return Whether we're turning too much */ private boolean tooMuchTurning(MovePath path, MoveStepType stepType) { if(path.getLastStep() == null || path.getSecondLastStep() == null) { return false; } // more than two turns in a row is no good if((stepType == MoveStepType.TURN_LEFT || stepType == MoveStepType.TURN_RIGHT) && (path.getSecondLastStep().getType() == path.getLastStep().getType()) && (path.getLastStep().getType() == stepType)) { return true; } // turning back and forth in place is no good if((stepType == MoveStepType.TURN_LEFT && path.getLastStep().getType() == MoveStepType.TURN_RIGHT) || (stepType == MoveStepType.TURN_RIGHT && path.getLastStep().getType() == MoveStepType.TURN_LEFT)) { return true; } return false; } }
/** * Changes turn-forwards-opposite-turn sequences into quad lateral shifts. * <p/> * Finds the sequence of three steps that can be transformed, then removes * all three and replaces them with the lateral shift step. */ @SuppressWarnings("unused") private void transformLateralShift() { if (steps.size() < 3) { return; } final int index = steps.size() - 3; final MoveStep step1 = getStep(index); final MoveStep step2 = getStep(index + 1); final MoveStep step3 = getStep(index + 2); if (step1.oppositeTurn(step3) && ((step2.getType() == MovePath.MoveStepType.BACKWARDS) || (step2.getType() == MovePath.MoveStepType.FORWARDS))) { final MoveStepType stepType = step1.getType(); final MoveStepType direction = step2.getType(); // remove all old steps steps.removeElementAt(index); steps.removeElementAt(index); steps.removeElementAt(index); // add new step final MoveStep shift = new MoveStep(this, lateralShiftForTurn(stepType, direction)); addStep(shift); } }
default PilotingRollData checkRolls(MoveStep step, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if (((step.getType() == MoveStepType.ROLL) || (step.getType() == MoveStepType.YAW)) && (step.getNRolls() > 1)) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), 0, "More than one roll in the same turn")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not rolling more than once"); } return roll; }
final MoveStep step1 = getStep(steps.size() - 1); if (step1.getType() == MovePath.MoveStepType.START_JUMP) { getEntity().setIsJumpingNow(false); if (step1.getType() == MovePath.MoveStepType.CONVERT_MODE) while (steps.size() > 0 && steps.get(steps.size() - 1).getType() == MovePath.MoveStepType.CONVERT_MODE) { steps.removeElementAt(steps.size() - 1);
return false; if ((path.getLastStep().getType() != MoveStepType.RETURN) && (path.getLastStep().getType() != MoveStepType.OFF)) { LogAeroMoveLegalityEvaluation("illegal move without return/off at the end", path); return false; if ((path.getLastStep().getType() != MoveStepType.RETURN) && (path.getLastStep().getType() != MoveStepType.OFF)) { LogAeroMoveLegalityEvaluation("not all velocity used without return/off at the end", path); return false;
&& !(getLastStep().getType() == MovePath.MoveStepType.FLEE || getLastStep().getType() == MovePath.MoveStepType.EJECT)) { return false; if (getLastStep().getType() == MoveStepType.CHARGE) { return getSecondLastStep().isLegal(this); if (getLastStep().getType() == MoveStepType.RAM) { return getSecondLastStep().isLegal(this);
/** * Checks if a maneuver requires a control roll */ default PilotingRollData checkManeuver(MoveStep step, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if ((step == null) || (step.getType() != MoveStepType.MANEUVER)) { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not attempting to get up."); return roll; } boolean sideSlipMod = (this instanceof ConvFighter) && isVSTOL(); roll.append( new PilotingRollData(((Entity) this).getId(), ManeuverType.getMod(step.getManeuverType(), sideSlipMod), ManeuverType.getTypeName(step.getManeuverType()) + " maneuver")); return roll; }
break; if (step.getType() == MoveStepType.RAM) { ramStep = step; ramSrc = step.getPosition();
return false; if (getEntity().wigeLiftoffHover() || steps.stream().map(s -> s.getType()) .anyMatch(st -> st == MoveStepType.UP || st == MoveStepType.HOVER)) {
private void updateConvertModeButton() { if (cmd.length() > 0 && cmd.getLastStep().getType() != MoveStepType.CONVERT_MODE) { setModeConvertEnabled(false); return;
if (!((cmd.getLastStep() != null) && cmd.getLastStep().isFirstStep() && (cmd.getLastStep().getType() == MoveStepType.LAY_MINE))) { clear();
return false; if ((last.getType() != MoveStepType.FORWARDS) || (isClan && getGame().getOptions().booleanOption(OptionsConstants.ALLOWED_NO_CLAN_PHYSICAL) && (getEntity()