use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class RouteMaster method init.
public void init() {
List<File> routes = FileManager.getFilesFromDirectory(StrPathBuilder.build(PathFinder.getRouteImagePath(), "map"), false, false);
for (File sub : routes) {
String[] parts = sub.getName().split("_");
if (parts.length < 4) {
}
// POINT!
String orig = parts[0];
ObjType type = DataManager.getType(parts[1], MACRO_OBJ_TYPES.ROUTE);
String dest = parts[2];
Coordinates coordinates = new Coordinates(true, parts[3]);
String img = StringMaster.removePreviousPathSegments(sub.getPath(), PathFinder.getImagePath());
new Route(type, img, orig, dest, coordinates);
}
GuiEventManager.bind(MapEvent.MAP_READY, p -> added());
afterInit();
}
use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class TravelMaster method travel.
public static void travel(MacroParty party, float delta) {
Route route = party.getCurrentRoute();
int distance = route.getLength();
// bend factor
int speed = getTravelSpeed(party, route);
float progress = party.getRouteProgress();
float newProgress = speed * delta / distance;
party.setRouteProgress(progress + newProgress);
int x1 = party.getCurrentLocation().getX();
int x2 = party.getCurrentDestination().getX();
int y1 = party.getCurrentLocation().getY();
int y2 = party.getCurrentDestination().getY();
int xBase = (int) (x1 + (x2 - x1) * progress);
int yBase = (int) (y1 + (y2 - y1) * progress);
// float xOffset= route.getOffsetX(progress);
// float yOffset;
party.setX(xBase);
party.setY(yBase);
}
use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class MapActionHandler method partyAction.
public static void partyAction(MACRO_PARTY_ACTIONS action, MacroParty party) {
Set<Place> set;
Route route;
Place place;
switch(action) {
case AMBUSH:
party.setStatus(MACRO_STATUS.IN_AMBUSH);
// for 'encounters' to happen more likely...
break;
case CAMP:
RestMaster.startCamping(party);
break;
case EXPLORE:
// choose route? or choose current location to explore around...
party.setStatus(MACRO_STATUS.EXPLORING);
set = TravelMasterOld.getAvailableRoutesAsPlaces(party, null);
if (party.getCurrentLocation() != null) {
// else?
set.add(party.getCurrentLocation());
}
place = selectMapObj(set);
if (place == null) {
return;
}
party.setCurrentExploration(place);
break;
case TRAVEL:
// extract into effect???
party.setStatus(MACRO_STATUS.TRAVELING);
set = TravelMasterOld.getAvailablePlaces(party);
// set.addAll(TravelMaster.getAvailableRoutes(party));
place = selectMapObj(set);
if (place == null) {
return;
}
set = TravelMasterOld.getAvailableRoutesAsPlaces(party, place);
// MacroManager.getMapView().getMapComp().displayRoutes(set);
route = (Route) selectMapObj(set);
if (route == null) {
return;
}
party.setCurrentDestination(place);
if (route.getOrigin() == place) {
party.addProperty(G_PROPS.DYNAMIC_BOOLS, DYNAMIC_BOOLS.BACKWARDS_ROUTE_TRAVEL.toString());
} else {
party.removeProperty(G_PROPS.DYNAMIC_BOOLS, DYNAMIC_BOOLS.BACKWARDS_ROUTE_TRAVEL.toString());
}
party.setCurrentRoute(route);
break;
default:
break;
}
MacroManager.refreshGui();
}
use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class TravelMasterOld method getAvailablePlaces.
public static Set<Place> getAvailablePlaces(MacroParty party) {
Set<Place> list = new HashSet<>();
// via available routes! across Areas...
Set<Route> routes = getAvailableRoutes(party);
for (Route r : routes) {
// if (r.getDestination())
list.add(r.getDestination());
list.add(r.getOrigin());
}
return list;
}
Aggregations