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);
}
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();
}
}
}
}
}
}
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;
}
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...
*/
}
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);
}
Aggregations