use of eidolons.game.battlecraft.logic.dungeon.location.building.MapZone in project Eidolons by IDemiurge.
the class LocationBuilder method createZone.
private MapZone createZone(DungeonPlan plan, int zoneId, Node zoneNode) {
String name = zoneNode.getNodeName();
String nodeName = XML_Formatter.restoreXmlNodeName(name);
if (!nodeName.contains(",")) {
nodeName = XML_Formatter.restoreXmlNodeNameOld(name);
}
int[] c = CoordinatesMaster.getMinMaxCoordinates(nodeName.split(",")[1]);
MapZone zone = new MapZone(plan.getDungeon(), zoneId, c[0], c[1], c[2], c[3]);
return zone;
}
use of eidolons.game.battlecraft.logic.dungeon.location.building.MapZone in project Eidolons by IDemiurge.
the class LE_PlanPanel method edit.
private boolean edit() {
MapZone zone = getSelectedZone();
if (zone == null) {
return false;
}
// Boolean filler_size_position =
// DialogMaster.askAndWait("What to edit for ",
// "Filler", "Size",
// "Position");
// move?
String prevFiller = zone.getFillerType();
String filler = DialogMaster.inputText("Set new Filler Type for " + zone.getName() + "...", prevFiller);
if (filler != null) {
if (!Objects.equals(filler, prevFiller)) {
zone.setFillerType(filler);
}
}
// zone.setX1(x1);
// zone.setName(name)
// size -> re-fill spaces!
List<Coordinates> coordinates = zone.getCoordinates();
for (MapBlock b : zone.getBlocks()) {
coordinates.removeAll(b.getCoordinates());
}
LevelEditor.getMapMaster().replace(prevFiller, filler, coordinates);
return true;
}
use of eidolons.game.battlecraft.logic.dungeon.location.building.MapZone in project Eidolons by IDemiurge.
the class LE_MapMaster method addBlock.
public void addBlock(MapBlock block) {
clearArea(block.getCoordinates(), true);
Set<MapZone> zones = new HashSet<>();
// remove from other blocks?
for (Coordinates c : block.getCoordinates()) {
MapBlock b = getPlan().getBlockByCoordinate(c);
if (b != null) {
b.getCoordinates().remove(c);
zones.add(b.getZone());
// blocks.add(b);
// hard to Undo...
b.getCoordinates().remove(c);
// perhaps I can keep a copy of the *PLAN* or even *LEVEL* to
// return to?
}
}
if (zones.isEmpty()) {
zones.addAll(getPlan().getZones());
}
MapZone zone = (MapZone) zones.toArray()[0];
if (zones.size() > 1) {
int index = DialogMaster.optionChoice(zones.toArray(), "Choose zone");
if (index != -1) {
zone = (MapZone) zones.toArray()[index];
}
}
zone.addBlock(block);
block.setZone(zone);
LevelEditor.getMainPanel().getPlanPanel().getTreePanel().blockAdded(block);
getPlan().getBlocks().add(block);
// for (MapBlock b: blocks){
// b.getCoordinates().removeAll(block.getCoordinates());
// }
}
use of eidolons.game.battlecraft.logic.dungeon.location.building.MapZone in project Eidolons by IDemiurge.
the class DungeonBuilder method initDynamicObjData.
protected void initDynamicObjData(Location location, DungeonPlan plan) {
int z = location.getIntParam(G_PARAMS.Z_LEVEL);
for (MapBlock b : plan.getBlocks()) {
ArrayList<Obj> objects = new ArrayList<>(b.getObjects());
for (Obj obj : objects) {
// TODO of course - the issue was that I added an object to
// block too! ... init?
BattleFieldObject unit = (BattleFieldObject) obj;
if (z != 0) {
unit.setZ(z);
}
}
}
for (MapZone zone : plan.getZones()) {
ObjType wallType = DataManager.getType(zone.getFillerType(), DC_TYPE.BF_OBJ);
if (wallType == null)
continue;
List<Coordinates> list = zone.getCoordinates();
for (MapBlock b : zone.getBlocks()) {
list.removeAll(b.getCoordinates());
}
for (Coordinates c : list) {
getGame().getManager().getObjCreator().createUnit(wallType, c.x, c.y, Player.NEUTRAL, new Ref(game));
}
}
for (Obj obj : plan.getWallObjects()) {
BattleFieldObject unit = (BattleFieldObject) obj;
if (z != 0) {
unit.setZ(z);
}
}
if (plan.getDirectionMap() != null) {
try {
DC_ObjInitializer.initDirectionMap(z, plan.getDirectionMap());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
if (plan.getFlipMap() != null) {
try {
DC_ObjInitializer.initFlipMap(z, plan.getFlipMap());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
use of eidolons.game.battlecraft.logic.dungeon.location.building.MapZone in project Eidolons by IDemiurge.
the class LocationBuilder method createMapZones.
private List<MapZone> createMapZones() {
List<MapZone> list = new ArrayList<>();
int i = 0;
MapZone zone = new MapZone(getDungeon().getDungeon(), i, 0, getDungeon().getCellsX(), 0, getDungeon().getCellsY());
list.add(zone);
// }
return list;
}
Aggregations