use of eidolons.game.module.adventure.entity.MacroParty 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.entity.MacroParty in project Eidolons by IDemiurge.
the class WorldGenerator method createParty.
private static MacroParty createParty(MacroRef ref, String s) {
Coordinates coordinates = new Coordinates(true, Integer.valueOf(VariableManager.getVar(s, 0)), Integer.valueOf(VariableManager.getVar(s, 1)));
String string = (VariableManager.getVar(s, 2));
Faction faction = null;
if (StringMaster.isEmpty(string)) {
faction = game.getPlayerFaction();
} else if (string.equalsIgnoreCase("player")) {
Party party = DC_Game.game.getMetaMaster().getPartyManager().getParty();
if (party == null) {
return null;
}
MacroParty playerParty = new MacroParty(getMacroPartyType(party), game, ref, party);
game.setPlayerParty(playerParty);
playerParty.setFaction(game.getPlayerFaction());
playerParty.setCoordinates(coordinates);
return playerParty;
} else
faction = game.getFaction(string);
String name = VariableManager.removeVarPart(s);
MacroParty party = new MacroParty(DataManager.getType(name, DC_TYPE.PARTY), ref.getGame(), ref);
party.setCoordinates(coordinates);
party.setFaction(faction);
party.setOriginalOwner(faction.getOwner());
party.setOwner(faction.getOwner());
return party;
}
use of eidolons.game.module.adventure.entity.MacroParty in project Eidolons by IDemiurge.
the class MacroGameManager method newTurn.
public void newTurn() {
// factionsTurn();
SaveMaster.saveInNewThread();
getGame().getCampaign().modifyParameter(MACRO_PARAMS.HOURS_ELAPSED, TimeMaster.getHoursPerTurn());
for (MacroParty p : getGame().getParties()) {
p.newTurn();
}
for (MacroObj p : getGame().getPlaces()) {
p.newTurn();
}
for (MacroObj p : getGame().getFactions()) {
p.newTurn();
}
for (MacroObj p : getGame().getRoutes()) {
p.newTurn();
}
for (TurnRule r : getGame().getTurnRules()) {
r.newTurn();
}
TravelMasterOld.newTurn();
AreaManager.newTurn();
refreshAll();
}
use of eidolons.game.module.adventure.entity.MacroParty 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.entity.MacroParty in project Eidolons by IDemiurge.
the class MapGuiStage method bindEvents.
@Override
protected void bindEvents() {
super.bindEvents();
GuiEventManager.bind(MapEvent.TIME_UPDATED, p -> {
if (!CoreEngine.isMapEditor())
blackout.fadeIn(1.25f);
});
GuiEventManager.bind(CREATE_PARTY, param -> {
MacroParty party = (MacroParty) param.get();
if (party == null) {
return;
}
if (party.isMine()) {
setParty(party);
}
});
}
Aggregations