Search in sources :

Example 1 with XDimension

use of main.swing.XDimension in project Eidolons by IDemiurge.

the class LocationBuilder method placeAdditionalRooms.

private void placeAdditionalRooms() {
    // TODO SET ROOM_TYPE AFTER TO FIT BEST? E.G.TREASURE/SECRET MOST
    // DISTANT FROM ENTRANCE
    int attempts = plan.getCellsX() * plan.getCellsY() * 10;
    int remainingAttempts = attempts;
    while (remainingAttempts > 0) {
        remainingAttempts--;
        boolean spec = false;
        if (attempts - remainingAttempts > 6) {
            spec = RandomWizard.chance(85);
        }
        String string = getDungeon().getProperty(PROPS.ADDITIONAL_ROOM_TYPES);
        ROOM_TYPE roomType = new RandomWizard<ROOM_TYPE>().getObjectByWeight(string, ROOM_TYPE.class);
        if (roomType == null) {
            string = helper.getParams().getValue(BUILD_PARAMS.ADDITIONAL_ROOMS);
            roomType = new RandomWizard<ROOM_TYPE>().getRandomListItem(Arrays.asList(spec ? spec_room_types : std_room_types));
        }
        Coordinates c = getRandomCoordinate(roomType);
        if (c == null) {
            continue;
        }
        XDimension size = helper.getRoomSize(roomType);
        // boolean flipX = location.isFlipX(c);
        // boolean flipY = location.isFlipY(c); // TODO
        helper.tryPlaceRoom(roomType, c, size.width, size.height, flipX, flipY);
        if (helper.getUsedCoordinates().size() * 100 / (getDungeon().getCellsX() * getDungeon().getCellsY()) > helper.getParams().PREFERRED_FILL_PERCENTAGE) {
            break;
        }
    }
// distance from other blocks?
}
Also used : XDimension(main.swing.XDimension) RandomWizard(main.system.auxiliary.RandomWizard) Coordinates(main.game.bf.Coordinates)

Example 2 with XDimension

use of main.swing.XDimension in project Eidolons by IDemiurge.

the class LocationBuilder method placeMainRoom.

private void placeMainRoom(ROOM_TYPE type, DUNGEON_TEMPLATES template) {
    // some big dungeons may want this to go down! TODO
    int sizeMod = 100;
    XDimension size = helper.getRoomSize(type);
    int width = size.getWidth();
    int height = size.getHeight();
    Coordinates c = helper.getMainRoomCoordinates(template, type, width, height);
    if (!helper.tryPlaceRoom(type, c, width, height)) {
    // throw new RuntimeException();
    }
}
Also used : XDimension(main.swing.XDimension) Coordinates(main.game.bf.Coordinates)

Aggregations

Coordinates (main.game.bf.Coordinates)2 XDimension (main.swing.XDimension)2 RandomWizard (main.system.auxiliary.RandomWizard)1