Search in sources :

Example 11 with Route

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();
}
Also used : ObjType(main.entity.type.ObjType) Coordinates(main.game.bf.Coordinates) File(java.io.File) Route(eidolons.game.module.adventure.map.Route)

Example 12 with Route

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);
}
Also used : Route(eidolons.game.module.adventure.map.Route)

Example 13 with Route

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();
}
Also used : Place(eidolons.game.module.adventure.map.Place) Route(eidolons.game.module.adventure.map.Route)

Example 14 with Route

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;
}
Also used : Place(eidolons.game.module.adventure.map.Place) Route(eidolons.game.module.adventure.map.Route) HashSet(java.util.HashSet)

Aggregations

Route (eidolons.game.module.adventure.map.Route)14 Place (eidolons.game.module.adventure.map.Place)6 MacroParty (eidolons.game.module.adventure.entity.MacroParty)3 ObjType (main.entity.type.ObjType)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)1 Area (eidolons.game.module.adventure.map.Area)1 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)1 TablePanel (eidolons.libgdx.gui.panels.TablePanel)1 PlaceActor (eidolons.libgdx.screens.map.obj.PlaceActor)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Coordinates (main.game.bf.Coordinates)1