use of eidolons.game.battlecraft.logic.dungeon.location.Location in project Eidolons by IDemiurge.
the class LE_MapMaster method transform.
public static void transform() {
TRANSFORM transform = new EnumMaster<TRANSFORM>().retrieveEnumConst(TRANSFORM.class, ListChooser.chooseEnum(TRANSFORM.class));
if (transform == null) {
return;
}
Location dungeon = LevelEditor.getCurrentLevel().getLocation();
DungeonPlan plan = dungeon.getPlan();
switch(transform) {
case FLIP_X:
plan.setFlippedX(!plan.isFlippedX());
break;
case FLIP_Y:
plan.setFlippedY(!plan.isFlippedY());
break;
case ROTATE:
plan.setRotated(!plan.isRotated());
break;
}
dungeon.setPlan(plan);
plan = new LocationBuilder().transformDungeonPlan(plan);
dungeon.setPlan(plan);
LevelEditor.getSimulation().getUnits().clear();
LevelEditor.getCurrentLevel().init();
LevelEditor.getCurrentLevel().getMinimap().init();
LevelEditor.getCurrentLevel().getMinimap().getGrid().refresh();
}
use of eidolons.game.battlecraft.logic.dungeon.location.Location in project Eidolons by IDemiurge.
the class LE_DataMaster method levelSaved.
public static void levelSaved(Level level) {
String dungeon_main_entrances = "";
Location location = level.getLocation();
if (location.getMainEntrance() != null) {
dungeon_main_entrances += location.getMainEntrance().getNameAndCoordinate() + DungeonLevelMaster.ENTRANCE_SEPARATOR;
}
if (location.getMainExit() != null) {
dungeon_main_entrances += location.getMainExit().getNameAndCoordinate();
}
location.setProperty(PROPS.DUNGEON_MAIN_ENTRANCES, dungeon_main_entrances);
String subFolder = location.getProperty(G_PROPS.DUNGEON_SUBFOLDER);
if (subFolder.isEmpty()) {
subFolder = ListChooser.chooseEnum(DUNGEON_SUBFOLDER.class);
}
if (!StringMaster.isEmpty(subFolder)) {
// subFolder = subFolder.replace(getDungeonLevelFolder(), ""); TODO
// slashes FAILED!
subFolder = StringMaster.getLastPathSegment(subFolder);
subFolder = subFolder.replace(";", "");
location.setProperty(G_PROPS.DUNGEON_SUBFOLDER, subFolder);
// path = subFolder + "\\" + path; // by class?
}
String xml = level.getXml();
String fileName = location.getName();
String path = fileName;
if (!StringMaster.isEmpty(subFolder)) {
path = subFolder + "\\" + path;
}
if (location.getWorkspaceGroup() == null) {
location.setWorkspaceGroup(MetaEnums.WORKSPACE_GROUP.IMPLEMENT);
}
fileName += InfoMaster.getWorkspaceTip(location.getDungeon());
if (location.getWorkspaceGroup() == null || location.getWorkspaceGroup() == MetaEnums.WORKSPACE_GROUP.COMPLETE) {
deleteIncompleteVersions(fileName);
}
// if (level.getDungeon().isSurface()) {
// TODO battlefield prefix
// else {
// // TODO all in 'sublevels'
// if (!level.getDungeon().getProperty(PROPS.SUBDUNGEON_TYPE).isEmpty())
// {
// path = level.getDungeon().getProperty(PROPS.SUBDUNGEON_TYPE) + "\\" +
// path;
// }
// }
path += ".xml";
// level.getVersion()
File file = FileManager.getFile(getDungeonLevelFolder() + "\\" + path);
if (file.isFile()) {
if (level.getMission() == null) {
if (!DialogMaster.confirm("Overwrite?")) {
int version = 2;
while (true) {
String newPath = getDungeonLevelFolder() + fileName + NameMaster.VERSION + version + ".xml";
file = FileManager.getFile(newPath);
if (!file.isFile()) {
break;
}
version++;
}
path = StringMaster.replaceLast(path, fileName, fileName + NameMaster.VERSION + version);
fileName += NameMaster.VERSION + version;
}
}
}
// fileName += ".xml";
level.setPath(path);
level.setName(fileName);
if (!StringMaster.isEmpty(subFolder)) {
if (!new File(getDungeonLevelFolder() + subFolder + "\\").exists()) {
new File(getDungeonLevelFolder() + subFolder + "\\").mkdir();
}
}
FileManager.write(xml, getDungeonLevelFolder() + "\\" + path);
}
use of eidolons.game.battlecraft.logic.dungeon.location.Location in project Eidolons by IDemiurge.
the class ExploreGameLoop method checkNextLevel.
private boolean checkNextLevel() {
Coordinates c = game.getPlayer(true).getHeroObj().getCoordinates();
Location location = (Location) game.getDungeonMaster().getDungeonWrapper();
if (location.getMainExit() != null)
if (location.getMainExit().getCoordinates().equals(c)) {
// check party
return true;
}
if (game.isDebugMode())
if (location.getMainEntrance() != null)
if (location.getMainEntrance().getCoordinates().equals(c)) {
// test
return true;
}
return false;
}
Aggregations