/** * Rotate from the current facing to the destination facing. */ public void rotatePathfinder(final int destFacing, final boolean isManeuver) { while (getFinalFacing() != destFacing) { final MoveStepType stepType = getDirection(getFinalFacing(), destFacing); addStep(stepType, isManeuver, isManeuver); } }
public CoordsWithFacing(MovePath mp) { this(mp.getFinalCoords(), mp.getFinalFacing()); }
static CoordFacingCombo createCoordFacingCombo(MovePath p) { if (p == null) { return null; } return createCoordFacingCombo(p.getFinalCoords(), p.getFinalFacing()); }
closest.getPosition(); int desiredFacing = (toFace.direction(movingUnit.getPosition()) + 3) % 6; int currentFacing = path.getFinalFacing(); int facingDiff; if (currentFacing == desiredFacing) {
@Override public void performAction() { int curDir = cmd.getFinalFacing(); int dir = curDir; dir = (dir + 5) % 6; Coords curPos = cmd.getFinalCoords(); Coords target = curPos.translated(dir); // We need to set this to get the rotate behavior shiftheld = true; currentMove(target); shiftheld = false; clientgui.bv.drawMovementData(ce(), cmd); } });
@Override public void performAction() { int curDir = cmd.getFinalFacing(); int dir = curDir; dir = (dir + 7) % 6; Coords curPos = cmd.getFinalCoords(); Coords target = curPos.translated(dir); // We need to set this to get the rotate behavior shiftheld = true; currentMove(target); shiftheld = false; clientgui.bv.drawMovementData(ce(), cmd); } });
int initialFacing = initialPath.getFinalFacing(); int desiredFacing = intersectionStep.getFacing(); int leftTurnFacing = initialFacing;
private MovePath generateMockPath(int x, int y, Entity mockEntity) { final MovePath mockPath = Mockito.mock(MovePath.class); Mockito.when(mockPath.getEntity()).thenReturn(mockEntity); final Coords mockMyCoords = new Coords(x, y); Mockito.when(mockPath.getFinalCoords()).thenReturn(mockMyCoords); Mockito.when(mockPath.getFinalFacing()).thenReturn(0); return mockPath; }
/** * Convenience function encapsulating logic for whether, if we continue forward * along the current path in the current direction, we will run off the board * @return */ public boolean nextForwardStepOffBoard() { return !game.getBoard().contains(getFinalCoords().translated(getFinalFacing())); } }
public PathState(MovePath p) { location = p.getFinalCoords(); facing = p.getFinalFacing(); hulldown = p.getFinalHullDown() || p.getFinalProne(); isjumping = p.isJumping(); }
public Key getKey() { return new Key(getFinalCoords(), getFinalFacing(), getFinalProne() ? 0 : isJumping() ? 1 : 2); }
private int getFacingDiff(final MovePath first) { if (first.isJumping()) { return 0; } if (first.getFinalCoords().equals(destination)) { return 0; } int firstFacing = Math.abs(((first.getFinalCoords().direction(destination) + (backward ? 3 : 0)) % 6) - first.getFinalFacing()); if (firstFacing > 3) { firstFacing = 6 - firstFacing; } if (first.canShift()) { firstFacing = Math.max(0, firstFacing - 1); } if ((first.getFinalCoords().degree(destination) % 60) != 0) { firstFacing++; } return firstFacing; } }
@Override public CoordsWithFacing getDestination(MovePath e) { MoveStep lastStep = e.getLastStep(); /* * entity moving backwards is like entity with an opposite facing * moving forwards :) NOOOT */ CoordsWithFacing cfw; if (lastStep != null && lastStep.isThisStepBackwards()) { Facing f = Facing.valueOfInt(e.getFinalFacing()); cfw = new CoordsWithFacing(e.getFinalCoords(), f.getOpposite().getIntValue()); } else { cfw = new CoordsWithFacing(e); } return cfw; }
/** * @param boardView1 * @param mp */ public MovementModifierEnvelopeSprite(BoardView1 boardView1, MovePath mp) { super(boardView1, mp.getFinalCoords()); facing = Facing.valueOfInt(mp.getFinalFacing()); int modi = Compute.getTargetMovementModifier(mp.getHexesMoved(), mp.isJumping(), mp.getEntity() instanceof VTOL, boardView1.game).getValue(); //Add evasion bonus for 'Mech with dual cockpit if (mp.getEntity().getCrew().getCrewType().equals(CrewType.DUAL) && mp.getEntity().getCrew().hasDedicatedPilot() && !mp.isJumping() && mp.getHexesMoved() > 0) { modi++; } float hue = 0.7f - 0.15f * modi; color = new Color(Color.HSBtoRGB(hue, 1, 1)); modifier = String.format("%+d", modi); }
&& other.isDone() && other.canLoad(ce) && ce.isLoadableThisTurn() && (cmd.getFinalFacing() == other.getFacing())) {
int myFacing = path.getFinalFacing(); Coords behind = finalCoords.translated((myFacing + 3) % 6); Coords leftFlank = finalCoords.translated((myFacing + 2) % 6);
setWeaponFieldofFire(cmd.getFinalFacing(), cmd.getFinalCoords());
/** * Initialize an entity state from a movement path */ EntityState(MovePath path) { position = path.getFinalCoords(); facing = path.getFinalFacing(); hexesMoved = path.getHexesMoved(); heat = path.getEntity().heat; if (path.getLastStepMovementType() == EntityMovementType.MOVE_WALK) { heat = getHeat() + 1; } else if (path.getLastStepMovementType() == EntityMovementType.MOVE_RUN) { heat = getHeat() + 2; } else if ((path.getLastStepMovementType() == EntityMovementType.MOVE_JUMP) && (getHexesMoved() <= 3)) { heat = getHeat() + 3; } else if ((path.getLastStepMovementType() == EntityMovementType.MOVE_JUMP) && (getHexesMoved() > 3)) { heat = getHeat() + getHexesMoved(); } prone = path.getFinalProne() || path.getFinalHullDown(); immobile = path.getEntity().isImmobile(); jumping = path.isJumping(); movementType = path.getLastStepMovementType(); naturalAptGun = path.getEntity().hasAbility(OptionsConstants.PILOT_APTITUDE_GUNNERY); naturalAptPilot = path.getEntity().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING); setSecondaryFacing(getFacing()); }
&& other.isCapitalFighter() && other.isDone() && other.canLoad(ce) && (cmd.getFinalFacing() == other.getFacing())) {