/** * Clones this path, will contain a new clone of the steps so that the clone * is independent from the original. * * @return the cloned MovePath */ @Override public MovePath clone() { final MovePath copy = new MovePath(getGame(), getEntity()); copy.steps = new Vector<MoveStep>(steps); copy.careful = careful; copy.containedStepTypes = new HashSet<>(containedStepTypes); copy.fliesOverEnemy = fliesOverEnemy; return copy; }
ArrayList<WeightedPath> getAllWeightedPaths(Entity entity, IGame game) { final String METHOD_NAME = "getAllWeightedPaths(Entity, IGame)"; owner.methodBegin(getClass(), METHOD_NAME); try { ranker.initUnitTurn(entity, game); TreeMap<PathState, WeightedPath> pathmap = new TreeMap<PathState, WeightedPath>(); ArrayList<WeightedPath> start_path = new ArrayList<WeightedPath>(); MovePath empty_path = new MovePath(game, entity); double empty_rank = ranker.rankPath(empty_path, game).getRank(); WeightedPath start = new WeightedPath(empty_path, empty_rank); pathmap.put(new PathState(start.path), start); start_path.add(start); if (entity.getJumpMP() > 0) { //allow jumping MovePath jump_path = new MovePath(game, entity); jump_path.addStep(MoveStepType.START_JUMP); WeightedPath startjump = new WeightedPath(jump_path, empty_rank - 0.1); pathmap.put(new PathState(startjump.path), startjump); start_path.add(startjump); } return seeAllPaths(start_path, true, true, game, pathmap); } finally { owner.methodEnd(getClass(), METHOD_NAME); } }
MovePath connectedPath = new MovePath(entity.getGame(), entity);
MovePath startPath = new MovePath(entity.getGame(), entity); if(entity.hasETypeFlag(Entity.ETYPE_INFANTRY)) { startPath.addStep(MoveStepType.CLIMB_MODE_OFF);
@Test public void testGetLastStep() { IGame mockGame = Mockito.mock(IGame.class); Entity mockMech = Mockito.mock(BipedMech.class); Vector<MoveStep> stepVector = new Vector<MoveStep>(); MoveStep mockStep1 = Mockito.mock(MoveStep.class); stepVector.add(mockStep1); MoveStep mockStep2 = Mockito.mock(MoveStep.class); stepVector.add(mockStep2); MoveStep mockStep3 = Mockito.mock(MoveStep.class); stepVector.add(mockStep3); MoveStep mockStep4 = Mockito.mock(MoveStep.class); stepVector.add(mockStep4); MovePath testPath = Mockito.spy(new MovePath(mockGame, mockMech)); Mockito.doReturn(stepVector).when(testPath).getStepVector(); Assert.assertEquals(mockStep4, testPath.getLastStep()); stepVector.add(null); Assert.assertEquals(mockStep4, testPath.getLastStep()); } }
MovePath startPath = new MovePath(getGame(), mover); apf.run(startPath); paths.addAll(apf.getAllComputedPathsUncategorized()); npf.run(new MovePath(game, mover)); paths.addAll(npf.getAllComputedPathsUncategorized()); apf.run(new MovePath(game, mover)); paths.addAll(apf.getAllComputedPathsUncategorized()); apf.run(new MovePath(game, mover)); paths.addAll(apf.getAllComputedPathsUncategorized()); ipf.run(new MovePath(game, mover)); paths.addAll(ipf.getAllComputedPathsUncategorized()); } else { // Non-Aero movement .newInstanceOfLongestPath(mover.getRunMPwithoutMASC(), MoveStepType.FORWARDS, getGame()); lpf.run(new MovePath(game, mover)); paths.addAll(lpf.getLongestComputedPaths()); lpf.run(new MovePath(getGame(), mover)); paths.addAll(lpf.getLongestComputedPaths()); .newInstanceOfOneToAll(mover.getJumpMP(), MoveStepType.FORWARDS, getGame()); spf.run((new MovePath(game, mover)) .addStep(MoveStepType.START_JUMP));
final MovePath mp = new MovePath(game, entity); mp.addStep(MovePath.MoveStepType.FLEE); return mp; log(getClass(), METHOD_NAME, LogLevel.INFO, msg); sendChat(msg, LogLevel.WARNING); final MovePath mp = new MovePath(game, entity); mp.addStep(MovePath.MoveStepType.EJECT); return mp; log(getClass(), METHOD_NAME, LogLevel.WARNING, "No valid paths found."); return performPathPostProcessing(new MovePath(game, entity), 0); return performPathPostProcessing(new MovePath(game, entity), 0);
return "Not an entity ID or valid number."; cmd = new MovePath(getClient().getGame(), ce());
/** * Clears out the currently selected movement data and resets it. */ private void clearAllMoves() { // switch back from swimming to normal mode. if (ce() != null) { if (ce().getMovementMode() == EntityMovementMode.BIPED_SWIM) ce().setMovementMode(EntityMovementMode.BIPED); else if (ce().getMovementMode() == EntityMovementMode.QUAD_SWIM) ce().setMovementMode(EntityMovementMode.QUAD); cmd = new MovePath(getClient().getGame(), ce()); } else { cmd = null; } gear = GEAR_LAND; }
MovePath mp = new MovePath(clientgui.getClient().getGame(), en);
final MovePath movePath = new MovePath(getGame(), mover);
MovePath joinedPath = new MovePath(entity.getGame(), entity); boolean intersected = false;
private void adjustPathForBridge(MovePath path) { boolean needsAdjust = false; for (Coords c : path.getCoordsSet()) { IHex hex = getGame().getBoard().getHex(c); if ((hex != null) && hex.containsTerrain(Terrains.BRIDGE)) { if (getGame().getBoard().getBuildingAt(c).getCurrentCF(c) >= path.getEntity().getWeight()) { needsAdjust = true; break; } else { needsAdjust = false; break; } } } if (!needsAdjust) { return; } MovePath adjusted = new MovePath(getGame(), path.getEntity()); adjusted.addStep(MoveStepType.CLIMB_MODE_ON); adjusted.addSteps(path.getStepVector(), true); adjusted.addStep(MoveStepType.CLIMB_MODE_OFF); path.replaceSteps(adjusted.getStepVector()); }
MovePath mp = new MovePath(clientgui.getClient().getGame(), ce()); if (gear == GEAR_JUMP) { mp.addStep(MoveStepType.START_JUMP);
cmd = new MovePath(clientgui.getClient().getGame(), ce); clientgui.bv.setWeaponFieldofFire(ce, cmd);
md = new MovePath(game, entity); int vel = a.getCurrentVelocity();