Search in sources :

Example 1 with EmptyRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom in project shattered-pixel-dungeon-gdx by 00-Evan.

the class SewerBossLevel method initRooms.

@Override
protected ArrayList<Room> initRooms() {
    ArrayList<Room> initRooms = new ArrayList<>();
    initRooms.add(roomEntrance = roomExit = new SewerBossEntranceRoom());
    int standards = standardRooms();
    for (int i = 0; i < standards; i++) {
        initRooms.add(new EmptyRoom());
    }
    initRooms.add(new RatKingRoom());
    return initRooms;
}
Also used : RatKingRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) ArrayList(java.util.ArrayList) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) SewerBossEntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) RatKingRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom) SewerBossEntranceRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom)

Example 2 with EmptyRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom in project shattered-pixel-dungeon-gdx by 00-Evan.

the class CavesPainter method decorate.

@Override
protected void decorate(Level level, ArrayList<Room> rooms) {
    int w = level.width();
    int l = level.length();
    int[] map = level.map;
    for (Room room : rooms) {
        if (!(room instanceof EmptyRoom || room instanceof CaveRoom)) {
            continue;
        }
        if (room.width() <= 4 || room.height() <= 4) {
            continue;
        }
        int s = room.square();
        if (Random.Int(s) > 8) {
            int corner = (room.left + 1) + (room.top + 1) * w;
            if (map[corner - 1] == Terrain.WALL && map[corner - w] == Terrain.WALL) {
                map[corner] = Terrain.WALL;
                level.traps.remove(corner);
            }
        }
        if (Random.Int(s) > 8) {
            int corner = (room.right - 1) + (room.top + 1) * w;
            if (map[corner + 1] == Terrain.WALL && map[corner - w] == Terrain.WALL) {
                map[corner] = Terrain.WALL;
                level.traps.remove(corner);
            }
        }
        if (Random.Int(s) > 8) {
            int corner = (room.left + 1) + (room.bottom - 1) * w;
            if (map[corner - 1] == Terrain.WALL && map[corner + w] == Terrain.WALL) {
                map[corner] = Terrain.WALL;
                level.traps.remove(corner);
            }
        }
        if (Random.Int(s) > 8) {
            int corner = (room.right - 1) + (room.bottom - 1) * w;
            if (map[corner + 1] == Terrain.WALL && map[corner + w] == Terrain.WALL) {
                map[corner] = Terrain.WALL;
                level.traps.remove(corner);
            }
        }
        for (Room n : room.connected.keySet()) {
            if ((n instanceof StandardRoom || n instanceof ConnectionRoom) && Random.Int(3) == 0) {
                Painter.set(level, room.connected.get(n), Terrain.EMPTY_DECO);
            }
        }
    }
    for (int i = w + 1; i < l - w; i++) {
        if (map[i] == Terrain.EMPTY) {
            int n = 0;
            if (map[i + 1] == Terrain.WALL) {
                n++;
            }
            if (map[i - 1] == Terrain.WALL) {
                n++;
            }
            if (map[i + w] == Terrain.WALL) {
                n++;
            }
            if (map[i - w] == Terrain.WALL) {
                n++;
            }
            if (Random.Int(6) <= n) {
                map[i] = Terrain.EMPTY_DECO;
            }
        }
    }
    for (int i = 0; i < l - w; i++) {
        if (map[i] == Terrain.WALL && DungeonTileSheet.floorTile(map[i + w]) && Random.Int(4) == 0) {
            map[i] = Terrain.WALL_DECO;
        }
    }
    for (Room r : rooms) {
        if (r instanceof EmptyRoom) {
            for (Room n : r.neigbours) {
                if (n instanceof EmptyRoom && !r.connected.containsKey(n)) {
                    Rect i = r.intersect(n);
                    if (i.left == i.right && i.bottom - i.top >= 5) {
                        i.top += 2;
                        i.bottom -= 1;
                        i.right++;
                        Painter.fill(level, i.left, i.top, 1, i.height(), Terrain.CHASM);
                    } else if (i.top == i.bottom && i.right - i.left >= 5) {
                        i.left += 2;
                        i.right -= 1;
                        i.bottom++;
                        Painter.fill(level, i.left, i.top, i.width(), 1, Terrain.CHASM);
                    }
                }
            }
        }
    }
}
Also used : ConnectionRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom) Rect(com.watabou.utils.Rect) CaveRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CaveRoom) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom) CaveRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CaveRoom) Room(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room) ConnectionRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom) StandardRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom)

Example 3 with EmptyRoom

use of com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom in project shattered-pixel-dungeon-gdx by 00-Evan.

the class RegularPainter method joinRooms.

protected boolean joinRooms(Level l, Room r, Room n) {
    if (!(r instanceof EmptyRoom && n instanceof EmptyRoom)) {
        return false;
    }
    // TODO decide on good probabilities and dimension restrictions
    Rect w = r.intersect(n);
    if (w.left == w.right) {
        if (w.bottom - w.top < 3) {
            return false;
        }
        if (w.height() + 1 == Math.max(r.height(), n.height())) {
            return false;
        }
        if (r.width() + n.width() > 10) {
            return false;
        }
        w.top += 1;
        w.bottom -= 0;
        w.right++;
        Painter.fill(l, w.left, w.top, 1, w.height(), Terrain.EMPTY);
    } else {
        if (w.right - w.left < 3) {
            return false;
        }
        if (w.width() + 1 == Math.max(r.width(), n.width())) {
            return false;
        }
        if (r.height() + n.height() > 10) {
            return false;
        }
        w.left += 1;
        w.right -= 0;
        w.bottom++;
        Painter.fill(l, w.left, w.top, w.width(), 1, Terrain.EMPTY);
    }
    return true;
}
Also used : Rect(com.watabou.utils.Rect) EmptyRoom(com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom)

Aggregations

EmptyRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom)3 Room (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room)2 StandardRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom)2 Rect (com.watabou.utils.Rect)2 ConnectionRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom)1 RatKingRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom)1 CaveRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CaveRoom)1 SewerBossEntranceRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom)1 ArrayList (java.util.ArrayList)1