Search in sources :

Example 1 with Region

use of eidolons.game.module.adventure.map.Region 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 2 with Region

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

the class AreaManager method newTurn.

// how to figure out which groups got killed in a skirmish?
public static void newTurn() {
    // danger_level -> newGroup
    for (Region region : MacroManager.getRegions()) {
        for (Area area : region.getAreas()) {
            area.modifyParameter(MACRO_PARAMS.AREA_CREEP_POWER_TOTAL, TimeMaster.getHoursPerTurn() * area.getIntParam(MACRO_PARAMS.CREEP_POWER_PER_HOUR));
            checkAddGroups(area);
            for (MacroGroup group : area.getGroups()) {
                if (group.isAmbushing()) {
                // preCheck continue;
                } else {
                    if (!group.checkSetAmbush()) {
                        group.wander();
                    }
                }
            }
        }
    }
}
Also used : Area(eidolons.game.module.adventure.map.Area) MacroGroup(eidolons.game.module.adventure.travel.MacroGroup) Region(eidolons.game.module.adventure.map.Region)

Example 3 with Region

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

the class WorldGenerator method generateRegions.

public static List<Region> generateRegions(MacroRef ref) {
    List<Region> regions = new ArrayList<>();
    for (String s : StringMaster.open(world.getProperty(MACRO_PROPS.REGIONS))) {
        ObjType type = DataManager.getType(s, MACRO_OBJ_TYPES.REGION);
        region = createRegion(type, ref);
        regions.add(region);
    // AreaManager.assignPlacesToAreas(region);
    // if (!MacroManager.isEditMode()) {
    // AreaManager.initRegionAreas(region);
    // }
    }
    return regions;
}
Also used : ObjType(main.entity.type.ObjType) ArrayList(java.util.ArrayList) Region(eidolons.game.module.adventure.map.Region)

Example 4 with Region

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

the class WorldGenerator method createRegion.

public static Region createRegion(ObjType type, MacroRef ref) {
    // template
    // add places, towns and routes
    region = new Region(game, type, ref);
    // init default towns/places ; then add randomized
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.AREAS))) {
        type = DataManager.getType(s, MACRO_OBJ_TYPES.AREA);
        Area area = new Area(ref.getGame(), type, ref);
        region.getAreas().add(area);
    }
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.PARTIES))) {
        try {
            MacroParty party = createParty(ref, s);
            region.addParty(party);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.PLACES))) {
        Place place = createPlace(ref, s);
        if (place != null)
            region.addPlace(place);
    }
    for (String s : StringMaster.open(region.getProperty(MACRO_PROPS.TOWNS))) {
        Town town = createTown(ref, s);
        region.addTown(town);
    }
    generateRoutes();
    return region;
/*
         * r.getProperty(MACRO_PROPS.PLACES) Places - Power level ++ will be
		 * appearing as the game progresses
		 * 
		 * Routes - there should be at least 1 between each 2 places as
		 * "default" (preset) and then we can generate additional randomized
		 * routes For non-preset Places, we can use some metrics...
		 */
}
Also used : Area(eidolons.game.module.adventure.map.Area) MacroParty(eidolons.game.module.adventure.entity.MacroParty) Town(eidolons.game.module.adventure.town.Town) Region(eidolons.game.module.adventure.map.Region) Place(eidolons.game.module.adventure.map.Place)

Example 5 with Region

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

the class EditorManager method assignRegion.

private static void assignRegion(MacroObj obj, Integer x, Integer y) {
    Region r = null;
    for (Region sub : obj.getGame().getRegions()) {
        // if (new Rectangle(sub.getX(), sub.getY(), sub.getWidth(),
        // sub.getHeight()).contains(new Point(x, y)))
        r = sub;
    }
    obj.getRef().setRegion(r);
}
Also used : Region(eidolons.game.module.adventure.map.Region)

Aggregations

Region (eidolons.game.module.adventure.map.Region)5 MacroParty (eidolons.game.module.adventure.entity.MacroParty)2 Area (eidolons.game.module.adventure.map.Area)2 Place (eidolons.game.module.adventure.map.Place)2 Town (eidolons.game.module.adventure.town.Town)1 MacroGroup (eidolons.game.module.adventure.travel.MacroGroup)1 ArrayList (java.util.ArrayList)1 ObjType (main.entity.type.ObjType)1