Search in sources :

Example 6 with Place

use of eidolons.game.module.adventure.map.Place in project Eidolons by IDemiurge.

the class MacroGameLoop method act.

@Override
public void act(float delta) {
    if (isPaused())
        return;
    Place entered = checkBattleStarts();
    if (isAutoEnterCombat())
        if (entered != null) {
            combatStarts(entered);
            return;
        }
    timeMaster.act(delta);
}
Also used : Place(eidolons.game.module.adventure.map.Place)

Example 7 with Place

use of eidolons.game.module.adventure.map.Place in project Eidolons by IDemiurge.

the class MacroGameManager method getPlaceForPoint.

public Place getPlaceForPoint(String point) {
    // Map<String, Place> map = new HashMap<>();
    // get closest?
    float minDistance = Float.MAX_VALUE;
    Coordinates c = getGame().getPointMaster().getCoordinates(point);
    Place place = null;
    for (Place sub : getGame().getPlaces()) {
        float distance = new Vector2(c.x, c.y).dst(new Vector2(sub.getX(), sub.getY()));
        if (distance < minDistance) {
            minDistance = distance;
            place = sub;
        }
    // can we not attach click listeners to emtiterActors?!
    }
    return place;
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) Coordinates(main.game.bf.Coordinates) Place(eidolons.game.module.adventure.map.Place)

Example 8 with Place

use of eidolons.game.module.adventure.map.Place in project Eidolons by IDemiurge.

the class MacroManager method saveTheWorld.

public static void saveTheWorld() {
    // all locations to regions, etc
    for (Region region : getGame().getState().getRegions()) {
        String places = "";
        for (Place sub : getGame().getPlaces()) {
            if (sub.getRegion() != region)
                continue;
            places += sub.getNameAndCoordinate() + ";";
        }
        region.setProperty(MACRO_PROPS.PLACES, places, true);
        String parties = "";
        for (MacroParty sub : getGame().getParties()) {
            if (sub.getRegion() != region)
                continue;
            parties += sub.getNameAndCoordinate() + ";";
        }
        region.setProperty(MACRO_PROPS.PARTIES, parties, true);
    }
    XML_Writer.writeXML_ForTypeGroup(MACRO_OBJ_TYPES.REGION);
}
Also used : MacroParty(eidolons.game.module.adventure.entity.MacroParty) Region(eidolons.game.module.adventure.map.Region) Place(eidolons.game.module.adventure.map.Place)

Example 9 with Place

use of eidolons.game.module.adventure.map.Place in project Eidolons by IDemiurge.

the class WorldGenerator method createRoute.

private static Route createRoute(ObjType t) {
    Route r = new Route(game, t, region.getRef());
    Place orig = region.getPlace(r.getProperty(MACRO_PROPS.ORIGIN));
    orig.addRoute(r);
    Place dest = region.getPlace(r.getProperty(MACRO_PROPS.DESTINATION));
    dest.addRoute(r);
    r.setOrigin(orig);
    r.setDestination(dest);
    r.setParam(MACRO_PARAMS.ROUTE_LENGTH, TravelMasterOld.calculateRouteLength(r), true);
    return r;
}
Also used : Route(eidolons.game.module.adventure.map.Route) Place(eidolons.game.module.adventure.map.Place)

Example 10 with Place

use of eidolons.game.module.adventure.map.Place 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)

Aggregations

Place (eidolons.game.module.adventure.map.Place)16 Route (eidolons.game.module.adventure.map.Route)6 MacroParty (eidolons.game.module.adventure.entity.MacroParty)5 Coordinates (main.game.bf.Coordinates)3 Region (eidolons.game.module.adventure.map.Region)2 Vector2 (com.badlogic.gdx.math.Vector2)1 MacroRef (eidolons.game.module.adventure.MacroRef)1 Area (eidolons.game.module.adventure.map.Area)1 MAP_OBJ_INFO_LEVEL (eidolons.game.module.adventure.map.MapVisionMaster.MAP_OBJ_INFO_LEVEL)1 Town (eidolons.game.module.adventure.town.Town)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ObjType (main.entity.type.ObjType)1