/** * Travel between two locations, where neither is a city. * @param vessel travelling between two locations at sea * @param location destination location */ public void travelNotBetweenCities(INavigableVessel vessel, Point2D location) { List<Point2D> path = travelTo(vessel, location); Preconditions.checkNotNull(path); pathConverter.createPath(vessel, path, 1); VesselPositionUpdateData vesselPositionUpdateData = interpolators.get(vessel); vesselPositionUpdateData.setDestinationCity(false); vesselPositionUpdateData.setSourceCity(false); }
/** * Travel from a city to a place that is not a city. * @param vessel traveling from a city to a location at sea * @param location destination location */ public void travelFromCity(INavigableVessel vessel, Point2D location) { List<Point2D> path = travelTo(vessel, location); Preconditions.checkNotNull(path); pathConverter.createPath(vessel, path, 1); VesselPositionUpdateData vesselPositionUpdateData = interpolators.get(vessel); vesselPositionUpdateData.setDestinationCity(false); vesselPositionUpdateData.setSourceCity(true); } }
@Subscribe public void handleBlockadeStart(BlockadeShipRequestEvent event) { IAIPlayer player = event.getPlayer(); int requiredShips = event.getNumberOfShips(); for (int i = 0; i < requiredShips; i++) { Optional<IShip> optShip = blockadeStrategy.selectShip(player); if (optShip.isPresent()) { IShip vessel = optShip.get(); player.setTradeMission(vessel, new IBlockadeMission() {}); seafaringService.travelTo(vessel, event.getAssemblyCity().getCoordinates()); } else { break; } } } @Subscribe
/** * Travel from one city to another. * @param vessel which travels between cities * @param toCity destination city */ public void travelBetweenCities(INavigableVessel vessel, ICity toCity) { List<Point2D> path = travelTo(vessel, toCity.getCoordinates()); Preconditions.checkNotNull(path); pathConverter.createPath(vessel, path, 1); VesselPositionUpdateData vesselPositionUpdateData = interpolators.get(vessel); vesselPositionUpdateData.setDestinationCity(true); vesselPositionUpdateData.setSourceCity(true); }
/** * Travel from a location that is not a city to a city. * @param vessel traveling to a city * @param toCity destination city */ public void travelToCity(INavigableVessel vessel, ICity toCity) { List<Point2D> path = travelTo(vessel, toCity.getCoordinates()); Preconditions.checkNotNull(path); pathConverter.createPath(vessel, path, 1); VesselPositionUpdateData vesselPositionUpdateData = interpolators.get(vessel); vesselPositionUpdateData.setDestinationCity(true); vesselPositionUpdateData.setSourceCity(false); }
List<Point2D> path = new ArrayList<>(); if (destinationCity.isPresent()) { path = seafaringService.travelTo(vessel, destinationCity.get().getCoordinates()); } else { final Point2D destination = new Point2D(unscaledX, unscaledY); if (aStarGraphService.isOnSea(destination)) { path = seafaringService.travelTo(vessel, destination);